|
這裡有一段 VHDL TB 可以產生 dump file " _1 T. `4 i1 z3 [; s+ L$ h) W
+ k4 q2 [- S0 Z, ]; }5 A* V, H
use std.textio.all;7 u f6 S5 j# c/ [% s" g8 Q+ w. k
use work.string.all;
* J2 n& [' Z" }$ k! f7 narchitecture tb of test is
5 M5 ^* a, _; i) z4 i/ d file io_file: TEXT open WRITE_MODE is “sim_res.dump”;
! |: E- R+ u gbegin( M# u, `% @; y
writing_sims: process0 T# z8 S+ Z" {$ _
variable buf: LINE; -- predefined access type in TEXTIO: Z; W r9 z5 _& M* h
begin* p$ w6 X( f0 k7 f! I8 L1 _
WRITE(buf, “Simulation results:”);
0 c Y" N& L9 H; u WRITELINE(io_file, buf);
7 e4 z8 [# u/ |5 a0 v7 l( F! y loop7 n# [! |, O4 m' ]# @+ i5 u
wait on CLK; -- loop execution on every clock edge
: z* r' K) A: w WRITE(buf, “Current time = “);2 `% a x6 \0 H. y
WRITE(buf, finish_clk); -- current simulation time
1 n$ z0 ]# R2 R WRITE(buf, “, clock = “);' W" \, s: _" M$ q9 _& H4 ]9 \4 O
WRITE(buf, clk);4 Z2 ?: m) ^- q
WRITE(buf, “, in1 = “);0 D: I6 {1 t/ S. J! W; ^
WRITE(buf, in1); -- integer type7 B) q l: j* ]
WRITE(buf, “, out1 = “);
" V7 E. `( K/ K: z WRITE(buf, out1); -- bit_vector type& E5 h' P1 ^! g2 y/ g: L
WRITELINE(io_file, buf); -- write line to output file3 ?3 `/ }, {, n) p1 X% _) p
end loop;1 o# j! o& ^0 Q: a3 P
end process writing_sims;$ \8 _# j5 x* Q+ s9 `0 P2 o, }+ p2 H& m
end tb; |
評分
-
查看全部評分
|