|
這裡有一段 VHDL TB 可以產生 dump file + L! G) F% r; F" e2 s
# o) t" S, f7 F3 {5 s
use std.textio.all;1 {- k7 V1 B8 y/ L% D5 H7 q
use work.string.all;& @* k0 o3 i! O
architecture tb of test is; p- G C7 S0 R5 I) ^) K3 x
file io_file: TEXT open WRITE_MODE is “sim_res.dump”;0 o% e4 ^. F; H$ a( E
begin
; I; p8 Q% q* z$ B4 B$ `" I writing_sims: process
. K( u6 ]( t# f1 Z/ F variable buf: LINE; -- predefined access type in TEXTIO; C: y) f' \+ C) P- y
begin. I, r6 b7 o; K) v
WRITE(buf, “Simulation results:”);3 F( B" v" l1 V: I& r- {
WRITELINE(io_file, buf);
( K: m/ E; | _7 o a6 B loop5 G5 E% l2 a0 W& h; o0 @1 |
wait on CLK; -- loop execution on every clock edge \; X/ V' b) H$ q! \6 t+ a4 \
WRITE(buf, “Current time = “);
( d4 t1 |& d& X; r1 o WRITE(buf, finish_clk); -- current simulation time
& n. w% |( W1 S0 Z& g# y/ N WRITE(buf, “, clock = “);% `$ D* Q [7 r* g. M
WRITE(buf, clk);
+ M) ~, r& j: O2 J2 {: [ WRITE(buf, “, in1 = “);. W* X9 f# B* V# ^3 o
WRITE(buf, in1); -- integer type
0 ]1 r$ R) ]( v WRITE(buf, “, out1 = “);0 I" N& D: x$ y- d e! I
WRITE(buf, out1); -- bit_vector type# o7 G, G8 @/ a: p6 U
WRITELINE(io_file, buf); -- write line to output file
0 m/ n) R0 U+ J4 j' x end loop;$ @5 G/ D) s4 V# v5 ^( i
end process writing_sims;) b8 M/ G( |# \2 z4 a
end tb; |
評分
-
查看全部評分
|