w11 - vhd 0.791
W11 CPU core and support modules
sys_tst_rlink_cuff_atlys.vhd
Go to the documentation of this file.
1-- $Id: sys_tst_rlink_cuff_atlys.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_tst_rlink_cuff_atlys - syn
7-- Description: rlink tester design for atlys 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_demu_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--
17-- Test bench: -
18--
19-- Target Devices: generic
20-- Tool versions: xst 13.3-14.7; ghdl 0.29-0.31
21--
22-- Synthesized (xst):
23-- Date Rev ise Target flop lutl lutm slic t peri ctl/MHz
24-- 2013-01-06 472 13.3 O76d xc6slx45 ??? ???? ??? ???? p ??.? ic2/100
25--
26-- Revision History:
27-- Date Rev Version Comment
28-- 2015-01-25 638 1.1.2 retire fx2_2fifoctl_as
29-- 2014-12-24 620 1.1.1 relocate hio rbus address
30-- 2014-08-15 583 1.1 rb_mreq addr now 16 bit
31-- 2013-01-06 472 1.0 Initial version; derived from sys_tst_rlink_cuff_n3
32-- and sys_tst_fx2loop_atlys
33------------------------------------------------------------------------------
34-- Usage of Atlys Switches, Buttons, LEDs:
35--
36-- SWI(7:3) no function (only connected to sn_humanio_demu_rbus)
37-- (2) 0 -> int/ext RS242 port for rlink
38-- 1 -> use USB interface for rlink
39-- (1) 1 enable XON
40-- (0) 0 -> main board RS232 port - implemented in bp_rs232_2l4l_iob
41-- 1 -> Pmod B/top RS232 port /
42--
43-- LED(7) SER_MONI.abact
44-- (6:2) no function (only connected to sn_humanio_demu_rbus)
45-- (1) timer 1 busy
46-- (0) timer 0 busy
47--
48-- DSP: SER_MONI.clkdiv (from auto bauder)
49-- for SWI(2)='0' (serport)
50-- DP(3) not SER_MONI.txok (shows tx back pressure)
51-- (2) SER_MONI.txact (shows tx activity)
52-- (1) not SER_MONI.rxok (shows rx back pressure)
53-- (0) SER_MONI.rxact (shows rx activity)
54-- for SWI(2)='1' (fx2)
55-- DP(3) FX2_TX2BUSY (shows tx2 back pressure)
56-- (2) FX2_TX2ENA(stretched) (shows tx2 activity)
57-- (1) FX2_TXENA(streched) (shows tx activity)
58-- (0) FX2_RXVAL(stretched) (shows rx activity)
59--
60
61library ieee;
62use ieee.std_logic_1164.all;
63use ieee.numeric_std.all;
64
65use work.slvtypes.all;
66use work.xlib.all;
67use work.genlib.all;
68use work.bpgenlib.all;
69use work.bpgenrbuslib.all;
70use work.rblib.all;
71use work.fx2lib.all;
72use work.sys_conf.all;
73
74-- ----------------------------------------------------------------------------
75
76entity sys_tst_rlink_cuff_atlys is -- top level
77 -- implements atlys_fusp_cuff_aif
78 port (
79 I_CLK100 : in slbit; -- 100 MHz clock
80 I_USB_RXD : in slbit; -- USB UART receive data (board view)
81 O_USB_TXD : out slbit; -- USB UART transmit data (board view)
82 I_HIO_SWI : in slv8; -- atlys hio switches
83 I_HIO_BTN : in slv6; -- atlys hio buttons
84 O_HIO_LED: out slv8; -- atlys hio leds
85 O_FUSP_RTS_N : out slbit; -- fusp: rs232 rts_n
86 I_FUSP_CTS_N : in slbit; -- fusp: rs232 cts_n
87 I_FUSP_RXD : in slbit; -- fusp: rs232 rx
88 O_FUSP_TXD : out slbit; -- fusp: rs232 tx
89 I_FX2_IFCLK : in slbit; -- fx2: interface clock
90 O_FX2_FIFO : out slv2; -- fx2: fifo address
91 I_FX2_FLAG : in slv4; -- fx2: fifo flags
92 O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low)
93 O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low)
94 O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low)
95 O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low)
96 IO_FX2_DATA : inout slv8 -- fx2: data lines
97 );
99
101
102 signal CLK : slbit := '0';
103 signal RESET : slbit := '0';
104
105 signal CE_USEC : slbit := '0';
106 signal CE_MSEC : slbit := '0';
107
108 signal RXSD : slbit := '0';
109 signal TXSD : slbit := '0';
110 signal CTS_N : slbit := '0';
111 signal RTS_N : slbit := '0';
112
113 signal SWI : slv8 := (others=>'0');
114 signal BTN : slv4 := (others=>'0');
115 signal LED : slv8 := (others=>'0');
116 signal DSP_DAT : slv16 := (others=>'0');
117 signal DSP_DP : slv4 := (others=>'0');
118
119 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
120 signal RB_SRES_HIO : rb_sres_type := rb_sres_init;
121
122 signal FX2_RXDATA : slv8 := (others=>'0');
123 signal FX2_RXVAL : slbit := '0';
124 signal FX2_RXHOLD : slbit := '0';
125 signal FX2_RXAEMPTY : slbit := '0';
126 signal FX2_TXDATA : slv8 := (others=>'0');
127 signal FX2_TXENA : slbit := '0';
128 signal FX2_TXBUSY : slbit := '0';
129 signal FX2_TXAFULL : slbit := '0';
130 signal FX2_TX2DATA : slv8 := (others=>'0');
131 signal FX2_TX2ENA : slbit := '0';
132 signal FX2_TX2BUSY : slbit := '0';
133 signal FX2_TX2AFULL : slbit := '0';
134 signal FX2_MONI : fx2ctl_moni_type := fx2ctl_moni_init;
135
136 constant rbaddr_hio : slv16 := x"fef0"; -- fef0/0008: 1111 1110 1111 0xxx
137
138begin
139
140 assert (sys_conf_clksys mod 1000000) = 0
141 report "assert sys_conf_clksys on MHz grid"
142 severity failure;
143
144 DCM : dcm_sfs
145 generic map (
146 CLKFX_DIVIDE => sys_conf_clkfx_divide,
147 CLKFX_MULTIPLY => sys_conf_clkfx_multiply,
148 CLKIN_PERIOD => 10.0)
149 port map (
150 CLKIN => I_CLK100,
151 CLKFX => CLK,
152 LOCKED => open
153 );
154
155 CLKDIV : clkdivce
156 generic map (
157 CDUWIDTH => 7, -- good for up to 127 MHz !
158 USECDIV => sys_conf_clksys_mhz,
159 MSECDIV => 1000)
160 port map (
161 CLK => CLK,
162 CE_USEC => CE_USEC,
164 );
165
166 IOB_RS232 : bp_rs232_2l4l_iob
167 port map (
168 CLK => CLK,
169 RESET => '0',
170 SEL => SWI(0),
171 RXD => RXSD,
172 TXD => TXSD,
173 CTS_N => CTS_N,
174 RTS_N => RTS_N,
175 I_RXD0 => I_USB_RXD,
176 O_TXD0 => O_USB_TXD,
181 );
182
184 generic map (
185 DEBOUNCE => sys_conf_hio_debounce,
187 port map (
188 CLK => CLK,
189 RESET => RESET,
190 CE_MSEC => CE_MSEC,
191 RB_MREQ => RB_MREQ,
193 SWI => SWI,
194 BTN => BTN,
195 LED => LED,
196 DSP_DAT => DSP_DAT,
197 DSP_DP => DSP_DP,
198 I_SWI => I_HIO_SWI,
199 I_BTN => I_HIO_BTN,
201 );
202
203 FX2_CNTL_IC : if sys_conf_fx2_type = "ic2" generate
204 CNTL : fx2_2fifoctl_ic
205 generic map (
206 RXFAWIDTH => 5,
207 TXFAWIDTH => 5,
208 PETOWIDTH => sys_conf_fx2_petowidth,
209 CCWIDTH => sys_conf_fx2_ccwidth,
210 RXAEMPTY_THRES => 1,
211 TXAFULL_THRES => 1)
212 port map (
213 CLK => CLK,
214 RESET => RESET,
216 RXVAL => FX2_RXVAL,
220 TXENA => FX2_TXENA,
223 MONI => FX2_MONI,
232 );
233 end generate FX2_CNTL_IC;
234
235 FX2_CNTL_IC3 : if sys_conf_fx2_type = "ic3" generate
236 CNTL : fx2_3fifoctl_ic
237 generic map (
238 RXFAWIDTH => 5,
239 TXFAWIDTH => 5,
240 PETOWIDTH => sys_conf_fx2_petowidth,
241 CCWIDTH => sys_conf_fx2_ccwidth,
242 RXAEMPTY_THRES => 1,
243 TXAFULL_THRES => 1,
244 TX2AFULL_THRES => 1)
245 port map (
246 CLK => CLK,
247 RESET => RESET,
249 RXVAL => FX2_RXVAL,
253 TXENA => FX2_TXENA,
260 MONI => FX2_MONI,
269 );
270 end generate FX2_CNTL_IC3;
271
272 TST : entity work.tst_rlink_cuff
273 port map (
274 CLK => CLK,
275 RESET => '0',
276 CE_USEC => CE_USEC,
277 CE_MSEC => CE_MSEC,
280 SWI => SWI,
281 BTN => BTN(3 downto 0),
282 LED => LED,
283 DSP_DAT => DSP_DAT,
284 DSP_DP => DSP_DP,
285 RXSD => RXSD,
286 TXSD => TXSD,
287 RTS_N => RTS_N,
288 CTS_N => CTS_N,
299 );
300
301end syn;
302
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( 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( 5 downto 0) slv6
Definition: slvtypes.vhd:38
std_logic_vector( 7 downto 0) slv8
Definition: slvtypes.vhd:40
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
out RB_SRES rb_sres_type
Definition: xlib.vhd:34