-
Notifications
You must be signed in to change notification settings - Fork 3
/
top_tb.vhd
160 lines (145 loc) · 3.79 KB
/
top_tb.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
library IEEE;
use IEEE.std_logic_1164.all;
entity Top_tb is
end Top_tb;
architecture Behavioral of Top_tb is
component Top is
port (
MCLK1 : in std_logic;
XRST : in std_logic;
RS_TX : out std_logic;
RS_RX : in std_logic;
ZD : inout std_logic_vector(31 downto 0);
ZDP : inout std_logic_vector(3 downto 0);
ZA : out std_logic_vector(19 downto 0);
XE1 : out std_logic;
E2A : out std_logic;
XE3 : out std_logic;
XZBE : out std_logic_vector(3 downto 0);
XGA : out std_logic;
XWA : out std_logic;
XZCKE : out std_logic;
ZCLKMA : out std_logic_vector(1 downto 0);
ADVA : out std_logic;
XFT : out std_logic;
XLBO : out std_logic;
ZZA : out std_logic);
end component;
component GS8160Z18 is
generic (
report_read : boolean := false;
report_write : boolean := false);
port (
A : in std_logic_vector(19 downto 0); -- Address
CK : in std_logic; -- Clock
XBA : in std_logic; -- Write Byte A
XBB : in std_logic; -- Write Byte B
XW : in std_logic; -- Write Enable
XE1 : in std_logic; -- Chip Enable
E2 : in std_logic; -- Chip Enable
XE3 : in std_logic; -- Chip Enable
XG : in std_logic; -- Output Enable
ADV : in std_logic; -- Burst Mode
XCKE : in std_logic; -- Clock Enable
DQA : inout std_logic_vector(7 downto 0); -- Data A
DQB : inout std_logic_vector(7 downto 0); -- Data B
DQPA : inout std_logic; -- Data Parity A
DQPB : inout std_logic; -- Data Parity B
ZZ : in std_logic := '0'; -- Sleep
XFT : in std_logic := '1'; -- Flow Through Mode
XLBO : in std_logic); -- Linear Byte Order
end component;
signal ZD : std_logic_vector(31 downto 0);
signal ZDP : std_logic_vector(3 downto 0);
signal ZA : std_logic_vector(19 downto 0);
signal XE1 : std_logic;
signal E2A : std_logic;
signal XE3 : std_logic;
signal XZBE : std_logic_vector(3 downto 0);
signal XGA : std_logic;
signal XWA : std_logic;
signal XZCKE : std_logic;
signal ZCLKMA : std_logic_vector(1 downto 0);
signal ADVA : std_logic;
signal XFT : std_logic;
signal XLBO : std_logic;
signal ZZA : std_logic;
signal CLK : std_logic := '0';
signal rs_tx, rs_rx : std_logic;
signal XRST : std_logic := '1';
-- global clock period
constant CP: time := 15.15 ns;
-- bit rate:
-- 1 / 9600bps == 104166 ns
-- 1 / 115200bps == 8680 ns
-- 1 / 230400bps == 4340 ns
constant BR: time := 4340 ns;
begin
sram_unit0 : GS8160Z18 generic map (report_write => false) port map (
A => ZA,
CK => ZCLKMA(0),
XBA => XZBE(0),
XBB => XZBE(1),
XW => XWA,
XE1 => XE1,
E2 => E2A,
XE3 => XE3,
XG => XGA,
ADV => ADVA,
XCKE => XZCKE,
DQA => ZD(7 downto 0),
DQB => ZD(15 downto 8),
DQPA => ZDP(0),
DQPB => ZDP(1),
ZZ => ZZA,
XFT => XFT,
XLBO => XLBO);
sram_unit1 : GS8160Z18 generic map (report_write => false) port map (
A => ZA,
CK => ZCLKMA(1),
XBA => XZBE(2),
XBB => XZBE(3),
XW => XWA,
XE1 => XE1,
E2 => E2A,
XE3 => XE3,
XG => XGA,
ADV => ADVA,
XCKE => XZCKE,
DQA => ZD(23 downto 16),
DQB => ZD(31 downto 24),
DQPA => ZDP(2),
DQPB => ZDP(3),
ZZ => ZZA,
XFT => XFT,
XLBO => XLBO);
myTop : Top port map (
MCLK1 => CLK,
RS_TX => RS_TX,
RS_RX => RS_RX,
XRST => XRST,
ZD => ZD,
ZDP => ZDP,
ZA => ZA,
XE1 => XE1,
E2A => E2A,
XE3 => XE3,
XZBE => XZBE,
XGA => XGA,
XWA => XWA,
XZCKE => XZCKE,
ZCLKMA => ZCLKMA,
ADVA => ADVA,
XFT => XFT,
XLBO => XLBO,
ZZA => ZZA);
-- clock generator
process
begin
CLK <= '0';
wait for CP / 2;
CLK <= '1';
wait for CP / 2;
end process;
RS_RX <= '1';
end Behavioral;