w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_tst_sram_s3.vhd
Go to the documentation of this file.
1-- $Id: sys_tst_sram_s3.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2007-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_tst_sram_s3 - syn
7-- Description: test of s3board sram and its controller
8--
9-- Dependencies: vlib/genlib/clkdivce
10-- bplib/bpgen/bp_rs232_2line_iob
11-- bplib/bpgen/sn_humanio
12-- vlib/rlink/rlink_sp1c
13-- tst_sram
14-- bplib/s3board/s3_sram_memctl
15--
16-- Test bench: tb/tb_tst_sram_s3
17--
18-- Target Devices: generic
19-- Tool versions: xst 8.2-14.7; ghdl 0.18-0.33
20--
21-- Synthesized (xst):
22-- Date Rev ise Target flop lutl lutm slic t peri
23-- 2014-12-20 614 14.7 131013 xc3s1000-4 816 1801 96 1135 t 18.3 ns
24-- 2014-08-13 581 14.7 131013 xc3s1000-4 664 1433 64 899 t 16.3 ns
25-- 2011-12-21 352 12.1 M53d xc3s1000-4 664 1433 64 898 p 17.1 ns
26-- 2010-12-31 352 12.1 M53d xc3s200-4 644 1366 36 856 p 14.6 ns
27-- 2010-11-06 336 12.1 M53d xc3s200-4 605 1334 36 824 p 14.6 ns
28-- 2010-05-21 291 11.4 L68 xc3s200-4 600 1301 18 795 p 16.6 ns
29-- 2010-05-16 291 11.4 L68 xc3s200-4 594 1273 18 764 p 15.3 ns
30-- 2010-04-04 274 11.4 L68 xc3s200-4 607 1303 18 807 p 14.2 ns
31-- 2009-11-14 249 11.2 L46 xc3s1000-4 603 1340 18 795 p 18.8 ns
32-- 2009-11-08 248 11.2 L46 xc3s1000-4 594 1329 18 771 p 15.4 ns
33-- 2009-11-08 248 8.2.3 I34 xc3s1000-4 616 1320 18 805 p 16.3 ns
34--
35-- Revision History:
36-- Date Rev Version Comment
37-- 2016-07-10 785 2.3.4 SWI(1) now XON
38-- 2016-07-09 784 2.3.3 tst_sram with AWIDTH and 22bit support
39-- 2016-03-19 748 2.3.2 define rlink SYSID
40-- 2015-04-11 666 2.3.1 rearrange XON handling
41-- 2014-08-28 588 2.3 use new rlink v4 iface and 4 bit STAT
42-- 2014-08-15 583 2.2 rb_mreq addr now 16 bit
43-- 2011-12-21 442 2.1.4 use rlink_sp1c
44-- 2011-11-21 432 2.1.3 now numeric_std clean
45-- 2011-07-08 390 2.1.2 use now sn_humanio
46-- 2011-07-02 387 2.1.1 use bp_rs232_2line_iob now
47-- 2010-12-31 352 2.1 port to rbv3
48-- 2010-11-06 336 2.0.5 rename input pin CLK -> I_CLK50
49-- 2010-10-23 335 2.0.4 rename RRI_LAM->RB_LAM;
50-- 2010-06-03 300 2.0.3 use default FAWIDTH for rri_core_serport
51-- 2010-05-32 294 2.0.2 rename sys_tst_sram -> sys_tst_sram_s3
52-- 2010-05-21 292 2.0.1 move memory controller to top level entity
53-- 2010-05-16 291 2.0 move tester code to tst_sram; use s3_rs232_iob_int
54-- 2010-05-02 287 1.1.6 ren CE_XSEC->CE_INT,RP_STAT->RB_STAT,AP_LAM->RB_LAM
55-- drop RP_IINT from interfaces; drop RTSFLUSH generic
56-- 2010-05-01 286 1.1.5 set RTSFLUSH=>false till tested; rri_a_ -> rbaddr_
57-- 2010-04-24 281 1.1.4 mv from vlib/s3board/sys/sys_s3board_memtest.vhd
58-- 2010-04-18 279 1.1.3 drop RTSFBUF generic for rri_serport
59-- 2010-04-10 275 1.1.2 use s3_humanio, rri_core_serport;
60-- 2010-04-04 274 1.1.1 add CE_USEC, CP_FLUSH, CTS_N, RTS_N signals
61-- 2009-11-14 249 1.1 ported to rri V2 rb_mreq/rb_sres interface; cleaner
62-- rbus logic, should work with 2nd rbus device
63-- 2008-02-17 117 1.0.5 use req,we rather req_r,req_w interface
64-- 2008-01-20 113 1.0.4 rename memdrv->memctl_s3sram
65-- 2008-01-20 112 1.0.3 rename clkgen->clkdivce
66-- 2007-12-24 105 1.0.2 now fully implemented
67-- 2007-12-22 104 1.0.1 finish mblk, add smem and sblk.
68-- 2007-12-20 103 1.0 Initial version
69------------------------------------------------------------------------------
70
71library ieee;
72use ieee.std_logic_1164.all;
73use ieee.numeric_std.all;
74
75use work.slvtypes.all;
76use work.genlib.all;
77use work.serportlib.all;
78use work.rblib.all;
79use work.rlinklib.all;
80use work.bpgenlib.all;
81use work.s3boardlib.all;
82use work.sys_conf.all;
83
84-- ----------------------------------------------------------------------------
85
86entity sys_tst_sram_s3 is -- top level
87 -- implements s3board_aif
88 port (
89 I_CLK50 : in slbit; -- 50 MHz board clock
90 I_RXD : in slbit; -- receive data (board view)
91 O_TXD : out slbit; -- transmit data (board view)
92 I_SWI : in slv8; -- s3 switches
93 I_BTN : in slv4; -- s3 buttons
94 O_LED : out slv8; -- s3 leds
95 O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low)
96 O_SEG_N : out slv8; -- 7 segment disp: segments (act.low)
97 O_MEM_CE_N : out slv2; -- sram: chip enables (act.low)
98 O_MEM_BE_N : out slv4; -- sram: byte enables (act.low)
99 O_MEM_WE_N : out slbit; -- sram: write enable (act.low)
100 O_MEM_OE_N : out slbit; -- sram: output enable (act.low)
101 O_MEM_ADDR : out slv18; -- sram: address lines
102 IO_MEM_DATA : inout slv32 -- sram: data lines
103 );
105
106architecture syn of sys_tst_sram_s3 is
107
108 signal CLK : slbit := '0';
109
110 signal CE_USEC : slbit := '0';
111 signal CE_MSEC : slbit := '0';
112
113 signal GBL_RESET : slbit := '0';
114
115 signal RXD : slbit := '1';
116 signal TXD : slbit := '0';
117 signal CTS_N : slbit := '0';
118 signal RTS_N : slbit := '0';
119
120 signal SWI : slv8 := (others=>'0');
121 signal BTN : slv4 := (others=>'0');
122 signal LED : slv8 := (others=>'0');
123 signal DSP_DAT : slv16 := (others=>'0');
124 signal DSP_DP : slv4 := (others=>'0');
125
126 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
127 signal RB_SRES : rb_sres_type := rb_sres_init;
128 signal RB_LAM : slv16 := (others=>'0');
129 signal RB_STAT : slv4 := (others=>'0');
130
131 signal SER_MONI : serport_moni_type := serport_moni_init;
132
133 signal RB_SRES_TST : rb_sres_type := rb_sres_init;
134 signal RB_LAM_TST : slbit := '0';
135
136 signal MEM_RESET : slbit := '0';
137 signal MEM_REQ : slbit := '0';
138 signal MEM_WE : slbit := '0';
139 signal MEM_BUSY : slbit := '0';
140 signal MEM_ACK_R : slbit := '0';
141 signal MEM_ACK_W : slbit := '0';
142 signal MEM_ACT_R : slbit := '0';
143 signal MEM_ACT_W : slbit := '0';
144 signal MEM_ADDR : slv18 := (others=>'0');
145 signal MEM_BE : slv4 := (others=>'0');
146 signal MEM_DI : slv32 := (others=>'0');
147 signal MEM_DO : slv32 := (others=>'0');
148
149 constant sysid_proj : slv16 := x"0104"; -- tst_sram
150 constant sysid_board : slv8 := x"01"; -- s3board
151 constant sysid_vers : slv8 := x"00";
152
153begin
154
155 CLK <= I_CLK50; -- use 50MHz as system clock
156
157 CLKDIV : clkdivce
158 generic map (
159 CDUWIDTH => 6,
160 USECDIV => 50,
161 MSECDIV => 1000)
162 port map (
163 CLK => CLK,
164 CE_USEC => CE_USEC,
166 );
167
168 IOB_RS232 : bp_rs232_2line_iob
169 port map (
170 CLK => CLK,
171 RXD => RXD,
172 TXD => TXD,
173 I_RXD => I_RXD,
174 O_TXD => O_TXD
175 );
176
177 HIO : sn_humanio
178 port map (
179 CLK => CLK,
180 RESET => '0',
181 CE_MSEC => CE_MSEC,
182 SWI => SWI,
183 BTN => BTN,
184 LED => LED,
185 DSP_DAT => DSP_DAT,
186 DSP_DP => DSP_DP,
187 I_SWI => I_SWI,
188 I_BTN => I_BTN,
189 O_LED => O_LED,
190 O_ANO_N => O_ANO_N,
192 );
193
194 RLINK : rlink_sp1c
195 generic map (
196 BTOWIDTH => 6, -- 64 cycles access timeout
197 RTAWIDTH => 12,
198 SYSID => (others=>'0'),
199 IFAWIDTH => 5, -- 32 word input fifo
200 OFAWIDTH => 5, -- 32 word output fifo
201 ENAPIN_RLMON => sbcntl_sbf_rlmon,
202 ENAPIN_RBMON => sbcntl_sbf_rbmon,
203 CDWIDTH => 13,
204 CDINIT => sys_conf_ser2rri_cdinit,
205 RBMON_AWIDTH => 0,
206 RBMON_RBADDR => x"ffe8")
207 port map (
208 CLK => CLK,
209 CE_USEC => CE_USEC,
210 CE_MSEC => CE_MSEC,
211 CE_INT => CE_MSEC,
212 RESET => GBL_RESET,
213 ENAXON => SWI(1),
214 ESCFILL => '0',
215 RXSD => RXD,
216 TXSD => TXD,
217 CTS_N => CTS_N,
218 RTS_N => RTS_N,
219 RB_MREQ => RB_MREQ,
220 RB_SRES => RB_SRES,
221 RB_LAM => RB_LAM,
222 RB_STAT => RB_STAT,
223 RL_MONI => open,
225 );
226
227 TST : entity work.tst_sram
228 generic map (
229 RB_ADDR => slv(to_unsigned(2#0000000000000000#,16)),
230 AWIDTH => 18)
231 port map (
232 CLK => CLK,
233 RESET => GBL_RESET,
234 RB_MREQ => RB_MREQ,
236 RB_STAT => RB_STAT,
238 SWI => SWI,
239 BTN => BTN,
240 LED => LED,
241 DSP_DAT => DSP_DAT,
243 MEM_REQ => MEM_REQ,
244 MEM_WE => MEM_WE,
251 MEM_BE => MEM_BE,
252 MEM_DI => MEM_DI,
253 MEM_DO => MEM_DO
254 );
255
256 SRAMCTL : s3_sram_memctl
257 port map (
258 CLK => CLK,
259 RESET => MEM_RESET,
260 REQ => MEM_REQ,
261 WE => MEM_WE,
262 BUSY => MEM_BUSY,
263 ACK_R => MEM_ACK_R,
264 ACK_W => MEM_ACK_W,
265 ACT_R => MEM_ACT_R,
266 ACT_W => MEM_ACT_W,
267 ADDR => MEM_ADDR,
268 BE => MEM_BE,
269 DI => MEM_DI,
270 DO => MEM_DO,
277 );
278
279 RB_SRES <= RB_SRES_TST; -- can be sres_or later...
280 RB_LAM(0) <= RB_LAM_TST;
281
282 DSP_DP(3) <= not SER_MONI.txok;
283 DSP_DP(2) <= SER_MONI.txact;
284 DSP_DP(1) <= not SER_MONI.rxok;
285 DSP_DP(0) <= SER_MONI.rxact;
286
287end syn;
288
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
Definition: rblib.vhd:32
inout IO_MEM_DATA slv32
out O_MEM_CE_N slv2
out ACT_W slbit
out O_MEM_WE_N slbit
out ACK_R slbit
out BUSY slbit
out O_MEM_ADDR slv18
out ACT_R slbit
out O_MEM_BE_N slv4
out ACK_W slbit
out O_MEM_OE_N slbit
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 17 downto 0) slv18
Definition: slvtypes.vhd:51
std_logic_vector( 31 downto 0) slv32
Definition: slvtypes.vhd:59
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
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
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
slv16 :=( others => '0') DSP_DAT
slv8 :=( others => '0') LED
slv8 := x"01" sysid_board
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
slv18 :=( others => '0') MEM_ADDR
slv4 :=( others => '0') DSP_DP
slv8 := x"00" sysid_vers
rb_sres_type := rb_sres_init RB_SRES_TST
slv4 :=( others => '0') BTN
slv16 :=( others => '0') RB_LAM
slv4 :=( others => '0') MEM_BE
slv16 := x"0104" sysid_proj
inout IO_MEM_DATA slv32
out O_MEM_CE_N slv2
out O_MEM_WE_N slbit
out O_MEM_ADDR slv18
out O_MEM_BE_N slv4
out O_MEM_OE_N 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