w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_tst_rlink_cuff_n2.vhd
Go to the documentation of this file.
1-- $Id: sys_tst_rlink_cuff_n2.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2012-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_tst_rlink_cuff_n2 - syn
7-- Description: rlink tester design for nexys2 with fx2 interface
8--
9-- Dependencies: vlib/xlib/dcm_sfs
10-- vlib/genlib/clkdivce
11-- bplib/bpgen/bp_rs232_2l4l_iob
12-- bplib/bpgen/sn_humanio_rbus
13-- bplib/fx2lib/fx2_2fifoctl_ic [sys_conf_fx2_type="ic2"]
14-- bplib/fx2lib/fx2_3fifoctl_ic [sys_conf_fx2_type="ic3"]
15-- tst_rlink_cuff
16-- bplib/nxcramlib/nx_cram_dummy
17--
18-- Test bench: -
19--
20-- Target Devices: generic
21-- Tool versions: xst 13.3-14.7; ghdl 0.29-0.31
22--
23-- Synthesized (xst):
24-- Date Rev ise Target flop lutl lutm slic t peri ctl/MHz
25-- 2014-12-20 614 14.7 131013 xc3s1200e-4 1023 2160 192 1486 p 16.0 ic2/ 50
26-- 2013-01-04 469 13.3 O76d xc3s1200e-4 846 1798 160 1215 p 16.3 ic2/ 50
27-- 2012-12-29 466 13.3 O76d xc3s1200e-4 808 1739 160 1172 p 16.3 as2/ 50
28-- 2013-01-02 467 13.3 O76d xc3s1200e-4 843 1792 160 1209 p 15.2 ic2/ 50
29-- 2012-12-29 466 13.3 O76d xc3s1200e-4 863 1850 192 1266 p 13.6 ic3/ 50
30--
31-- Revision History:
32-- Date Rev Version Comment
33-- 2015-01-25 638 1.1.2 retire fx2_2fifoctl_as
34-- 2014-12-24 620 1.1.1 relocate hio rbus address
35-- 2014-08-15 583 1.1 rb_mreq addr now 16 bit
36-- 2012-12-29 466 1.0 Initial version; derived from sys_tst_fx2loop_n2
37-- the now obsoleted sys_tst_rlink_n2_cuff design
38------------------------------------------------------------------------------
39-- Usage of Nexys 2 Switches, Buttons, LEDs:
40--
41-- SWI(7:3) no function (only connected to sn_humanio_rbus)
42-- (2) 0 -> int/ext RS242 port for rlink
43-- 1 -> use USB interface for rlink
44-- (1) 1 enable XON
45-- (0) 0 -> main board RS232 port - implemented in bp_rs232_2l4l_iob
46-- 1 -> Pmod B/top RS232 port /
47--
48-- LED(7) SER_MONI.abact
49-- (6:2) no function (only connected to sn_humanio_rbus)
50-- (1) timer 1 busy
51-- (0) timer 0 busy
52--
53-- DSP: SER_MONI.clkdiv (from auto bauder)
54-- for SWI(2)='0' (serport)
55-- DP(3) not SER_MONI.txok (shows tx back pressure)
56-- (2) SER_MONI.txact (shows tx activity)
57-- (1) not SER_MONI.rxok (shows rx back pressure)
58-- (0) SER_MONI.rxact (shows rx activity)
59-- for SWI(2)='1' (fx2)
60-- DP(3) FX2_TX2BUSY (shows tx2 back pressure)
61-- (2) FX2_TX2ENA(stretched) (shows tx2 activity)
62-- (1) FX2_TXENA(streched) (shows tx activity)
63-- (0) FX2_RXVAL(stretched) (shows rx activity)
64--
65
66library ieee;
67use ieee.std_logic_1164.all;
68use ieee.numeric_std.all;
69
70use work.slvtypes.all;
71use work.xlib.all;
72use work.genlib.all;
73use work.bpgenlib.all;
74use work.bpgenrbuslib.all;
75use work.rblib.all;
76use work.fx2lib.all;
77use work.nxcramlib.all;
78use work.sys_conf.all;
79
80-- ----------------------------------------------------------------------------
81
82entity sys_tst_rlink_cuff_n2 is -- top level
83 -- implements nexys2_fusp_cuff_aif
84 port (
85 I_CLK50 : in slbit; -- 50 MHz board clock
86 I_RXD : in slbit; -- receive data (board view)
87 O_TXD : out slbit; -- transmit data (board view)
88 I_SWI : in slv8; -- n2 switches
89 I_BTN : in slv4; -- n2 buttons
90 O_LED : out slv8; -- n2 leds
91 O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low)
92 O_SEG_N : out slv8; -- 7 segment disp: segments (act.low)
93 O_MEM_CE_N : out slbit; -- cram: chip enable (act.low)
94 O_MEM_BE_N : out slv2; -- cram: byte enables (act.low)
95 O_MEM_WE_N : out slbit; -- cram: write enable (act.low)
96 O_MEM_OE_N : out slbit; -- cram: output enable (act.low)
97 O_MEM_ADV_N : out slbit; -- cram: address valid (act.low)
98 O_MEM_CLK : out slbit; -- cram: clock
99 O_MEM_CRE : out slbit; -- cram: command register enable
100 I_MEM_WAIT : in slbit; -- cram: mem wait
101 O_MEM_ADDR : out slv23; -- cram: address lines
102 IO_MEM_DATA : inout slv16; -- cram: data lines
103 O_FLA_CE_N : out slbit; -- flash ce.. (act.low)
104 O_FUSP_RTS_N : out slbit; -- fusp: rs232 rts_n
105 I_FUSP_CTS_N : in slbit; -- fusp: rs232 cts_n
106 I_FUSP_RXD : in slbit; -- fusp: rs232 rx
107 O_FUSP_TXD : out slbit; -- fusp: rs232 tx
108 I_FX2_IFCLK : in slbit; -- fx2: interface clock
109 O_FX2_FIFO : out slv2; -- fx2: fifo address
110 I_FX2_FLAG : in slv4; -- fx2: fifo flags
111 O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low)
112 O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low)
113 O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low)
114 O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low)
115 IO_FX2_DATA : inout slv8 -- fx2: data lines
116 );
118
119architecture syn of sys_tst_rlink_cuff_n2 is
120
121 signal CLK : slbit := '0';
122 signal RESET : slbit := '0';
123
124 signal CE_USEC : slbit := '0';
125 signal CE_MSEC : slbit := '0';
126
127 signal RXSD : slbit := '0';
128 signal TXSD : slbit := '0';
129 signal CTS_N : slbit := '0';
130 signal RTS_N : slbit := '0';
131
132 signal SWI : slv8 := (others=>'0');
133 signal BTN : slv4 := (others=>'0');
134 signal LED : slv8 := (others=>'0');
135 signal DSP_DAT : slv16 := (others=>'0');
136 signal DSP_DP : slv4 := (others=>'0');
137
138 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
139 signal RB_SRES_HIO : rb_sres_type := rb_sres_init;
140
141 signal FX2_RXDATA : slv8 := (others=>'0');
142 signal FX2_RXVAL : slbit := '0';
143 signal FX2_RXHOLD : slbit := '0';
144 signal FX2_RXAEMPTY : slbit := '0';
145 signal FX2_TXDATA : slv8 := (others=>'0');
146 signal FX2_TXENA : slbit := '0';
147 signal FX2_TXBUSY : slbit := '0';
148 signal FX2_TXAFULL : slbit := '0';
149 signal FX2_TX2DATA : slv8 := (others=>'0');
150 signal FX2_TX2ENA : slbit := '0';
151 signal FX2_TX2BUSY : slbit := '0';
152 signal FX2_TX2AFULL : slbit := '0';
153 signal FX2_MONI : fx2ctl_moni_type := fx2ctl_moni_init;
154
155 constant rbaddr_hio : slv16 := x"fef0"; -- fef0/0008: 1111 1110 1111 0xxx
156
157begin
158
159 assert (sys_conf_clksys mod 1000000) = 0
160 report "assert sys_conf_clksys on MHz grid"
161 severity failure;
162
163 DCM : dcm_sfs
164 generic map (
165 CLKFX_DIVIDE => sys_conf_clkfx_divide,
166 CLKFX_MULTIPLY => sys_conf_clkfx_multiply,
167 CLKIN_PERIOD => 20.0)
168 port map (
169 CLKIN => I_CLK50,
170 CLKFX => CLK,
171 LOCKED => open
172 );
173
174 CLKDIV : clkdivce
175 generic map (
176 CDUWIDTH => 7, -- good for up to 127 MHz !
177 USECDIV => sys_conf_clksys_mhz,
178 MSECDIV => 1000)
179 port map (
180 CLK => CLK,
181 CE_USEC => CE_USEC,
183 );
184
185 IOB_RS232 : bp_rs232_2l4l_iob
186 port map (
187 CLK => CLK,
188 RESET => '0',
189 SEL => SWI(0),
190 RXD => RXSD,
191 TXD => TXSD,
192 CTS_N => CTS_N,
193 RTS_N => RTS_N,
194 I_RXD0 => I_RXD,
195 O_TXD0 => O_TXD,
200 );
201
202 HIO : sn_humanio_rbus
203 generic map (
204 DEBOUNCE => sys_conf_hio_debounce,
206 port map (
207 CLK => CLK,
208 RESET => RESET,
209 CE_MSEC => CE_MSEC,
210 RB_MREQ => RB_MREQ,
212 SWI => SWI,
213 BTN => BTN,
214 LED => LED,
215 DSP_DAT => DSP_DAT,
216 DSP_DP => DSP_DP,
217 I_SWI => I_SWI,
218 I_BTN => I_BTN,
219 O_LED => O_LED,
220 O_ANO_N => O_ANO_N,
222 );
223
224 FX2_CNTL_IC : if sys_conf_fx2_type = "ic2" generate
225 CNTL : fx2_2fifoctl_ic
226 generic map (
227 RXFAWIDTH => 5,
228 TXFAWIDTH => 5,
229 PETOWIDTH => sys_conf_fx2_petowidth,
230 CCWIDTH => sys_conf_fx2_ccwidth,
231 RXAEMPTY_THRES => 1,
232 TXAFULL_THRES => 1)
233 port map (
234 CLK => CLK,
235 RESET => RESET,
237 RXVAL => FX2_RXVAL,
241 TXENA => FX2_TXENA,
244 MONI => FX2_MONI,
253 );
254 end generate FX2_CNTL_IC;
255
256 FX2_CNTL_IC3 : if sys_conf_fx2_type = "ic3" generate
257 CNTL : fx2_3fifoctl_ic
258 generic map (
259 RXFAWIDTH => 5,
260 TXFAWIDTH => 5,
261 PETOWIDTH => sys_conf_fx2_petowidth,
262 CCWIDTH => sys_conf_fx2_ccwidth,
263 RXAEMPTY_THRES => 1,
264 TXAFULL_THRES => 1,
265 TX2AFULL_THRES => 1)
266 port map (
267 CLK => CLK,
268 RESET => RESET,
270 RXVAL => FX2_RXVAL,
274 TXENA => FX2_TXENA,
281 MONI => FX2_MONI,
290 );
291 end generate FX2_CNTL_IC3;
292
293 TST : entity work.tst_rlink_cuff
294 port map (
295 CLK => CLK,
296 RESET => '0',
297 CE_USEC => CE_USEC,
298 CE_MSEC => CE_MSEC,
301 SWI => SWI,
302 BTN => BTN,
303 LED => LED,
304 DSP_DAT => DSP_DAT,
305 DSP_DP => DSP_DP,
306 RXSD => RXSD,
307 TXSD => TXSD,
308 RTS_N => RTS_N,
309 CTS_N => CTS_N,
320 );
321
322 SRAM_PROT : nx_cram_dummy -- connect CRAM to protection dummy
323 port map (
324 O_MEM_CE_N => O_MEM_CE_N,
325 O_MEM_BE_N => O_MEM_BE_N,
326 O_MEM_WE_N => O_MEM_WE_N,
327 O_MEM_OE_N => O_MEM_OE_N,
328 O_MEM_ADV_N => O_MEM_ADV_N,
329 O_MEM_CLK => O_MEM_CLK,
330 O_MEM_CRE => O_MEM_CRE,
331 I_MEM_WAIT => I_MEM_WAIT,
332 O_MEM_ADDR => O_MEM_ADDR,
333 IO_MEM_DATA => IO_MEM_DATA
334 );
335
336 O_FLA_CE_N <= '1'; -- keep Flash memory disabled
337
338end syn;
339
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
CLKFX_DIVIDE positive := 1
in CLKIN slbit
CLKFX_MULTIPLY positive := 1
out LOCKED slbit
CLKIN_PERIOD real := 20.0
out CLKFX slbit
inout IO_FX2_DATA slv8
in I_FX2_IFCLK slbit
out O_FX2_PKTEND_N slbit
out TXAFULL slbit
RXAEMPTY_THRES natural := 1
CCWIDTH positive := 5
out O_FX2_SLWR_N slbit
out O_FX2_FIFO slv2
PETOWIDTH positive := 7
TXFAWIDTH positive := 5
RXFAWIDTH positive := 5
out MONI fx2ctl_moni_type
out RXAEMPTY slbit
in RESET slbit := '0'
TXAFULL_THRES natural := 1
out O_FX2_SLRD_N slbit
out O_FX2_SLOE_N slbit
inout IO_FX2_DATA slv8
TX2AFULL_THRES natural := 1
in I_FX2_IFCLK slbit
out TX2AFULL slbit
out O_FX2_PKTEND_N slbit
out TXAFULL slbit
out TX2BUSY slbit
RXAEMPTY_THRES natural := 1
CCWIDTH positive := 5
out O_FX2_SLWR_N slbit
out O_FX2_FIFO slv2
PETOWIDTH positive := 7
TXFAWIDTH positive := 5
RXFAWIDTH positive := 5
out MONI fx2ctl_moni_type
out RXAEMPTY slbit
in RESET slbit := '0'
TXAFULL_THRES natural := 1
out O_FX2_SLRD_N slbit
out O_FX2_SLOE_N slbit
Definition: rblib.vhd:32
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( 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
in DSP_DP slv(( 2** DCWIDTH)- 1 downto 0)
DEBOUNCE boolean := true
out O_LED slv( LWIDTH- 1 downto 0)
RB_ADDR slv16 := x"fef0"
in DSP_DAT slv( 4*( 2** DCWIDTH)- 1 downto 0)
out SWI slv( SWIDTH- 1 downto 0)
in I_BTN slv( BWIDTH- 1 downto 0)
in I_SWI slv( SWIDTH- 1 downto 0)
out BTN slv( BWIDTH- 1 downto 0)
in RB_MREQ rb_mreq_type
out O_ANO_N slv(( 2** DCWIDTH)- 1 downto 0)
out RB_SRES rb_sres_type
in LED slv( LWIDTH- 1 downto 0)
in RESET slbit := '0'
Definition: xlib.vhd:35