|
這裡有一段 VHDL TB 可以產生 dump file
: l9 @& J1 w8 R$ `# D7 V3 y( z% h! L& v8 D# j0 G1 { q2 C; q
use std.textio.all;
4 x5 \2 F6 Q8 K' }, X! Z4 c% |use work.string.all;8 B* Q9 F1 T% f1 F h
architecture tb of test is, J* s3 T/ W7 U# U- E) Z, V
file io_file: TEXT open WRITE_MODE is “sim_res.dump”;
# r$ ?, m6 K2 G; \$ |begin C* \* u6 H3 R& Y$ J
writing_sims: process
# x' F* S( B6 c+ [7 j% J2 D6 j3 y variable buf: LINE; -- predefined access type in TEXTIO7 D q1 T7 ]: R" i6 v7 |2 j
begin6 ?0 G; o) z& u+ C+ t# Q
WRITE(buf, “Simulation results:”);
r5 h: n( I# n WRITELINE(io_file, buf);" T" N1 G6 c$ N$ L& o
loop4 Q9 X* M, ?+ f: t; l2 q |# U
wait on CLK; -- loop execution on every clock edge5 _+ |, {- p1 o3 P. o. \& q
WRITE(buf, “Current time = “);$ g9 `5 m0 K" n
WRITE(buf, finish_clk); -- current simulation time
- T1 ^2 P% E3 l! p; v* t5 b4 F WRITE(buf, “, clock = “);
3 M; J F$ |5 u& ?; O5 Z0 [% v WRITE(buf, clk);
: A$ l; K3 o; ~ WRITE(buf, “, in1 = “);
0 r* _/ Y% g8 L3 ~6 Z$ V WRITE(buf, in1); -- integer type
U& q/ W6 B; Q& J3 V WRITE(buf, “, out1 = “);
) q' H* ?: P5 o l g, I WRITE(buf, out1); -- bit_vector type) }! ~( m* o- ^) s& ?
WRITELINE(io_file, buf); -- write line to output file
4 K2 [8 x# k, z% }* u% N# \$ q- D end loop;
, O) T8 H6 I- Y: D% u7 i- q$ f end process writing_sims;
! k; `2 y2 ?9 C- w5 H Mend tb; |
評分
-
查看全部評分
|