|
這裡有一段 VHDL TB 可以產生 dump file c# u8 w+ K. B/ j4 I3 Z3 l
; S: n3 E# z+ H, b uuse std.textio.all;3 t3 d1 H1 {9 y. e. Y \
use work.string.all;6 [0 H1 D$ k( A; y4 L- x7 i
architecture tb of test is
0 w9 ~% |$ y. b4 e+ e* U0 G file io_file: TEXT open WRITE_MODE is “sim_res.dump”;
3 N% o3 r9 t: p9 s! ~begin8 R( `! H. c( z/ ?% ^+ Q
writing_sims: process
8 g( Y$ C# U B7 R1 L5 l variable buf: LINE; -- predefined access type in TEXTIO0 n5 P1 o9 n9 [
begin5 o* y+ b# d, @( O# R
WRITE(buf, “Simulation results:”);2 K. Z4 E" x2 z& A" H& n. g* V
WRITELINE(io_file, buf);' r. |' c+ v$ j3 W. D1 Y: r j
loop: L( }6 n; {2 Z% a$ a3 F: W8 U
wait on CLK; -- loop execution on every clock edge
+ d- Q& M# p7 D' Z WRITE(buf, “Current time = “);
3 Y% [. R& Z3 R3 J4 E6 Z WRITE(buf, finish_clk); -- current simulation time
2 G5 |: m n# M5 j8 A2 }& F" W! y WRITE(buf, “, clock = “);5 `5 G6 ?: t/ w' p' C) _: N
WRITE(buf, clk);
6 E! p9 g* A4 L6 R: j WRITE(buf, “, in1 = “);
( p6 K" M3 W) q% f! O- O: _ WRITE(buf, in1); -- integer type
3 F* b& l9 |% f WRITE(buf, “, out1 = “);
7 _6 J; `7 ]$ q* E4 a5 i) j h WRITE(buf, out1); -- bit_vector type
4 R+ L S9 H$ R1 T& R WRITELINE(io_file, buf); -- write line to output file, n' m1 x, @9 r4 l' |. t. i: s7 _- R
end loop;
* \4 }; n0 I5 E5 e0 P# C end process writing_sims;
0 T$ u9 I7 X6 j- zend tb; |
評分
-
查看全部評分
|