w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
tb_s3board.vhd
Go to the documentation of this file.
1-- $Id: tb_s3board.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2007-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: tb_s3board - sim
7-- Description: Test bench for s3board (base)
8--
9-- Dependencies: simlib/simclk
10-- simlib/simclkcnt
11-- rlink/tbcore/tbcore_rlink
12-- tb_s3board_core
13-- s3board_aif [UUT]
14-- serport/tb/serport_master_tb
15--
16-- To test: generic, any s3board_aif target
17--
18-- Target Devices: generic
19-- Tool versions: xst 8.2-14.7; ghdl 0.18-0.33
20-- Revision History:
21-- Date Rev Version Comment
22-- 2016-09-02 805 3.2.3 tbcore_rlink without CLK_STOP now
23-- 2016-02-13 730 3.2.2 direct instantiation of tbcore_rlink
24-- 2016-01-03 724 3.2.1 use serport/tb/serport_master_tb
25-- 2015-04-12 666 3.2 use serport_master instead of serport_uart_rxtx
26-- 2011-12-23 444 3.1 new system clock scheme, new tbcore_rlink iface
27-- 2011-11-21 432 3.0.1 now numeric_std clean
28-- 2010-12-30 351 3.0 use rlink/tb now
29-- 2010-11-06 336 2.0.3 rename input pin CLK -> I_CLK50
30-- 2010-05-28 295 2.0.2 use serport_uart_rxtx
31-- 2010-05-01 286 2.0.1 use rritb_core as component again (rriv1 is gone..)
32-- 2010-04-25 283 2.0 factor out basic device handling to tb_s3board_core
33-- and_conf/_stim file processing to rri/tb/rritb_core
34-- 2010-04-24 281 1.3.2 use serport_uart_[tr]x directly again
35-- 2007-12-16 101 1.3.1 use _N for active low, add sram memory model
36-- 2007-12-09 100 1.3 add sram memory signals
37-- 2007-11-23 97 1.2 use serport_uart_[tr]x_tb to allow that UUT is a
38-- [sft]sim model compiled with keep hierarchy
39-- 2007-10-26 92 1.1.1 use DONE timestamp at end of execution
40-- 2007-10-19 90 1.1 avoid ieee.std_logic_unsigned, use cast to unsigned
41-- use CLKDIV="00 --> sim with max. serport speed
42-- 2007-09-23 85 1.0 Initial version
43------------------------------------------------------------------------------
44
45library ieee;
46use ieee.std_logic_1164.all;
47use ieee.numeric_std.all;
48use ieee.std_logic_textio.all;
49use std.textio.all;
50
51use work.slvtypes.all;
52use work.rlinklib.all;
53use work.s3boardlib.all;
54use work.simlib.all;
55use work.simbus.all;
56
57entity tb_s3board is
58end tb_s3board;
59
60architecture sim of tb_s3board is
61
62 signal CLK : slbit := '0';
63
64 signal CLK_CYCLE : integer := 0;
65
66 signal RESET : slbit := '0';
67 signal CLKDIV : slv2 := "00"; -- run with 1 clocks / bit !!
68 signal RXDATA : slv8 := (others=>'0');
69 signal RXVAL : slbit := '0';
70 signal RXERR : slbit := '0';
71 signal RXACT : slbit := '0';
72 signal TXDATA : slv8 := (others=>'0');
73 signal TXENA : slbit := '0';
74 signal TXBUSY : slbit := '0';
75
76 signal I_RXD : slbit := '1';
77 signal O_TXD : slbit := '1';
78 signal I_SWI : slv8 := (others=>'0');
79 signal I_BTN : slv4 := (others=>'0');
80 signal O_LED : slv8 := (others=>'0');
81 signal O_ANO_N : slv4 := (others=>'0');
82 signal O_SEG_N : slv8 := (others=>'0');
83 signal O_MEM_CE_N : slv2 := (others=>'1');
84 signal O_MEM_BE_N : slv4 := (others=>'1');
85 signal O_MEM_WE_N : slbit := '1';
86 signal O_MEM_OE_N : slbit := '1';
87 signal O_MEM_ADDR : slv18 := (others=>'Z');
88 signal IO_MEM_DATA : slv32 := (others=>'0');
89
90 signal R_PORTSEL_XON : slbit := '0'; -- if 1 use xon/xoff
91
92 constant sbaddr_portsel: slv8 := slv(to_unsigned( 8,8));
93
94 constant clock_period : Delay_length := 20 ns;
95 constant clock_offset : Delay_length := 200 ns;
96
97begin
98
99 CLKGEN : simclk
100 generic map (
103 port map (
104 CLK => CLK
105 );
106
107 CLKCNT : simclkcnt port map (CLK => CLK, CLK_CYCLE => CLK_CYCLE);
108
109 TBCORE : entity work.tbcore_rlink
110 port map (
111 CLK => CLK,
112 RX_DATA => TXDATA,
113 RX_VAL => TXENA,
114 RX_HOLD => TXBUSY,
115 TX_DATA => RXDATA,
116 TX_ENA => RXVAL
117 );
118
119 S3CORE : entity work.tb_s3board_core
120 port map (
121 I_SWI => I_SWI,
122 I_BTN => I_BTN,
129 );
130
131 UUT : s3board_aif
132 port map (
133 I_CLK50 => CLK,
134 I_RXD => I_RXD,
135 O_TXD => O_TXD,
136 I_SWI => I_SWI,
137 I_BTN => I_BTN,
138 O_LED => O_LED,
139 O_ANO_N => O_ANO_N,
140 O_SEG_N => O_SEG_N,
141 O_MEM_CE_N => O_MEM_CE_N,
142 O_MEM_BE_N => O_MEM_BE_N,
143 O_MEM_WE_N => O_MEM_WE_N,
144 O_MEM_OE_N => O_MEM_OE_N,
145 O_MEM_ADDR => O_MEM_ADDR,
146 IO_MEM_DATA => IO_MEM_DATA
147 );
148
149 SERMSTR : entity work.serport_master_tb
150 generic map (
151 CDWIDTH => CLKDIV'length)
152 port map (
153 CLK => CLK,
154 RESET => RESET,
155 CLKDIV => CLKDIV,
157 ENAESC => '0',
158 RXDATA => RXDATA,
159 RXVAL => RXVAL,
160 RXERR => RXERR,
161 RXOK => '1',
162 TXDATA => TXDATA,
163 TXENA => TXENA,
164 TXBUSY => TXBUSY,
165 RXSD => O_TXD,
166 TXSD => I_RXD,
167 RXRTS_N => open,
168 TXCTS_N => '0'
169 );
170
171 proc_moni: process
172 variable oline : line;
173 begin
174
175 loop
176 wait until rising_edge(CLK);
177
178 if RXERR = '1' then
179 writetimestamp(oline, CLK_CYCLE, " : seen RXERR=1");
180 writeline(output, oline);
181 end if;
182
183 end loop;
184
185 end process proc_moni;
186
187 proc_simbus: process (SB_VAL)
188 begin
189 if SB_VAL'event and to_x01(SB_VAL)='1' then
190 if SB_ADDR = sbaddr_portsel then
191 R_PORTSEL_XON <= to_x01(SB_DATA(1));
192 end if;
193 end if;
194 end process proc_simbus;
195
196end sim;
CDWIDTH positive := 13
in ENAESC slbit := '0'
in ENAXON slbit := '0'
in CLKDIV slv( CDWIDTH- 1 downto 0)
in RXOK slbit := '1'
in TXCTS_N slbit := '0'
out CLK slbit
Definition: simclk.vhd:33
OFFSET Delay_length := 200 ns
Definition: simclk.vhd:31
PERIOD Delay_length := 20 ns
Definition: simclk.vhd:30
out CLK_CYCLE integer
Definition: simclkcnt.vhd:29
in CLK slbit
Definition: simclkcnt.vhd:27
std_logic_vector( 3 downto 0) slv4
Definition: slvtypes.vhd:36
std_logic_vector( 17 downto 0) slv18
Definition: slvtypes.vhd:51
std_logic_vector( 31 downto 0) slv32
Definition: slvtypes.vhd:59
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
std_logic_vector slv
Definition: slvtypes.vhd:31
slbit := '0' RXERR
Definition: tb_s3board.vhd:70
slbit := '0' RESET
Definition: tb_s3board.vhd:66
slv8 :=( others => '0') O_SEG_N
Definition: tb_s3board.vhd:82
slv4 :=( others => '1') O_MEM_BE_N
Definition: tb_s3board.vhd:84
slv2 := "00" CLKDIV
Definition: tb_s3board.vhd:67
slv4 :=( others => '0') I_BTN
Definition: tb_s3board.vhd:79
slbit := '0' TXENA
Definition: tb_s3board.vhd:73
slv8 :=( others => '0') RXDATA
Definition: tb_s3board.vhd:68
Delay_length := 200 ns clock_offset
Definition: tb_s3board.vhd:95
slv8 :=( others => '0') O_LED
Definition: tb_s3board.vhd:80
slv18 :=( others => 'Z') O_MEM_ADDR
Definition: tb_s3board.vhd:87
slbit := '0' CLK
Definition: tb_s3board.vhd:62
slbit := '0' RXACT
Definition: tb_s3board.vhd:71
slbit := '0' RXVAL
Definition: tb_s3board.vhd:69
slv32 :=( others => '0') IO_MEM_DATA
Definition: tb_s3board.vhd:88
slbit := '1' O_TXD
Definition: tb_s3board.vhd:77
slv8 := slv( to_unsigned( 8, 8) ) sbaddr_portsel
Definition: tb_s3board.vhd:92
integer := 0 CLK_CYCLE
Definition: tb_s3board.vhd:64
slv2 :=( others => '1') O_MEM_CE_N
Definition: tb_s3board.vhd:83
slbit := '1' O_MEM_OE_N
Definition: tb_s3board.vhd:86
slv8 :=( others => '0') I_SWI
Definition: tb_s3board.vhd:78
slbit := '0' TXBUSY
Definition: tb_s3board.vhd:74
slv4 :=( others => '0') O_ANO_N
Definition: tb_s3board.vhd:81
slbit := '0' R_PORTSEL_XON
Definition: tb_s3board.vhd:90
slbit := '1' O_MEM_WE_N
Definition: tb_s3board.vhd:85
slv8 :=( others => '0') TXDATA
Definition: tb_s3board.vhd:72
Delay_length := 20 ns clock_period
Definition: tb_s3board.vhd:94
slbit := '1' I_RXD
Definition: tb_s3board.vhd:76
inout IO_MEM_DATA slv32
in O_MEM_WE_N slbit
in O_MEM_ADDR slv18
in O_MEM_OE_N slbit