w11 - vhd 0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
tb_mt45w8mw16b.vhd
Go to the documentation of this file.
1-- $Id: tb_mt45w8mw16b.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: tb_mt45w8mw16b - sim
7-- Description: Test bench for mt45w8mw16b memory model
8--
9-- Dependencies: mt45w8mw16b [UUT]
10-- simlib/simbididly
11--
12-- To test: mt45w8mw16b
13--
14-- Verified (with tb_mt45w8mw16b_stim.dat):
15-- Date Rev Code ghdl ise Target Comment
16-- 2016-07-16 787 - 0.33 - - c:ok
17-- 2010-05-16 291 - 0.26 - - c:ok
18--
19-- Revision History:
20-- Date Rev Version Comment
21-- 2016-07-16 787 1.2 test also CRE; use simbididly;
22-- 2011-11-21 432 1.1.1 now numeric_std clean
23-- 2010-05-16 291 1.0 Initial version (cloned from tb_is61lv25616al)
24------------------------------------------------------------------------------
25
26library ieee;
27use ieee.std_logic_1164.all;
28use ieee.numeric_std.all;
29use ieee.std_logic_textio.all;
30use std.textio.all;
31
32use work.slvtypes.all;
33use work.simlib.all;
34
37
38architecture sim of tb_mt45w8mw16b is
39
40 constant pcb_delay : Delay_length := 1 ns;
41
42 signal MM_CE_N : slbit := '1';
43 signal MM_OE_N : slbit := '1';
44 signal MM_WE_N : slbit := '1';
45 signal MM_UB_N : slbit := '1';
46 signal MM_LB_N : slbit := '1';
47 signal MM_CRE : slbit := '0';
48 signal MM_MWAIT : slbit := '0';
49 signal MM_ADDR : slv23 := (others=>'0');
50 signal MM_DATA : slv16 := (others=>'Z');
51
52 signal TB_CE_N : slbit := '1';
53 signal TB_OE_N : slbit := '1';
54 signal TB_WE_N : slbit := '1';
55 signal TB_UB_N : slbit := '1';
56 signal TB_LB_N : slbit := '1';
57 signal TB_CRE : slbit := '0';
58 signal TB_MWAIT : slbit := '0';
59 signal TB_ADDR : slv23 := (others=>'0');
60 signal TB_DATA : slv16 := (others=>'Z');
61
62begin
63
64 UUT : entity work.mt45w8mw16b
65 port map (
66 CLK => '0',
67 CE_N => MM_CE_N,
68 OE_N => MM_OE_N,
69 WE_N => MM_WE_N,
70 UB_N => MM_UB_N,
71 LB_N => MM_LB_N,
72 ADV_N => '0',
73 CRE => MM_CRE,
74 MWAIT => MM_MWAIT,
75 ADDR => MM_ADDR,
76 DATA => MM_DATA
77 );
78
79 MM_CE_N <= TB_CE_N after pcb_delay;
80 MM_OE_N <= TB_OE_N after pcb_delay;
81 MM_WE_N <= TB_WE_N after pcb_delay;
82 MM_UB_N <= TB_UB_N after pcb_delay;
83 MM_LB_N <= TB_LB_N after pcb_delay;
84 MM_CRE <= TB_CRE after pcb_delay;
85 MM_ADDR <= TB_ADDR after pcb_delay;
87
88 BUSDLY: simbididly
89 generic map (
91 DWIDTH => 16)
92 port map (
93 A => TB_DATA,
95
96 proc_stim: process
97 file fstim : text open read_mode is "tb_mt45w8mw16b_stim";
98 variable iline : line;
99 variable oline : line;
100 variable ok : boolean;
101 variable dname : string(1 to 6) := (others=>' ');
102 variable idtime : Delay_length := 0 ns;
103 variable imatch : boolean := false;
104 variable ival : slbit := '0';
105 variable ival2 : slv2 := (others=>'0');
106 variable ival16 : slv16 := (others=>'0');
107 variable ival23 : slv23 := (others=>'0');
108 variable ice : slbit := '0';
109 variable ioe : slbit := '0';
110 variable iwe : slbit := '0';
111 variable ibe : slv2 := "00";
112 variable icre : slbit := '0';
113 variable iaddr : slv23 := (others=>'0');
114 variable idata : slv16 := (others=>'0');
115 variable ide : slbit := '0';
116 variable idchk : slv16 := (others=>'0');
117
118 begin
119
120 -- initial signal driver settings
121 TB_CE_N <= '1';
122 TB_OE_N <= '1';
123 TB_WE_N <= '1';
124 TB_UB_N <= '1';
125 TB_LB_N <= '1';
126 TB_CRE <= '0';
127 TB_ADDR <= (others=>'0');
128 TB_DATA <= (others=>'Z');
129
130 file_loop: while not endfile(fstim) loop
131
132 readline (fstim, iline);
133
134 readcomment(iline, ok);
135 next file_loop when ok;
136
137 readword(iline, dname, ok);
138 if ok then
139 case dname is
140 when "wdo " => -- wdo
141 read_ea(iline, idtime);
142 wait for idtime;
143
144 readtagval_ea(iline, "ce", imatch, ival);
145 if imatch then ice := ival; end if;
146 readtagval_ea(iline, "cre", imatch, ival);
147 if imatch then icre := ival; end if;
148 readtagval_ea(iline, "oe", imatch, ival);
149 if imatch then ioe := ival; end if;
150 readtagval_ea(iline, "we", imatch, ival);
151 if imatch then iwe := ival; end if;
152 readtagval_ea(iline, "be", imatch, ival2, 2);
153 if imatch then ibe := ival2; end if;
154 readtagval_ea(iline, "a", imatch, ival23, 16);
155 if imatch then iaddr := ival23; end if;
156 readtagval_ea(iline, "de", imatch, ival);
157 if imatch then ide := ival; end if;
158 readtagval_ea(iline, "d", imatch, ival16, 16);
159 if imatch then idata := ival16; end if;
160
161 TB_CE_N <= not ice;
162 TB_OE_N <= not ioe;
163 TB_WE_N <= not iwe;
164 TB_LB_N <= not ibe(0);
165 TB_UB_N <= not ibe(1);
166 TB_CRE <= icre;
167 TB_ADDR <= iaddr;
168 if ide = '1' then
169 TB_DATA <= idata;
170 else
171 TB_DATA <= (others=>'Z');
172 end if;
173
174 write(oline, now, right, 12);
175 write(oline, string'(": wdo "));
176 write(oline, string'(" ce="));
177 write(oline, ice);
178 write(oline, string'(" oe="));
179 write(oline, ioe);
180 write(oline, string'(" we="));
181 write(oline, iwe);
182 if icre = '0' then
183 write(oline, string'(" be="));
184 write(oline, ibe, right, 2);
185 else
186 write(oline, string'(" cre=1"));
187 end if;
188 write(oline, string'(" a="));
189 writegen(oline, iaddr, right, 6, 16);
190 write(oline, string'(" de="));
191 write(oline, ide);
192 if ide = '1' then
193 write(oline, string'(" d="));
194 writegen(oline, idata, right, 4, 16);
195 end if;
196
197 readtagval_ea(iline, "D", imatch, idchk, 16);
198 if imatch then
199 write(oline, string'(" D="));
200 writegen(oline, TB_DATA, right, 4, 16);
201 write(oline, string'(" CHECK"));
202 if TB_DATA = idchk then
203 write(oline, string'(" OK"));
204 else
205 write(oline, string'(" FAIL exp="));
206 writegen(oline, idchk, right, 4, 16);
207 end if;
208 end if;
209
210 writeline(output, oline);
211
212 when others => -- unknown command
213 write(oline, string'("?? unknown command: "));
214 write(oline, dname);
215 writeline(output, oline);
216 report "aborting" severity failure;
217 end case;
218
219 else
220 report "failed to find command" severity failure;
221
222 end if;
223
224 testempty_ea(iline);
225
226 end loop;
227
228 write(oline, now, right, 12);
229 write(oline, string'(": DONE"));
230 writeline(output, oline);
231
232 wait; -- suspend proc_stim forever
233 -- no clock, sim will end
234
235 end process proc_stim;
236
237
238end sim;
in UB_N slbit
Definition: mt45w8mw16b.vhd:64
in CRE slbit
Definition: mt45w8mw16b.vhd:67
in WE_N slbit
Definition: mt45w8mw16b.vhd:63
in CLK slbit
Definition: mt45w8mw16b.vhd:60
out MWAIT slbit
Definition: mt45w8mw16b.vhd:68
in CE_N slbit
Definition: mt45w8mw16b.vhd:61
in OE_N slbit
Definition: mt45w8mw16b.vhd:62
in ADV_N slbit
Definition: mt45w8mw16b.vhd:66
in LB_N slbit
Definition: mt45w8mw16b.vhd:65
inout DATA slv16
Definition: mt45w8mw16b.vhd:71
in ADDR slv23
Definition: mt45w8mw16b.vhd:69
inout B slv( DWIDTH- 1 downto 0)
Definition: simbididly.vhd:32
inout A slv( DWIDTH- 1 downto 0)
Definition: simbididly.vhd:30
DELAY Delay_length
Definition: simbididly.vhd:27
DWIDTH positive := 16
Definition: simbididly.vhd:28
std_logic_vector( 22 downto 0) slv23
Definition: slvtypes.vhd:56
std_logic_vector( 15 downto 0) slv16
Definition: slvtypes.vhd:48
std_logic slbit
Definition: slvtypes.vhd:30
std_logic_vector( 1 downto 0) slv2
Definition: slvtypes.vhd:34
slbit := '1' TB_LB_N
slbit := '0' MM_CRE
slbit := '1' MM_LB_N
slv16 :=( others => 'Z') MM_DATA
slbit := '0' TB_MWAIT
slv16 :=( others => 'Z') TB_DATA
slbit := '1' TB_CE_N
slbit := '1' TB_WE_N
slbit := '0' MM_MWAIT
slbit := '1' MM_OE_N
slbit := '1' MM_UB_N
Delay_length := 1 ns pcb_delay
slbit := '1' MM_WE_N
slbit := '0' TB_CRE
slbit := '1' TB_OE_N
slbit := '1' MM_CE_N
slv23 :=( others => '0') TB_ADDR
slv23 :=( others => '0') MM_ADDR
slbit := '1' TB_UB_N