w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_tst_sram_n3.vhd
Go to the documentation of this file.
1-- $Id: sys_tst_sram_n3.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2011-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_tst_sram_n3 - syn
7-- Description: test of nexys3 sram and its controller
8--
9-- Dependencies: vlib/xlib/s6_cmt_sfs
10-- vlib/genlib/clkdivce
11-- bplib/bpgen/bp_rs232_2l4l_iob
12-- bplib/bpgen/sn_humanio
13-- vlib/rlink/rlink_sp1c
14-- tst_sram
15-- bplib/nxcramlib/nx_cram_memctl_as
16--
17-- Test bench: tb/tb_tst_sram_n3
18--
19-- Target Devices: generic
20-- Tool versions: xst 13.1-14.7; ghdl 0.29-0.33
21--
22-- Synthesized (xst):
23-- Date Rev ise Target flop lutl lutm slic t peri
24-- 2014-12-20 614 14.7 131013 xc6slx16-2 922 1574 48 574 t 9.6 ns
25-- 2014-08-13 581 14.7 131013 xc6slx16-2 765 1261 32 441 t 9.6 ns
26-- 2011-12-21 442 13.4 O40d xc6slx16-2 722 1367 32 506 t 9.6 ns
27-- 2011-11-27 433 13.4 O40d xc6slx16-2 699 1194 20 406 t 8.9 ns
28--
29-- Revision History:
30-- Date Rev Version Comment
31-- 2016-07-10 785 1.5.1 SWI(1) now XON; SWI(0) now portsel
32-- 2016-07-09 784 1.5 tst_sram with AWIDTH and 22bit support
33-- 2016-03-19 748 1.4.2 define rlink SYSID
34-- 2015-04-11 666 1.4.1 rearrange XON handling
35-- 2014-08-28 588 1.4 use new rlink v4 iface and 4 bit STAT
36-- 2014-08-15 583 1.3 rb_mreq addr now 16 bit
37-- 2013-10-06 538 1.2 pll support, use clksys_vcodivide ect
38-- 2011-12-21 442 1.1.1 use rlink_sp1c
39-- 2011-12-03 435 1.1 use int&ext serport and bp_rs232_2l4l_iob
40-- 2011-11-27 433 1.0 Initial version (derived from sys_tst_sram_n2)
41------------------------------------------------------------------------------
42
43library ieee;
44use ieee.std_logic_1164.all;
45use ieee.numeric_std.all;
46
47use work.slvtypes.all;
48use work.xlib.all;
49use work.genlib.all;
50use work.serportlib.all;
51use work.rblib.all;
52use work.rlinklib.all;
53use work.bpgenlib.all;
54use work.s3boardlib.all;
55use work.nxcramlib.all;
56use work.sys_conf.all;
57
58-- ----------------------------------------------------------------------------
59
60entity sys_tst_sram_n3 is -- top level
61 -- implements nexys3_fusp_aif
62 port (
63 I_CLK100 : in slbit; -- 100 MHz clock
64 I_RXD : in slbit; -- receive data (board view)
65 O_TXD : out slbit; -- transmit data (board view)
66 I_SWI : in slv8; -- n3 switches
67 I_BTN : in slv5; -- n3 buttons
68 O_LED : out slv8; -- n3 leds
69 O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low)
70 O_SEG_N : out slv8; -- 7 segment disp: segments (act.low)
71 O_MEM_CE_N : out slbit; -- cram: chip enable (act.low)
72 O_MEM_BE_N : out slv2; -- cram: byte enables (act.low)
73 O_MEM_WE_N : out slbit; -- cram: write enable (act.low)
74 O_MEM_OE_N : out slbit; -- cram: output enable (act.low)
75 O_MEM_ADV_N : out slbit; -- cram: address valid (act.low)
76 O_MEM_CLK : out slbit; -- cram: clock
77 O_MEM_CRE : out slbit; -- cram: command register enable
78 I_MEM_WAIT : in slbit; -- cram: mem wait
79 O_MEM_ADDR : out slv23; -- cram: address lines
80 IO_MEM_DATA : inout slv16; -- cram: data lines
81 O_PPCM_CE_N : out slbit; -- ppcm: ...
82 O_PPCM_RST_N : out slbit; -- ppcm: ...
83 O_FUSP_RTS_N : out slbit; -- fusp: rs232 rts_n
84 I_FUSP_CTS_N : in slbit; -- fusp: rs232 cts_n
85 I_FUSP_RXD : in slbit; -- fusp: rs232 rx
86 O_FUSP_TXD : out slbit -- fusp: rs232 tx
87 );
89
90architecture syn of sys_tst_sram_n3 is
91
92 signal CLK : slbit := '0';
93
94 signal CE_USEC : slbit := '0';
95 signal CE_MSEC : slbit := '0';
96
97 signal GBL_RESET : slbit := '0';
98
99 signal RXD : slbit := '1';
100 signal TXD : slbit := '0';
101 signal CTS_N : slbit := '0';
102 signal RTS_N : slbit := '0';
103
104 signal SWI : slv8 := (others=>'0');
105 signal BTN : slv5 := (others=>'0');
106 signal LED : slv8 := (others=>'0');
107 signal DSP_DAT : slv16 := (others=>'0');
108 signal DSP_DP : slv4 := (others=>'0');
109
110 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
111 signal RB_SRES : rb_sres_type := rb_sres_init;
112 signal RB_LAM : slv16 := (others=>'0');
113 signal RB_STAT : slv4 := (others=>'0');
114
115 signal SER_MONI : serport_moni_type := serport_moni_init;
116
117 signal RB_SRES_TST : rb_sres_type := rb_sres_init;
118 signal RB_LAM_TST : slbit := '0';
119
120 signal MEM_RESET : slbit := '0';
121 signal MEM_REQ : slbit := '0';
122 signal MEM_WE : slbit := '0';
123 signal MEM_BUSY : slbit := '0';
124 signal MEM_ACK_R : slbit := '0';
125 signal MEM_ACK_W : slbit := '0';
126 signal MEM_ACT_R : slbit := '0';
127 signal MEM_ACT_W : slbit := '0';
128 signal MEM_ADDR : slv22 := (others=>'0');
129 signal MEM_BE : slv4 := (others=>'0');
130 signal MEM_DI : slv32 := (others=>'0');
131 signal MEM_DO : slv32 := (others=>'0');
132
133 constant sysid_proj : slv16 := x"0104"; -- tst_sram
134 constant sysid_board : slv8 := x"03"; -- nexys3
135 constant sysid_vers : slv8 := x"00";
136
137begin
138
139 GEN_CLKSYS : s6_cmt_sfs
140 generic map (
141 VCO_DIVIDE => sys_conf_clksys_vcodivide,
142 VCO_MULTIPLY => sys_conf_clksys_vcomultiply,
143 OUT_DIVIDE => sys_conf_clksys_outdivide,
144 CLKIN_PERIOD => 10.0,
145 CLKIN_JITTER => 0.01,
146 STARTUP_WAIT => false,
147 GEN_TYPE => sys_conf_clksys_gentype)
148 port map (
149 CLKIN => I_CLK100,
150 CLKFX => CLK,
151 LOCKED => open
152 );
153
154 CLKDIV : clkdivce
155 generic map (
156 CDUWIDTH => 7, -- good for up to 127 MHz !
157 USECDIV => sys_conf_clksys_mhz,
158 MSECDIV => 1000)
159 port map (
160 CLK => CLK,
161 CE_USEC => CE_USEC,
163 );
164
165 IOB_RS232 : bp_rs232_2l4l_iob
166 port map (
167 CLK => CLK,
168 RESET => '0',
169 SEL => SWI(0),
170 RXD => RXD,
171 TXD => TXD,
172 CTS_N => CTS_N,
173 RTS_N => RTS_N,
174 I_RXD0 => I_RXD,
175 O_TXD0 => O_TXD,
180 );
181
182 HIO : sn_humanio
183 generic map (
184 BWIDTH => 5)
185 port map (
186 CLK => CLK,
187 RESET => '0',
188 CE_MSEC => CE_MSEC,
189 SWI => SWI,
190 BTN => BTN,
191 LED => LED,
192 DSP_DAT => DSP_DAT,
193 DSP_DP => DSP_DP,
194 I_SWI => I_SWI,
195 I_BTN => I_BTN,
196 O_LED => O_LED,
197 O_ANO_N => O_ANO_N,
199 );
200
201 RLINK : rlink_sp1c
202 generic map (
203 BTOWIDTH => 6, -- 64 cycles access timeout
204 RTAWIDTH => 12,
205 SYSID => sysid_proj & sysid_board & sysid_vers ,
206 IFAWIDTH => 5, -- 32 word input fifo
207 OFAWIDTH => 5, -- 32 word output fifo
208 ENAPIN_RLMON => sbcntl_sbf_rlmon,
209 ENAPIN_RBMON => sbcntl_sbf_rbmon,
210 CDWIDTH => 13,
211 CDINIT => sys_conf_ser2rri_cdinit,
212 RBMON_AWIDTH => 0,
213 RBMON_RBADDR => x"ffe8")
214 port map (
215 CLK => CLK,
216 CE_USEC => CE_USEC,
217 CE_MSEC => CE_MSEC,
218 CE_INT => CE_MSEC,
219 RESET => GBL_RESET,
220 ENAXON => SWI(1),
221 ESCFILL => '0',
222 RXSD => RXD,
223 TXSD => TXD,
224 CTS_N => CTS_N,
225 RTS_N => RTS_N,
226 RB_MREQ => RB_MREQ,
227 RB_SRES => RB_SRES,
228 RB_LAM => RB_LAM,
229 RB_STAT => RB_STAT,
230 RL_MONI => open,
232 );
233
234 TST : entity work.tst_sram
235 generic map (
236 RB_ADDR => slv(to_unsigned(2#0000000000000000#,16)),
237 AWIDTH => 22)
238 port map (
239 CLK => CLK,
240 RESET => GBL_RESET,
241 RB_MREQ => RB_MREQ,
243 RB_STAT => RB_STAT,
245 SWI => SWI,
246 BTN => BTN(3 downto 0),
247 LED => LED,
248 DSP_DAT => DSP_DAT,
250 MEM_REQ => MEM_REQ,
251 MEM_WE => MEM_WE,
258 MEM_BE => MEM_BE,
259 MEM_DI => MEM_DI,
260 MEM_DO => MEM_DO
261 );
262
263 CRAMCTL : nx_cram_memctl_as
264 generic map (
265 READ0DELAY => sys_conf_memctl_read0delay, -- was 2 for 50 MHz
266 READ1DELAY => sys_conf_memctl_read1delay, -- was 2 "
267 WRITEDELAY => sys_conf_memctl_writedelay) -- was 3 "
268 port map (
269 CLK => CLK,
270 RESET => MEM_RESET,
271 REQ => MEM_REQ,
272 WE => MEM_WE,
273 BUSY => MEM_BUSY,
274 ACK_R => MEM_ACK_R,
275 ACK_W => MEM_ACK_W,
276 ACT_R => MEM_ACT_R,
277 ACT_W => MEM_ACT_W,
278 ADDR => MEM_ADDR,
279 BE => MEM_BE,
280 DI => MEM_DI,
281 DO => MEM_DO,
292 );
293
294 O_PPCM_CE_N <= '1'; -- keep parallel PCM memory disabled
295 O_PPCM_RST_N <= '1'; --
296
297 RB_SRES <= RB_SRES_TST; -- can be sres_or later...
298 RB_LAM(0) <= RB_LAM_TST;
299
300 DSP_DP(3) <= not SER_MONI.txok;
301 DSP_DP(2) <= SER_MONI.txact;
302 DSP_DP(1) <= not SER_MONI.rxok;
303 DSP_DP(0) <= SER_MONI.rxact;
304
305end syn;
306
in RESET slbit := '0'
out CE_MSEC slbit
Definition: clkdivce.vhd:39
USECDIV positive := 50
Definition: clkdivce.vhd:33
CDUWIDTH positive := 6
Definition: clkdivce.vhd:32
out CE_USEC slbit
Definition: clkdivce.vhd:37
MSECDIV positive := 1000
Definition: clkdivce.vhd:34
in CLK slbit
Definition: clkdivce.vhd:36
READ0DELAY positive := 4
WRITEDELAY positive := 4
inout IO_MEM_DATA slv16
READ1DELAY positive := 2
Definition: rblib.vhd:32
VCO_DIVIDE positive := 1
GEN_TYPE string := "PLL"
CLKIN_PERIOD real := 10.0
OUT_DIVIDE positive := 1
in CLKIN slbit
CLKIN_JITTER real := 0.01
STARTUP_WAIT boolean := false
VCO_MULTIPLY positive := 1
out LOCKED slbit
out CLKFX slbit
std_logic_vector( 22 downto 0) slv23
Definition: slvtypes.vhd:56
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 4 downto 0) slv5
Definition: slvtypes.vhd:37
std_logic_vector( 31 downto 0) slv32
Definition: slvtypes.vhd:59
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic_vector( 21 downto 0) slv22
Definition: slvtypes.vhd:55
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 7 downto 0) slv8
Definition: slvtypes.vhd:40
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
std_logic_vector slv
Definition: slvtypes.vhd:31
in DSP_DP slv(( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:63
out O_LED slv( LWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:66
in DSP_DAT slv( 4*( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:62
out SWI slv( SWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:59
in I_BTN slv( BWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:65
in I_SWI slv( SWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:64
out O_SEG_N slv8
Definition: sn_humanio.vhd:69
out BTN slv( BWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:60
in CLK slbit
Definition: sn_humanio.vhd:56
BWIDTH positive := 4
Definition: sn_humanio.vhd:51
out O_ANO_N slv(( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:67
in LED slv( LWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:61
in RESET slbit := '0'
Definition: sn_humanio.vhd:57
in CE_MSEC slbit
Definition: sn_humanio.vhd:58
slv8 := x"03" sysid_board
slv22 :=( others => '0') MEM_ADDR
slv16 :=( others => '0') DSP_DAT
slv8 :=( others => '0') LED
slv4 :=( others => '0') RB_STAT
slv8 :=( others => '0') SWI
slv32 :=( others => '0') MEM_DI
rb_mreq_type := rb_mreq_init RB_MREQ
serport_moni_type := serport_moni_init SER_MONI
slv32 :=( others => '0') MEM_DO
rb_sres_type := rb_sres_init RB_SRES
slv4 :=( others => '0') DSP_DP
slv8 := x"00" sysid_vers
rb_sres_type := rb_sres_init RB_SRES_TST
slv16 :=( others => '0') RB_LAM
slbit := '0' GBL_RESET
slv4 :=( others => '0') MEM_BE
slv5 :=( others => '0') BTN
slv16 := x"0104" sysid_proj
out O_FUSP_TXD slbit
out O_FUSP_RTS_N slbit
out O_PPCM_CE_N slbit
out O_MEM_WE_N slbit
in I_FUSP_CTS_N slbit
out O_PPCM_RST_N slbit
out O_MEM_CE_N slbit
in I_FUSP_RXD slbit
in I_MEM_WAIT slbit
out O_MEM_OE_N slbit
out O_MEM_CLK slbit
out O_MEM_ADV_N slbit
out O_MEM_ADDR slv23
out O_MEM_BE_N slv2
inout IO_MEM_DATA slv16
out O_MEM_CRE slbit
in MEM_BUSY slbit
Definition: tst_sram.vhd:182
out MEM_DI slv32
Definition: tst_sram.vhd:189
AWIDTH natural := 18
Definition: tst_sram.vhd:167
in RESET slbit
Definition: tst_sram.vhd:170
in MEM_ACK_W slbit
Definition: tst_sram.vhd:184
out MEM_RESET slbit
Definition: tst_sram.vhd:179
out RB_LAM slbit
Definition: tst_sram.vhd:174
in BTN slv4
Definition: tst_sram.vhd:176
out MEM_BE slv4
Definition: tst_sram.vhd:188
out RB_STAT slv4
Definition: tst_sram.vhd:173
in MEM_ACT_W slbit
Definition: tst_sram.vhd:186
in CLK slbit
Definition: tst_sram.vhd:169
RB_ADDR slv16 := slv( to_unsigned( 2#0000000000000000#, 16) )
Definition: tst_sram.vhd:166
out MEM_REQ slbit
Definition: tst_sram.vhd:180
in RB_MREQ rb_mreq_type
Definition: tst_sram.vhd:171
out MEM_ADDR slv( AWIDTH- 1 downto 0)
Definition: tst_sram.vhd:187
in MEM_ACT_R slbit
Definition: tst_sram.vhd:185
in MEM_ACK_R slbit
Definition: tst_sram.vhd:183
out RB_SRES rb_sres_type
Definition: tst_sram.vhd:172
in MEM_DO slv32
Definition: tst_sram.vhd:191
out MEM_WE slbit
Definition: tst_sram.vhd:181
out DSP_DAT slv16
Definition: tst_sram.vhd:178
out LED slv8
Definition: tst_sram.vhd:177
in SWI slv8
Definition: tst_sram.vhd:175
Definition: xlib.vhd:35