w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_tst_sram_c7.vhd
Go to the documentation of this file.
1-- $Id: sys_tst_sram_c7.vhd 1247 2022-07-06 07:04:33Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2017-2022 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_tst_sram_c7 - syn
7-- Description: test of cmoda7 sram and its controller
8--
9-- Dependencies: bplib/bpgen/s7_cmt_1ce1ce
10-- bplib/bpgen/bp_rs232_2line_iob
11-- vlib/rlink/rlink_sp2c
12-- tst_sram
13-- bplib/cmoda7/c7_cram_memctl
14-- bplib/bpgen/sn_humanio_eum_rbus
15-- bplib/sysmon/sysmonx_rbus_base
16-- vlib/rbus/rbd_usracc
17-- vlib/rbus/rb_sres_or_4
18--
19-- Test bench: tb/tb_tst_sram_c7
20--
21-- Target Devices: generic
22-- Tool versions: viv 2017.1-2022.1; ghdl 0.34-2.0.0
23--
24-- Synthesized (viv):
25-- Date Rev viv Target flop lutl lutm bram slic
26-- 2022-07-05 1247 2022.1 xc7a35t-1 1045 1355 18 5.0 469
27-- 2019-02-02 1108 2018.3 xc7a35t-1 1045 1537 24 5.0 490
28-- 2019-02-02 1108 2017.2 xc7a35t-1 1042 1541 24 5.0 494
29--
30-- Revision History:
31-- Date Rev Version Comment
32-- 2018-12-16 1086 1.1 use s7_cmt_1ce1ce
33-- 2017-06-11 914 1.0 Initial version
34-- 2017-06-11 912 0.5 First draft (derived from sys_tst_sram_n4)
35------------------------------------------------------------------------------
36
37library ieee;
38use ieee.std_logic_1164.all;
39use ieee.numeric_std.all;
40
41use work.slvtypes.all;
42use work.xlib.all;
43use work.serportlib.all;
44use work.rblib.all;
45use work.rbdlib.all;
46use work.rlinklib.all;
47use work.bpgenlib.all;
48use work.bpgenrbuslib.all;
49use work.sysmonrbuslib.all;
50use work.cmoda7lib.all;
51use work.sys_conf.all;
52
53-- ----------------------------------------------------------------------------
54
55entity sys_tst_sram_c7 is -- top level
56 -- implements cmoda7_sram_aif
57 port (
58 I_CLK12 : in slbit; -- 12 MHz clock
59 I_RXD : in slbit; -- receive data (board view)
60 O_TXD : out slbit; -- transmit data (board view)
61 I_BTN : in slv2; -- c7 buttons
62 O_LED : out slv2; -- c7 leds
63 O_RGBLED0_N : out slv3; -- c7 rgb-led 0
64 O_MEM_CE_N : out slbit; -- sram: chip enable (act.low)
65 O_MEM_WE_N : out slbit; -- sram: write enable (act.low)
66 O_MEM_OE_N : out slbit; -- sram: output enable (act.low)
67 O_MEM_ADDR : out slv19; -- sram: address lines
68 IO_MEM_DATA : inout slv8 -- sram: data lines
69 );
71
72architecture syn of sys_tst_sram_c7 is
73
74 signal CLK : slbit := '0';
75
76 signal CE_USEC : slbit := '0';
77 signal CE_MSEC : slbit := '0';
78
79 signal CLKS : slbit := '0';
80 signal CES_MSEC : slbit := '0';
81
82 signal GBL_RESET : slbit := '0';
83
84 signal RXD : slbit := '1';
85 signal TXD : slbit := '0';
86 signal CTS_N : slbit := '0';
87 signal RTS_N : slbit := '0';
88
89 signal SWI : slv16 := (others=>'0');
90 signal BTN : slv5 := (others=>'0');
91 signal LED : slv16 := (others=>'0');
92 signal DSP_DAT : slv32 := (others=>'0');
93 signal DSP_DP : slv8 := (others=>'0');
94
95 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
96 signal RB_SRES : rb_sres_type := rb_sres_init;
97 signal RB_LAM : slv16 := (others=>'0');
98 signal RB_STAT : slv4 := (others=>'0');
99
100 signal SER_MONI : serport_moni_type := serport_moni_init;
101
102 signal RB_SRES_TST : rb_sres_type := rb_sres_init;
103 signal RB_SRES_HIO : rb_sres_type := rb_sres_init;
104 signal RB_SRES_SYSMON : rb_sres_type := rb_sres_init;
105 signal RB_SRES_USRACC : rb_sres_type := rb_sres_init;
106
107 signal RB_LAM_TST : slbit := '0';
108
109 signal MEM_RESET : slbit := '0';
110 signal MEM_REQ : slbit := '0';
111 signal MEM_WE : slbit := '0';
112 signal MEM_BUSY : slbit := '0';
113 signal MEM_ACK_R : slbit := '0';
114 signal MEM_ACK_W : slbit := '0';
115 signal MEM_ACT_R : slbit := '0';
116 signal MEM_ACT_W : slbit := '0';
117 signal MEM_ADDR : slv17 := (others=>'0');
118 signal MEM_BE : slv4 := (others=>'0');
119 signal MEM_DI : slv32 := (others=>'0');
120 signal MEM_DO : slv32 := (others=>'0');
121
122 constant rbaddr_sysmon: slv16 := x"fb00"; -- fb00/0080: 1111 1011 0xxx xxxx
123
124 constant sysid_proj : slv16 := x"0104"; -- tst_sram
125 constant sysid_board : slv8 := x"09"; -- cmoda7
126 constant sysid_vers : slv8 := x"00";
127
128begin
129
130 GEN_CLKALL : s7_cmt_1ce1ce -- clock generator system ------------
131 generic map (
132 CLKIN_PERIOD => 83.3,
133 CLKIN_JITTER => 0.01,
134 STARTUP_WAIT => false,
135 CLK0_VCODIV => sys_conf_clksys_vcodivide,
136 CLK0_VCOMUL => sys_conf_clksys_vcomultiply,
137 CLK0_OUTDIV => sys_conf_clksys_outdivide,
138 CLK0_GENTYPE => sys_conf_clksys_gentype,
139 CLK0_CDUWIDTH => 7,
140 CLK0_USECDIV => sys_conf_clksys_mhz,
141 CLK0_MSECDIV => 1000,
142 CLK1_VCODIV => sys_conf_clkser_vcodivide,
143 CLK1_VCOMUL => sys_conf_clkser_vcomultiply,
144 CLK1_OUTDIV => sys_conf_clkser_outdivide,
145 CLK1_GENTYPE => sys_conf_clkser_gentype,
146 CLK1_CDUWIDTH => 7,
147 CLK1_USECDIV => sys_conf_clkser_mhz,
148 CLK1_MSECDIV => 1000)
149 port map (
150 CLKIN => I_CLK12,
151 CLK0 => CLK,
152 CE0_USEC => CE_USEC,
153 CE0_MSEC => CE_MSEC,
154 CLK1 => CLKS,
155 CE1_USEC => open,
156 CE1_MSEC => CES_MSEC,
157 LOCKED => open
158 );
159
160 IOB_RS232 : bp_rs232_2line_iob
161 port map (
162 CLK => CLKS,
163 RXD => RXD,
164 TXD => TXD,
165 I_RXD => I_RXD,
166 O_TXD => O_TXD
167 );
168
169 RLINK : rlink_sp2c
170 generic map (
171 BTOWIDTH => 6, -- 64 cycles access timeout
172 RTAWIDTH => 12,
173 SYSID => sysid_proj & sysid_board & sysid_vers ,
174 IFAWIDTH => 5, -- 32 word input fifo
175 OFAWIDTH => 5, -- 32 word output fifo
176 ENAPIN_RLMON => sbcntl_sbf_rlmon,
177 ENAPIN_RBMON => sbcntl_sbf_rbmon,
178 CDWIDTH => 12,
179 CDINIT => sys_conf_ser2rri_cdinit,
180 RBMON_AWIDTH => 0,
181 RBMON_RBADDR => x"ffe8")
182 port map (
183 CLK => CLK,
184 CE_USEC => CE_USEC,
185 CE_MSEC => CE_MSEC,
186 CE_INT => CE_MSEC,
187 RESET => GBL_RESET,
188 CLKS => CLKS,
190 ENAXON => '1',
191 ESCFILL => '0',
192 RXSD => RXD,
193 TXSD => TXD,
194 CTS_N => CTS_N,
195 RTS_N => RTS_N,
196 RB_MREQ => RB_MREQ,
197 RB_SRES => RB_SRES,
198 RB_LAM => RB_LAM,
199 RB_STAT => RB_STAT,
200 RL_MONI => open,
202 );
203
204 TST : entity work.tst_sram
205 generic map (
206 RB_ADDR => slv(to_unsigned(2#0000000000000000#,16)),
207 AWIDTH => 17)
208 port map (
209 CLK => CLK,
210 RESET => GBL_RESET,
211 RB_MREQ => RB_MREQ,
213 RB_STAT => RB_STAT,
215 SWI => SWI(7 downto 0),
216 BTN => BTN(3 downto 0),
217 LED => LED(7 downto 0),
218 DSP_DAT => DSP_DAT(15 downto 0),
220 MEM_REQ => MEM_REQ,
221 MEM_WE => MEM_WE,
228 MEM_BE => MEM_BE,
229 MEM_DI => MEM_DI,
230 MEM_DO => MEM_DO
231 );
232
233 SRAMCTL : c7_sram_memctl
234 port map (
235 CLK => CLK,
236 RESET => MEM_RESET,
237 REQ => MEM_REQ,
238 WE => MEM_WE,
239 BUSY => MEM_BUSY,
240 ACK_R => MEM_ACK_R,
241 ACK_W => MEM_ACK_W,
242 ACT_R => MEM_ACT_R,
243 ACT_W => MEM_ACT_W,
244 ADDR => MEM_ADDR,
245 BE => MEM_BE,
246 DI => MEM_DI,
247 DO => MEM_DO,
253 );
254
256 generic map (
257 SWIDTH => 16,
258 BWIDTH => 5,
259 LWIDTH => 16,
260 DCWIDTH => 3)
261 port map (
262 CLK => CLK,
263 RESET => '0',
264 RB_MREQ => RB_MREQ,
266 SWI => SWI,
267 BTN => BTN,
268 LED => LED,
269 DSP_DAT => DSP_DAT,
270 DSP_DP => DSP_DP
271 );
272
273 SMRB : sysmonx_rbus_base
274 generic map ( -- use default INIT_ (Vccint=1.00)
275 CLK_MHZ => sys_conf_clksys_mhz,
277 port map (
278 CLK => CLK,
279 RESET => GBL_RESET,
280 RB_MREQ => RB_MREQ,
282 ALM => open,
283 OT => open,
284 TEMP => open
285 );
286
287 UARB : rbd_usracc
288 port map (
289 CLK => CLK,
290 RB_MREQ => RB_MREQ,
292 );
293
294 RB_SRES_OR : rb_sres_or_4 -- rbus or ---------------------------
295 port map (
296 RB_SRES_1 => RB_SRES_TST,
297 RB_SRES_2 => RB_SRES_HIO,
298 RB_SRES_3 => RB_SRES_SYSMON,
299 RB_SRES_4 => RB_SRES_USRACC,
300 RB_SRES_OR => RB_SRES
301 );
302
303 RB_LAM(0) <= RB_LAM_TST;
304
305 O_LED(1) <= SER_MONI.txact;
306 O_LED(0) <= SER_MONI.rxact;
307
308 DSP_DP(3) <= not SER_MONI.txok;
309 DSP_DP(2) <= SER_MONI.txact;
310 DSP_DP(1) <= not SER_MONI.rxok;
311 DSP_DP(0) <= SER_MONI.rxact;
312
313 DSP_DP(7 downto 4) <= "0010";
314 DSP_DAT(31 downto 16) <= SER_MONI.abclkdiv(11 downto 0) &
315 '0' & SER_MONI.abclkdiv_f;
316
317 -- setup unused outputs in cmoda7
318 O_RGBLED0_N <= (others=>'1');
319
320end syn;
321
out ACT_W slbit
out O_MEM_WE_N slbit
inout IO_MEM_DATA slv8
out ACK_R slbit
out BUSY slbit
out O_MEM_CE_N slbit
out ACT_R slbit
out ACK_W slbit
out O_MEM_OE_N slbit
out O_MEM_ADDR slv19
in CLK slbit
Definition: rbd_usracc.vhd:40
in RB_MREQ rb_mreq_type
Definition: rbd_usracc.vhd:41
out RB_SRES rb_sres_type
Definition: rbd_usracc.vhd:43
Definition: rblib.vhd:32
std_logic_vector( 18 downto 0) slv19
Definition: slvtypes.vhd:52
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( 2 downto 0) slv3
Definition: slvtypes.vhd:35
std_logic_vector( 16 downto 0) slv17
Definition: slvtypes.vhd:50
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)
in DSP_DAT slv( 4*( 2** DCWIDTH)- 1 downto 0)
out SWI slv( SWIDTH- 1 downto 0)
out BTN slv( BWIDTH- 1 downto 0)
in RB_MREQ rb_mreq_type
out RB_SRES rb_sres_type
in LED slv( LWIDTH- 1 downto 0)
slv32 :=( others => '0') DSP_DAT
slv8 := x"09" sysid_board
slv16 :=( others => '0') SWI
slv4 :=( others => '0') RB_STAT
slv32 :=( others => '0') MEM_DI
rb_sres_type := rb_sres_init RB_SRES_SYSMON
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
slv16 :=( others => '0') LED
slv8 := x"00" sysid_vers
rb_sres_type := rb_sres_init RB_SRES_TST
slv8 :=( others => '0') DSP_DP
slv16 := x"fb00" rbaddr_sysmon
rb_sres_type := rb_sres_init RB_SRES_USRACC
slv16 :=( others => '0') RB_LAM
slbit := '0' GBL_RESET
rb_sres_type := rb_sres_init RB_SRES_HIO
slv4 :=( others => '0') MEM_BE
slv5 :=( others => '0') BTN
slv16 := x"0104" sysid_proj
slv17 :=( others => '0') MEM_ADDR
out O_RGBLED0_N slv3
out O_MEM_WE_N slbit
inout IO_MEM_DATA slv8
out O_MEM_CE_N slbit
out O_MEM_OE_N slbit
out O_MEM_ADDR slv19
CLK_MHZ integer := 250
RB_ADDR slv16 := x"fb00"
in RB_MREQ rb_mreq_type
out RB_SRES rb_sres_type
in RESET slbit := '0'
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