w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
tb_arty_dram.vhd
Go to the documentation of this file.
1-- $Id: tb_arty_dram.vhd 1181 2019-07-08 17:00:50Z mueller $
2-- SPDX-License-Identifier: GPL-3.0-or-later
3-- Copyright 2018- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4--
5------------------------------------------------------------------------------
6-- Module Name: tb_arty_dram - sim
7-- Description: Test bench for arty (base+dram)
8--
9-- Dependencies: simlib/simclk
10-- simlib/simclkcnt
11-- rlink/tbcore/tbcore_rlink
12-- xlib/sfs_gsim_core
13-- tb_arty_core
14-- serport/tb/serport_master_tb
15-- arty_dram_aif [UUT]
16--
17-- To test: generic, any arty_dram_aif target
18--
19-- Target Devices: generic
20-- Tool versions: viv 2017.2; ghdl 0.34
21--
22-- Revision History:
23-- Date Rev Version Comment
24-- 2018-11-03 1064 1.1.1 use sfs_gsim_core
25-- 2018-10-28 1063 1.0 Initial version (derived from tb_arty)
26------------------------------------------------------------------------------
27
28library ieee;
29use ieee.std_logic_1164.all;
30use ieee.numeric_std.all;
31use ieee.std_logic_textio.all;
32use std.textio.all;
33
34use work.slvtypes.all;
35use work.rlinklib.all;
36use work.xlib.all;
37use work.artylib.all;
38use work.simlib.all;
39use work.simbus.all;
40use work.sys_conf.all;
41
42entity tb_arty_dram is
43end tb_arty_dram;
44
45architecture sim of tb_arty_dram is
46
47 signal CLKOSC : slbit := '0'; -- board clock (100 Mhz)
48 signal CLKCOM : slbit := '0'; -- communication clock
49
50 signal CLKCOM_CYCLE : integer := 0;
51
52 signal RESET : slbit := '0';
53 signal CLKDIV : slv2 := "00"; -- run with 1 clocks / bit !!
54 signal RXDATA : slv8 := (others=>'0');
55 signal RXVAL : slbit := '0';
56 signal RXERR : slbit := '0';
57 signal RXACT : slbit := '0';
58 signal TXDATA : slv8 := (others=>'0');
59 signal TXENA : slbit := '0';
60 signal TXBUSY : slbit := '0';
61
62 signal I_RXD : slbit := '1';
63 signal O_TXD : slbit := '1';
64 signal I_SWI : slv4 := (others=>'0');
65 signal I_BTN : slv4 := (others=>'0');
66 signal O_LED : slv4 := (others=>'0');
67 signal O_RGBLED0 : slv3 := (others=>'0');
68 signal O_RGBLED1 : slv3 := (others=>'0');
69 signal O_RGBLED2 : slv3 := (others=>'0');
70 signal O_RGBLED3 : slv3 := (others=>'0');
71
72 signal IO_DDR3_DQ : slv16 := (others=>'Z');
73 signal IO_DDR3_DQS_P : slv2 := (others=>'Z');
74 signal IO_DDR3_DQS_N : slv2 := (others=>'Z');
75
76 signal R_PORTSEL_XON : slbit := '0'; -- if 1 use xon/xoff
77
78 constant sbaddr_portsel: slv8 := slv(to_unsigned( 8,8));
79
80 constant clock_period : Delay_length := 10 ns;
81 constant clock_offset : Delay_length := 200 ns;
82
83begin
84
85 GINIT : entity work.gsr_pulse;
86
87 CLKGEN : simclk
88 generic map (
91 port map (
92 CLK => CLKOSC
93 );
94
95 CLKGEN_COM : sfs_gsim_core
96 generic map (
97 VCO_DIVIDE => sys_conf_clkser_vcodivide,
98 VCO_MULTIPLY => sys_conf_clkser_vcomultiply,
99 OUT_DIVIDE => sys_conf_clkser_outdivide)
100 port map (
101 CLKIN => CLKOSC,
102 CLKFX => CLKCOM,
103 LOCKED => open
104 );
105
106 CLKCNT : simclkcnt port map (CLK => CLKCOM, CLK_CYCLE => CLKCOM_CYCLE);
107
108 TBCORE : entity work.tbcore_rlink
109 port map (
110 CLK => CLKCOM,
111 RX_DATA => TXDATA,
112 RX_VAL => TXENA,
113 RX_HOLD => TXBUSY,
114 TX_DATA => RXDATA,
115 TX_ENA => RXVAL
116 );
117
118 ARTYCORE : entity work.tb_arty_core
119 port map (
120 I_SWI => I_SWI,
121 I_BTN => I_BTN
122 );
123
124 UUT : arty_dram_aif
125 port map (
126 I_CLK100 => CLKOSC,
127 I_RXD => I_RXD,
128 O_TXD => O_TXD,
129 I_SWI => I_SWI,
130 I_BTN => I_BTN,
131 O_LED => O_LED,
132 O_RGBLED0 => O_RGBLED0,
133 O_RGBLED1 => O_RGBLED1,
134 O_RGBLED2 => O_RGBLED2,
135 O_RGBLED3 => O_RGBLED3,
136 A_VPWRN => (others=>'0'),
137 A_VPWRP => (others=>'0'),
138 DDR3_DQ => IO_DDR3_DQ,
139 DDR3_DQS_P => IO_DDR3_DQS_P,
140 DDR3_DQS_N => IO_DDR3_DQS_N,
141 DDR3_ADDR => open,
142 DDR3_BA => open,
143 DDR3_RAS_N => open,
144 DDR3_CAS_N => open,
145 DDR3_WE_N => open,
146 DDR3_RESET_N => open,
147 DDR3_CK_P => open,
148 DDR3_CK_N => open,
149 DDR3_CKE => open,
150 DDR3_CS_N => open,
151 DDR3_DM => open,
152 DDR3_ODT => open
153 );
154
155 SERMSTR : entity work.serport_master_tb
156 generic map (
157 CDWIDTH => CLKDIV'length)
158 port map (
159 CLK => CLKCOM,
160 RESET => RESET,
161 CLKDIV => CLKDIV,
163 ENAESC => '0',
164 RXDATA => RXDATA,
165 RXVAL => RXVAL,
166 RXERR => RXERR,
167 RXOK => '1',
168 TXDATA => TXDATA,
169 TXENA => TXENA,
170 TXBUSY => TXBUSY,
171 RXSD => O_TXD,
172 TXSD => I_RXD,
173 RXRTS_N => open,
174 TXCTS_N => '0'
175 );
176
177 proc_moni: process
178 variable oline : line;
179 begin
180
181 loop
182 wait until rising_edge(CLKCOM);
183
184 if RXERR = '1' then
185 writetimestamp(oline, CLKCOM_CYCLE, " : seen RXERR=1");
186 writeline(output, oline);
187 end if;
188
189 end loop;
190
191 end process proc_moni;
192
193 --
194 -- Notes on portsel and XON control:
195 -- - most arty designs will use hardwired XON=1
196 -- - but some (especially basis tests) might not use flow control
197 -- - that's why XON flow control must be optional and configurable !
198 --
199 proc_simbus: process (SB_VAL)
200 begin
201 if SB_VAL'event and to_x01(SB_VAL)='1' then
202 if SB_ADDR = sbaddr_portsel then
203 R_PORTSEL_XON <= to_x01(SB_DATA(1));
204 end if;
205 end if;
206 end process proc_simbus;
207
208end 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'
VCO_DIVIDE positive := 1
OUT_DIVIDE positive := 1
in CLKIN slbit
VCO_MULTIPLY positive := 1
out LOCKED slbit
out CLKFX slbit
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( 2 downto 0) slv3
Definition: slvtypes.vhd:35
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
std_logic_vector slv
Definition: slvtypes.vhd:31
out I_SWI slv4
out I_BTN slv4
slbit := '0' RXERR
slbit := '0' RESET
slv4 :=( others => '0') I_SWI
integer := 0 CLKCOM_CYCLE
Delay_length := 10 ns clock_period
slv2 := "00" CLKDIV
slv4 :=( others => '0') I_BTN
slbit := '0' TXENA
slv8 :=( others => '0') RXDATA
Delay_length := 200 ns clock_offset
slv3 :=( others => '0') O_RGBLED2
slbit := '0' RXACT
slbit := '0' RXVAL
slbit := '1' O_TXD
slv8 := slv( to_unsigned( 8, 8) ) sbaddr_portsel
slv3 :=( others => '0') O_RGBLED1
slbit := '0' CLKOSC
slv2 :=( others => 'Z') IO_DDR3_DQS_N
slv3 :=( others => '0') O_RGBLED3
slbit := '0' CLKCOM
slbit := '0' TXBUSY
slv3 :=( others => '0') O_RGBLED0
slbit := '0' R_PORTSEL_XON
slv16 :=( others => 'Z') IO_DDR3_DQ
slv8 :=( others => '0') TXDATA
slv4 :=( others => '0') O_LED
slbit := '1' I_RXD
slv2 :=( others => 'Z') IO_DDR3_DQS_P
Definition: xlib.vhd:35