w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_tst_rlink_n2.vhd
Go to the documentation of this file.
1-- $Id: sys_tst_rlink_n2.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2010-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_tst_rlink_n2 - syn
7-- Description: rlink tester design for nexys2
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-- vlib/rlink/rlink_sp1c
14-- rbd_tst_rlink
15-- vlib/rbus/rb_sres_or_2
16-- vlib/nxcramlib/nx_cram_dummy
17--
18-- Test bench: tb/tb_tst_rlink_n2
19--
20-- Target Devices: generic
21-- Tool versions: xst 12.1-14.7; ghdl 0.29-0.33
22--
23-- Synthesized (xst):
24-- Date Rev ise Target flop lutl lutm slic t peri
25-- 2016-03-06 743 14.7 131013 xc3s1200e-4 933 2007 128 1348
26-- 2014-12-20 614 14.7 131013 xc3s1200e-4 914 1951 128 1321 t 15.7
27-- 2012-12-27 453 13.3 O76d xc3s1200e-4 754 1605 96 1057 t 14.5
28-- 2011-12-18 440 13.1 O40d xc3s1200e-4 754 1605 96 1057 t 16.8
29-- 2011-06-26 385 12.1 M53d xc3s1200e-4 688 1500 68 993 t 16.2
30-- 2011-04-02 375 12.1 M53d xc3s1200e-4 688 1572 68 994 t 13.8
31-- 2010-12-29 351 12.1 M53d xc3s1200e-4 604 1298 68 851 t 14.7
32--
33-- Revision History:
34-- Date Rev Version Comment
35-- 2016-03-19 748 1.4.2 define rlink SYSID
36-- 2015-04-11 666 1.4.1 rearrange XON handling
37-- 2014-11-09 603 1.4 use new rlink v4 iface and 4 bit STAT
38-- 2014-08-15 583 1.3 rb_mreq addr now 16 bit
39-- 2011-12-23 444 1.2 remove clksys output hack
40-- 2011-12-18 440 1.1.6 use now rbd_tst_rlink and rlink_sp1c
41-- 2011-11-26 433 1.1.5 use nx_cram_dummy now
42-- 2011-11-23 432 1.1.4 update O_FLA_CE_N usage
43-- 2011-11-17 426 1.1.3 use dcm_sfs now
44-- 2011-07-09 391 1.1.2 use now bp_rs232_2l4l_iob
45-- 2011-07-08 390 1.1.1 use now sn_humanio
46-- 2011-06-26 385 1.1 move s3_humanio_rbus from tst_rlink to top level
47-- 2010-12-29 351 1.0 Initial version
48------------------------------------------------------------------------------
49-- Usage of Nexys 2 Switches, Buttons, LEDs:
50--
51-- SWI(7:2) no function (only connected to sn_humanio_rbus)
52-- (1) 1 enable XON
53-- (0) 0 -> main board RS232 port - implemented in bp_rs232_2l4l_iob
54-- 1 -> Pmod B/top RS232 port /
55--
56-- LED(7) SER_MONI.abact
57-- (6:2) no function (only connected to sn_humanio_rbus)
58-- (1) timer 1 busy
59-- (0) timer 0 busy
60--
61-- DSP: SER_MONI.clkdiv (from auto bauder)
62-- DP(3) not SER_MONI.txok (shows tx back pressure)
63-- (2) SER_MONI.txact (shows tx activity)
64-- (1) not SER_MONI.rxok (shows rx back pressure)
65-- (0) SER_MONI.rxact (shows rx activity)
66--
67
68library ieee;
69use ieee.std_logic_1164.all;
70
71use work.slvtypes.all;
72use work.xlib.all;
73use work.genlib.all;
74use work.serportlib.all;
75use work.rblib.all;
76use work.rlinklib.all;
77use work.bpgenlib.all;
78use work.bpgenrbuslib.all;
79use work.nxcramlib.all;
80use work.sys_conf.all;
81
82-- ----------------------------------------------------------------------------
83
84entity sys_tst_rlink_n2 is -- top level
85 -- implements nexys2_fusp_aif
86 port (
87 I_CLK50 : in slbit; -- 50 MHz clock
88 I_RXD : in slbit; -- receive data (board view)
89 O_TXD : out slbit; -- transmit data (board view)
90 I_SWI : in slv8; -- n2 switches
91 I_BTN : in slv4; -- n2 buttons
92 O_LED : out slv8; -- n2 leds
93 O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low)
94 O_SEG_N : out slv8; -- 7 segment disp: segments (act.low)
95 O_MEM_CE_N : out slbit; -- cram: chip enable (act.low)
96 O_MEM_BE_N : out slv2; -- cram: byte enables (act.low)
97 O_MEM_WE_N : out slbit; -- cram: write enable (act.low)
98 O_MEM_OE_N : out slbit; -- cram: output enable (act.low)
99 O_MEM_ADV_N : out slbit; -- cram: address valid (act.low)
100 O_MEM_CLK : out slbit; -- cram: clock
101 O_MEM_CRE : out slbit; -- cram: command register enable
102 I_MEM_WAIT : in slbit; -- cram: mem wait
103 O_MEM_ADDR : out slv23; -- cram: address lines
104 IO_MEM_DATA : inout slv16; -- cram: data lines
105 O_FLA_CE_N : out slbit; -- flash ce.. (act.low)
106 O_FUSP_RTS_N : out slbit; -- fusp: rs232 rts_n
107 I_FUSP_CTS_N : in slbit; -- fusp: rs232 cts_n
108 I_FUSP_RXD : in slbit; -- fusp: rs232 rx
109 O_FUSP_TXD : out slbit -- fusp: rs232 tx
110 );
112
113architecture syn of sys_tst_rlink_n2 is
114
115 signal CLK : slbit := '0';
116
117 signal RXD : slbit := '1';
118 signal TXD : slbit := '0';
119 signal RTS_N : slbit := '0';
120 signal CTS_N : slbit := '0';
121
122 signal SWI : slv8 := (others=>'0');
123 signal BTN : slv4 := (others=>'0');
124 signal LED : slv8 := (others=>'0');
125 signal DSP_DAT : slv16 := (others=>'0');
126 signal DSP_DP : slv4 := (others=>'0');
127
128 signal RESET : slbit := '0';
129 signal CE_USEC : slbit := '0';
130 signal CE_MSEC : slbit := '0';
131
132 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
133 signal RB_SRES : rb_sres_type := rb_sres_init;
134 signal RB_SRES_HIO : rb_sres_type := rb_sres_init;
135 signal RB_SRES_TST : rb_sres_type := rb_sres_init;
136
137 signal RB_LAM : slv16 := (others=>'0');
138 signal RB_STAT : slv4 := (others=>'0');
139
140 signal SER_MONI : serport_moni_type := serport_moni_init;
141 signal STAT : slv8 := (others=>'0');
142
143 constant rbaddr_hio : slv16 := x"fef0"; -- fef0/0008: 1111 1110 1111 0xxx
144
145 constant sysid_proj : slv16 := x"0101"; -- tst_rlink
146 constant sysid_board : slv8 := x"02"; -- nexys2
147 constant sysid_vers : slv8 := x"00";
148
149begin
150
151 assert (sys_conf_clksys mod 1000000) = 0
152 report "assert sys_conf_clksys on MHz grid"
153 severity failure;
154
155 RESET <= '0'; -- so far not used
156
157 DCM : dcm_sfs
158 generic map (
159 CLKFX_DIVIDE => sys_conf_clkfx_divide,
160 CLKFX_MULTIPLY => sys_conf_clkfx_multiply,
161 CLKIN_PERIOD => 20.0)
162 port map (
163 CLKIN => I_CLK50,
164 CLKFX => CLK,
165 LOCKED => open
166 );
167
168 CLKDIV : clkdivce
169 generic map (
170 CDUWIDTH => 7,
171 USECDIV => sys_conf_clksys_mhz,
172 MSECDIV => 1000)
173 port map (
174 CLK => CLK,
175 CE_USEC => CE_USEC,
177 );
178
179 IOB_RS232 : bp_rs232_2l4l_iob
180 port map (
181 CLK => CLK,
182 RESET => '0',
183 SEL => SWI(0),
184 RXD => RXD,
185 TXD => TXD,
186 CTS_N => CTS_N,
187 RTS_N => RTS_N,
188 I_RXD0 => I_RXD,
189 O_TXD0 => O_TXD,
194 );
195
196 HIO : sn_humanio_rbus
197 generic map (
198 DEBOUNCE => sys_conf_hio_debounce,
200 port map (
201 CLK => CLK,
202 RESET => RESET,
203 CE_MSEC => CE_MSEC,
204 RB_MREQ => RB_MREQ,
206 SWI => SWI,
207 BTN => BTN,
208 LED => LED,
209 DSP_DAT => DSP_DAT,
210 DSP_DP => DSP_DP,
211 I_SWI => I_SWI,
212 I_BTN => I_BTN,
213 O_LED => O_LED,
214 O_ANO_N => O_ANO_N,
216 );
217
218 RLINK : rlink_sp1c
219 generic map (
220 BTOWIDTH => 6,
221 RTAWIDTH => 12,
222 SYSID => sysid_proj & sysid_board & sysid_vers ,
223 IFAWIDTH => 5,
224 OFAWIDTH => 5,
225 ENAPIN_RLMON => sbcntl_sbf_rlmon,
226 ENAPIN_RBMON => sbcntl_sbf_rbmon,
227 CDWIDTH => 15,
228 CDINIT => sys_conf_ser2rri_cdinit,
229 RBMON_AWIDTH => 0, -- must be 0, rbmon in rbd_tst_rlink
230 RBMON_RBADDR => (others=>'0'))
231 port map (
232 CLK => CLK,
233 CE_USEC => CE_USEC,
234 CE_MSEC => CE_MSEC,
235 CE_INT => CE_MSEC,
236 RESET => RESET,
237 ENAXON => SWI(1),
238 ESCFILL => '0',
239 RXSD => RXD,
240 TXSD => TXD,
241 CTS_N => CTS_N,
242 RTS_N => RTS_N,
243 RB_MREQ => RB_MREQ,
244 RB_SRES => RB_SRES,
245 RB_LAM => RB_LAM,
246 RB_STAT => RB_STAT,
247 RL_MONI => open,
249 );
250
251 RBDTST : entity work.rbd_tst_rlink
252 port map (
253 CLK => CLK,
254 RESET => RESET,
255 CE_USEC => CE_USEC,
256 RB_MREQ => RB_MREQ,
258 RB_LAM => RB_LAM,
259 RB_STAT => RB_STAT,
261 RXSD => RXD,
262 RXACT => SER_MONI.rxact,
263 STAT => STAT
264 );
265
266 RB_SRES_OR1 : rb_sres_or_2
267 port map (
271 );
272
273 SRAM_PROT : nx_cram_dummy -- connect CRAM to protection dummy
274 port map (
275 O_MEM_CE_N => O_MEM_CE_N,
276 O_MEM_BE_N => O_MEM_BE_N,
277 O_MEM_WE_N => O_MEM_WE_N,
278 O_MEM_OE_N => O_MEM_OE_N,
279 O_MEM_ADV_N => O_MEM_ADV_N,
280 O_MEM_CLK => O_MEM_CLK,
281 O_MEM_CRE => O_MEM_CRE,
282 I_MEM_WAIT => I_MEM_WAIT,
283 O_MEM_ADDR => O_MEM_ADDR,
284 IO_MEM_DATA => IO_MEM_DATA
285 );
286
287 O_FLA_CE_N <= '1'; -- keep Flash memory disabled
288
289 DSP_DAT <= SER_MONI.abclkdiv;
290
291 DSP_DP(3) <= not SER_MONI.txok;
292 DSP_DP(2) <= SER_MONI.txact;
293 DSP_DP(1) <= not SER_MONI.rxok;
294 DSP_DP(0) <= SER_MONI.rxact;
295
296 LED(7) <= SER_MONI.abact;
297 LED(6 downto 2) <= (others=>'0');
298 LED(1) <= STAT(1);
299 LED(0) <= STAT(0);
300
301end syn;
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
in RB_SRES_2 rb_sres_type := rb_sres_init
out RB_SRES_OR rb_sres_type
in RB_SRES_1 rb_sres_type
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