w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_tst_rlink_n3.vhd
Go to the documentation of this file.
1-- $Id: sys_tst_rlink_n3.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2011-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: sys_tst_rlink_n3 - syn
7-- Description: rlink tester design for nexys3
8--
9-- Dependencies: vlib/xlib/s6_cmt_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_n3
19--
20-- Target Devices: generic
21-- Tool versions: xst 13.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-13 743 14.7 131013 xc6slx16-2 950 1380 70 504
26-- 2014-12-20 614 14.7 131013 xc6slx16-2 917 1379 64 513 t 8.9
27-- 2011-12-18 440 13.1 O40d xc6slx16-2 752 1258 48 439 t 7.9
28-- 2011-11-26 433 13.1 O40d xc6slx16-2 722 1199 36 423 t 9.7
29--
30-- Revision History:
31-- Date Rev Version Comment
32-- 2016-03-19 748 1.4.2 define rlink SYSID
33-- 2015-04-11 666 1.4.1 rearrange XON handling
34-- 2014-11-09 603 1.4 use new rlink v4 iface and 4 bit STAT
35-- 2014-08-15 583 1.3 rb_mreq addr now 16 bit
36-- 2013-10-06 538 1.2 pll support, use clksys_vcodivide ect
37-- 2011-12-18 440 1.1.1 use [rt]xok for DSP_DP
38-- 2011-12-11 438 1.1 use now rbd_tst_rlink and rlink_sp1c
39-- 2011-11-26 433 1.0 Initial version (derived from sys_tst_rlink_n2)
40------------------------------------------------------------------------------
41-- Usage of Nexys 3 Switches, Buttons, LEDs:
42--
43-- SWI(7:2): no function (only connected to sn_humanio_rbus)
44-- SWI(1): 1 enable XON
45-- SWI(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-- LED(6:2): no function (only connected to sn_humanio_rbus)
50-- LED(1): timer 1 busy
51-- LED(0): timer 0 busy
52--
53-- DSP: SER_MONI.clkdiv (from auto bauder)
54-- DP(3): not SER_MONI.txok (shows tx back pressure)
55-- DP(2): SER_MONI.txact (shows tx activity)
56-- DP(1): not SER_MONI.rxok (shows rx back pressure)
57-- DP(0): SER_MONI.rxact (shows rx activity)
58--
59
60library ieee;
61use ieee.std_logic_1164.all;
62
63use work.slvtypes.all;
64use work.xlib.all;
65use work.genlib.all;
66use work.serportlib.all;
67use work.rblib.all;
68use work.rlinklib.all;
69use work.bpgenlib.all;
70use work.bpgenrbuslib.all;
71use work.nxcramlib.all;
72use work.sys_conf.all;
73
74-- ----------------------------------------------------------------------------
75
76entity sys_tst_rlink_n3 is -- top level
77 -- implements nexys3_fusp_aif
78 port (
79 I_CLK100 : in slbit; -- 100 MHz clock
80 I_RXD : in slbit; -- receive data (board view)
81 O_TXD : out slbit; -- transmit data (board view)
82 I_SWI : in slv8; -- n3 switches
83 I_BTN : in slv5; -- n3 buttons
84 O_LED : out slv8; -- n3 leds
85 O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low)
86 O_SEG_N : out slv8; -- 7 segment disp: segments (act.low)
87 O_MEM_CE_N : out slbit; -- cram: chip enable (act.low)
88 O_MEM_BE_N : out slv2; -- cram: byte enables (act.low)
89 O_MEM_WE_N : out slbit; -- cram: write enable (act.low)
90 O_MEM_OE_N : out slbit; -- cram: output enable (act.low)
91 O_MEM_ADV_N : out slbit; -- cram: address valid (act.low)
92 O_MEM_CLK : out slbit; -- cram: clock
93 O_MEM_CRE : out slbit; -- cram: command register enable
94 I_MEM_WAIT : in slbit; -- cram: mem wait
95 O_MEM_ADDR : out slv23; -- cram: address lines
96 IO_MEM_DATA : inout slv16; -- cram: data lines
97 O_PPCM_CE_N : out slbit; -- ppcm: ...
98 O_PPCM_RST_N : out slbit; -- ppcm: ...
99 O_FUSP_RTS_N : out slbit; -- fusp: rs232 rts_n
100 I_FUSP_CTS_N : in slbit; -- fusp: rs232 cts_n
101 I_FUSP_RXD : in slbit; -- fusp: rs232 rx
102 O_FUSP_TXD : out slbit -- fusp: rs232 tx
103 );
105
106architecture syn of sys_tst_rlink_n3 is
107
108 signal CLK : slbit := '0';
109
110 signal RXD : slbit := '1';
111 signal TXD : slbit := '0';
112 signal RTS_N : slbit := '0';
113 signal CTS_N : slbit := '0';
114
115 signal SWI : slv8 := (others=>'0');
116 signal BTN : slv5 := (others=>'0');
117 signal LED : slv8 := (others=>'0');
118 signal DSP_DAT : slv16 := (others=>'0');
119 signal DSP_DP : slv4 := (others=>'0');
120
121 signal RESET : slbit := '0';
122 signal CE_USEC : slbit := '0';
123 signal CE_MSEC : slbit := '0';
124
125 signal RB_MREQ : rb_mreq_type := rb_mreq_init;
126 signal RB_SRES : rb_sres_type := rb_sres_init;
127 signal RB_SRES_HIO : rb_sres_type := rb_sres_init;
128 signal RB_SRES_TST : rb_sres_type := rb_sres_init;
129
130 signal RB_LAM : slv16 := (others=>'0');
131 signal RB_STAT : slv4 := (others=>'0');
132
133 signal SER_MONI : serport_moni_type := serport_moni_init;
134 signal STAT : slv8 := (others=>'0');
135
136 constant rbaddr_hio : slv16 := x"fef0"; -- fef0/0008: 1111 1110 1111 0xxx
137
138 constant sysid_proj : slv16 := x"0101"; -- tst_rlink
139 constant sysid_board : slv8 := x"03"; -- nexys3
140 constant sysid_vers : slv8 := x"00";
141
142begin
143
144 assert (sys_conf_clksys mod 1000000) = 0
145 report "assert sys_conf_clksys on MHz grid"
146 severity failure;
147
148 RESET <= '0'; -- so far not used
149
150 GEN_CLKSYS : s6_cmt_sfs
151 generic map (
152 VCO_DIVIDE => sys_conf_clksys_vcodivide,
153 VCO_MULTIPLY => sys_conf_clksys_vcomultiply,
154 OUT_DIVIDE => sys_conf_clksys_outdivide,
155 CLKIN_PERIOD => 10.0,
156 CLKIN_JITTER => 0.01,
157 STARTUP_WAIT => false,
158 GEN_TYPE => sys_conf_clksys_gentype)
159 port map (
160 CLKIN => I_CLK100,
161 CLKFX => CLK,
162 LOCKED => open
163 );
164
165 CLKDIV : clkdivce
166 generic map (
167 CDUWIDTH => 7,
168 USECDIV => sys_conf_clksys_mhz,
169 MSECDIV => 1000)
170 port map (
171 CLK => CLK,
172 CE_USEC => CE_USEC,
174 );
175
176 IOB_RS232 : bp_rs232_2l4l_iob
177 port map (
178 CLK => CLK,
179 RESET => '0',
180 SEL => SWI(0),
181 RXD => RXD,
182 TXD => TXD,
183 CTS_N => CTS_N,
184 RTS_N => RTS_N,
185 I_RXD0 => I_RXD,
186 O_TXD0 => O_TXD,
191 );
192
193 HIO : sn_humanio_rbus
194 generic map (
195 BWIDTH => 5,
196 DEBOUNCE => sys_conf_hio_debounce,
198 port map (
199 CLK => CLK,
200 RESET => RESET,
201 CE_MSEC => CE_MSEC,
202 RB_MREQ => RB_MREQ,
204 SWI => SWI,
205 BTN => BTN,
206 LED => LED,
207 DSP_DAT => DSP_DAT,
208 DSP_DP => DSP_DP,
209 I_SWI => I_SWI,
210 I_BTN => I_BTN,
211 O_LED => O_LED,
212 O_ANO_N => O_ANO_N,
214 );
215
216 RLINK : rlink_sp1c
217 generic map (
218 BTOWIDTH => 6,
219 RTAWIDTH => 12,
220 SYSID => sysid_proj & sysid_board & sysid_vers ,
221 IFAWIDTH => 5,
222 OFAWIDTH => 5,
223 ENAPIN_RLMON => sbcntl_sbf_rlmon,
224 ENAPIN_RBMON => sbcntl_sbf_rbmon,
225 CDWIDTH => 15,
226 CDINIT => sys_conf_ser2rri_cdinit,
227 RBMON_AWIDTH => 0, -- must be 0, rbmon in rbd_tst_rlink
228 RBMON_RBADDR => (others=>'0'))
229 port map (
230 CLK => CLK,
231 CE_USEC => CE_USEC,
232 CE_MSEC => CE_MSEC,
233 CE_INT => CE_MSEC,
234 RESET => RESET,
235 ENAXON => SWI(1),
236 ESCFILL => '0',
237 RXSD => RXD,
238 TXSD => TXD,
239 CTS_N => CTS_N,
240 RTS_N => RTS_N,
241 RB_MREQ => RB_MREQ,
242 RB_SRES => RB_SRES,
243 RB_LAM => RB_LAM,
244 RB_STAT => RB_STAT,
245 RL_MONI => open,
247 );
248
249 RBDTST : entity work.rbd_tst_rlink
250 port map (
251 CLK => CLK,
252 RESET => RESET,
253 CE_USEC => CE_USEC,
254 RB_MREQ => RB_MREQ,
256 RB_LAM => RB_LAM,
257 RB_STAT => RB_STAT,
259 RXSD => RXD,
260 RXACT => SER_MONI.rxact,
261 STAT => STAT
262 );
263
264 RB_SRES_OR1 : rb_sres_or_2
265 port map (
269 );
270
271 SRAM_PROT : nx_cram_dummy -- connect CRAM to protection dummy
272 port map (
273 O_MEM_CE_N => O_MEM_CE_N,
274 O_MEM_BE_N => O_MEM_BE_N,
275 O_MEM_WE_N => O_MEM_WE_N,
276 O_MEM_OE_N => O_MEM_OE_N,
277 O_MEM_ADV_N => O_MEM_ADV_N,
278 O_MEM_CLK => O_MEM_CLK,
279 O_MEM_CRE => O_MEM_CRE,
280 I_MEM_WAIT => I_MEM_WAIT,
281 O_MEM_ADDR => O_MEM_ADDR,
282 IO_MEM_DATA => IO_MEM_DATA
283 );
284
285 O_PPCM_CE_N <= '1'; -- keep parallel PCM memory disabled
286 O_PPCM_RST_N <= '1'; --
287
288 DSP_DAT <= SER_MONI.abclkdiv;
289
290 DSP_DP(3) <= not SER_MONI.txok;
291 DSP_DP(2) <= SER_MONI.txact;
292 DSP_DP(1) <= not SER_MONI.rxok;
293 DSP_DP(0) <= SER_MONI.rxact;
294
295 LED(7) <= SER_MONI.abact;
296 LED(6 downto 2) <= (others=>'0');
297 LED(1) <= STAT(1);
298 LED(0) <= STAT(0);
299
300end 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
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
VCO_DIVIDE positive := 1
GEN_TYPE string := "PLL"
CLKIN_PERIOD real := 10.0
OUT_DIVIDE positive := 1
in CLKIN slbit
CLKIN_JITTER real := 0.01
STARTUP_WAIT boolean := false
VCO_MULTIPLY positive := 1
out LOCKED slbit
out CLKFX slbit
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( 4 downto 0) slv5
Definition: slvtypes.vhd:37
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
BWIDTH positive := 4
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