w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
sys_tst_serloop1_n4d.vhd
Go to the documentation of this file.
1-- $Id: sys_tst_serloop1_n4d.vhd 1369 2023-02-08 18:59:50Z 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_serloop1_n4d - syn
7-- Description: Serial link tester design for nexys4d (serport_1clock case)
8--
9-- Dependencies: vlib/xlib/s7_cmt_sfs
10-- vlib/genlib/clkdivce
11-- bpgen/bp_rs232_4line_iob
12-- bpgen/sn_humanio
13-- tst_serloop_hiomap
14-- vlib/serport/serport_1clock
15-- tst_serloop
16--
17-- Test bench: -
18--
19-- Target Devices: generic
20-- Tool versions: viv 2016.2-2022.1; ghdl 0.33-2.0.0
21--
22-- Synthesized:
23-- Date Rev viv Target flop lutl lutm bram slic
24-- 2022-07-05 1247 2022.1 xc7a100t-1 409 421 12 0 189
25-- 2019-02-02 1108 2018.3 xc7a100t-1 409 456 16 0 200
26-- 2019-02-02 1108 2017.2 xc7a100t-1 409 446 16 0 186
27--
28-- Revision History:
29-- Date Rev Version Comment
30-- 2017-01-04 838 1.0 Initial version (derived from sys_tst_serloop1_n4)
31------------------------------------------------------------------------------
32--
33
34library ieee;
35use ieee.std_logic_1164.all;
36use ieee.numeric_std.all;
37
38use work.slvtypes.all;
39use work.xlib.all;
40use work.genlib.all;
41use work.bpgenlib.all;
42use work.tst_serlooplib.all;
43use work.serportlib.all;
44use work.sys_conf.all;
45
46-- ----------------------------------------------------------------------------
47
48entity sys_tst_serloop1_n4d is -- top level
49 -- implements nexys4d_aif
50 port (
51 I_CLK100 : in slbit; -- 100 MHz clock
52 I_RXD : in slbit; -- receive data (board view)
53 O_TXD : out slbit; -- transmit data (board view)
54 O_RTS_N : out slbit; -- rx rts (board view; act.low)
55 I_CTS_N : in slbit; -- tx cts (board view; act.low)
56 I_SWI : in slv16; -- n4d switches
57 I_BTN : in slv5; -- n4d buttons
58 I_BTNRST_N : in slbit; -- n4d reset button
59 O_LED : out slv16; -- n4d leds
60 O_RGBLED0 : out slv3; -- n4d rgb-led 0
61 O_RGBLED1 : out slv3; -- n4d rgb-led 1
62 O_ANO_N : out slv8; -- 7 segment disp: anodes (act.low)
63 O_SEG_N : out slv8 -- 7 segment disp: segments (act.low)
64 );
66
67architecture syn of sys_tst_serloop1_n4d is
68
69 signal CLK : slbit := '0';
70 signal RESET : slbit := '0';
71
72 signal CE_USEC : slbit := '0';
73 signal CE_MSEC : slbit := '0';
74
75 signal RXD : slbit := '0';
76 signal TXD : slbit := '0';
77 signal CTS_N : slbit := '0';
78 signal RTS_N : slbit := '0';
79
80 signal SWI : slv16 := (others=>'0');
81 signal BTN : slv5 := (others=>'0');
82 signal LED : slv16 := (others=>'0');
83 signal DSP_DAT : slv32 := (others=>'0');
84 signal DSP_DP : slv8 := (others=>'0');
85
86 signal HIO_CNTL : hio_cntl_type := hio_cntl_init;
87 signal HIO_STAT : hio_stat_type := hio_stat_init;
88
89 signal RXDATA : slv8 := (others=>'0');
90 signal RXVAL : slbit := '0';
91 signal RXHOLD : slbit := '0';
92 signal TXDATA : slv8 := (others=>'0');
93 signal TXENA : slbit := '0';
94 signal TXBUSY : slbit := '0';
95
96 signal SER_MONI : serport_moni_type := serport_moni_init;
97
98begin
99
100 GEN_CLKSYS : s7_cmt_sfs -- clock generator -------------------
101 generic map (
102 VCO_DIVIDE => sys_conf_clksys_vcodivide,
103 VCO_MULTIPLY => sys_conf_clksys_vcomultiply,
104 OUT_DIVIDE => sys_conf_clksys_outdivide,
105 CLKIN_PERIOD => 10.0,
106 CLKIN_JITTER => 0.01,
107 STARTUP_WAIT => false,
108 GEN_TYPE => sys_conf_clksys_gentype)
109 port map (
110 CLKIN => I_CLK100,
111 CLKFX => CLK,
112 LOCKED => open
113 );
114
115 CLKDIV : clkdivce
116 generic map (
117 CDUWIDTH => 7,
118 USECDIV => sys_conf_clksys_mhz,
119 MSECDIV => sys_conf_clkdiv_msecdiv)
120 port map (
121 CLK => CLK,
122 CE_USEC => open,
124 );
125
126 HIO : sn_humanio
127 generic map (
128 SWIDTH => 16,
129 BWIDTH => 5,
130 LWIDTH => 16,
131 DCWIDTH => 3,
132 DEBOUNCE => sys_conf_hio_debounce)
133 port map (
134 CLK => CLK,
135 RESET => '0',
136 CE_MSEC => CE_MSEC,
137 SWI => SWI,
138 BTN => BTN,
139 LED => LED,
140 DSP_DAT => DSP_DAT,
141 DSP_DP => DSP_DP,
142 I_SWI => I_SWI,
143 I_BTN => I_BTN,
144 O_LED => O_LED,
145 O_ANO_N => O_ANO_N,
147 );
148
149 RESET <= BTN(0); -- BTN(0) will reset tester !!
150
151 HIOMAP : tst_serloop_hiomap
152 port map (
153 CLK => CLK,
154 RESET => RESET,
158 SWI => SWI(7 downto 0),
159 BTN => BTN(3 downto 0),
160 LED => LED(7 downto 0),
161 DSP_DAT => DSP_DAT(15 downto 0),
162 DSP_DP => DSP_DP(3 downto 0)
163 );
164
165 IOB_RS232 : bp_rs232_4line_iob
166 port map (
167 CLK => CLK,
168 RXD => RXD,
169 TXD => TXD,
170 CTS_N => CTS_N,
171 RTS_N => RTS_N,
172 I_RXD => I_RXD,
173 O_TXD => O_TXD,
174 I_CTS_N => I_CTS_N,
176 );
177
178 SERPORT : serport_1clock
179 generic map (
180 CDWIDTH => 12,
181 CDINIT => sys_conf_uart_cdinit,
182 RXFAWIDTH => 5,
183 TXFAWIDTH => 5)
184 port map (
185 CLK => CLK,
186 CE_MSEC => CE_MSEC,
187 RESET => RESET,
188 ENAXON => HIO_CNTL.enaxon,
189 ENAESC => HIO_CNTL.enaesc,
190 RXDATA => RXDATA,
191 RXVAL => RXVAL,
192 RXHOLD => RXHOLD,
193 TXDATA => TXDATA,
194 TXENA => TXENA,
195 TXBUSY => TXBUSY,
196 MONI => SER_MONI,
197 RXSD => RXD,
198 TXSD => TXD,
199 RXRTS_N => RTS_N,
200 TXCTS_N => CTS_N
201 );
202
203 TESTER : tst_serloop
204 port map (
205 CLK => CLK,
206 RESET => RESET,
207 CE_MSEC => CE_MSEC,
211 RXDATA => RXDATA,
212 RXVAL => RXVAL,
213 RXHOLD => RXHOLD,
214 TXDATA => TXDATA,
215 TXENA => TXENA,
216 TXBUSY => TXBUSY
217 );
218
219 -- show autobauder clock divisor on msb of display
220 DSP_DAT(31 downto 20) <= SER_MONI.abclkdiv(11 downto 0);
221 DSP_DAT(19) <= '0';
222 DSP_DAT(18 downto 16) <= SER_MONI.abclkdiv_f;
223 DSP_DP(7 downto 4) <= "0010";
224
225 -- setup unused outputs in nexys4d
226 O_RGBLED0 <= (others=>'0');
227 O_RGBLED1 <= (others=>not I_BTNRST_N);
228
229end syn;
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
TXFAWIDTH natural := 5
CDWIDTH positive := 13
in ENAESC slbit
in ENAXON slbit
in TXCTS_N slbit
RXFAWIDTH natural := 5
CDINIT natural := 15
out RXRTS_N slbit
out MONI serport_moni_type
out RXDATA slv8
out RXVAL slbit
out TXSD slbit
in RXHOLD slbit
in CE_MSEC slbit
out TXBUSY slbit
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( 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
in DSP_DP slv(( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:63
DEBOUNCE boolean := true
Definition: sn_humanio.vhd:54
out O_LED slv( LWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:66
in DSP_DAT slv( 4*( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:62
DCWIDTH positive := 2
Definition: sn_humanio.vhd:53
out SWI slv( SWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:59
in I_BTN slv( BWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:65
LWIDTH positive := 8
Definition: sn_humanio.vhd:52
in I_SWI slv( SWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:64
out O_SEG_N slv8
Definition: sn_humanio.vhd:69
SWIDTH positive := 8
Definition: sn_humanio.vhd:50
out BTN slv( BWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:60
in CLK slbit
Definition: sn_humanio.vhd:56
BWIDTH positive := 4
Definition: sn_humanio.vhd:51
out O_ANO_N slv(( 2** DCWIDTH)- 1 downto 0)
Definition: sn_humanio.vhd:67
in LED slv( LWIDTH- 1 downto 0)
Definition: sn_humanio.vhd:61
in RESET slbit := '0'
Definition: sn_humanio.vhd:57
in CE_MSEC slbit
Definition: sn_humanio.vhd:58
slv32 :=( others => '0') DSP_DAT
hio_cntl_type := hio_cntl_init HIO_CNTL
slv16 :=( others => '0') SWI
serport_moni_type := serport_moni_init SER_MONI
slv8 :=( others => '0') RXDATA
hio_stat_type := hio_stat_init HIO_STAT
slv16 :=( others => '0') LED
slv8 :=( others => '0') DSP_DP
slv5 :=( others => '0') BTN
slv8 :=( others => '0') TXDATA
in HIO_STAT hio_stat_type
in SER_MONI serport_moni_type
out HIO_CNTL hio_cntl_type
in TXBUSY slbit
Definition: tst_serloop.vhd:48
in RESET slbit
Definition: tst_serloop.vhd:37
in RXDATA slv8
Definition: tst_serloop.vhd:42
in SER_MONI serport_moni_type
Definition: tst_serloop.vhd:41
out TXDATA slv8
Definition: tst_serloop.vhd:45
in CLK slbit
Definition: tst_serloop.vhd:36
out HIO_STAT hio_stat_type
Definition: tst_serloop.vhd:40
out RXHOLD slbit
Definition: tst_serloop.vhd:44
in RXVAL slbit
Definition: tst_serloop.vhd:43
in HIO_CNTL hio_cntl_type
Definition: tst_serloop.vhd:39
out TXENA slbit
Definition: tst_serloop.vhd:46
in CE_MSEC slbit
Definition: tst_serloop.vhd:38
Definition: xlib.vhd:35