|
這裡有一段 VHDL TB 可以產生 dump file ' h- i, p( t) g
4 i ]5 p% {1 y: G7 U2 r; u3 |
use std.textio.all;0 W% @0 t8 S% {* w" x
use work.string.all;' N# F% s7 v x
architecture tb of test is
[" i) [; p: }9 V! l, P/ t file io_file: TEXT open WRITE_MODE is “sim_res.dump”;( i- q- r6 P( x4 N5 l+ ?* T' z
begin/ N7 J5 @( w6 F# s& q
writing_sims: process2 p6 C1 N. t7 i$ Z
variable buf: LINE; -- predefined access type in TEXTIO
- R& a; D* u- X. R2 }+ }" D begin' v4 h* h4 g# M7 S# F/ d$ E
WRITE(buf, “Simulation results:”);3 n3 t5 Z% n& |
WRITELINE(io_file, buf);) R+ l5 a" N* n l
loop+ G+ K! o* h1 a+ A. `9 P6 w
wait on CLK; -- loop execution on every clock edge
( a3 ?3 k* s; u, h3 b WRITE(buf, “Current time = “);
* w! R; h/ D0 Y% G WRITE(buf, finish_clk); -- current simulation time( \, F, `# A* Y/ O
WRITE(buf, “, clock = “);
8 W3 n; T) r" D1 W WRITE(buf, clk);6 x8 W0 k O- v; H* Y5 d
WRITE(buf, “, in1 = “);1 E2 X9 y" j2 |
WRITE(buf, in1); -- integer type
Z# Z, J" y; s' a% `) V WRITE(buf, “, out1 = “);
5 F$ [2 z" X( Q6 V \$ d9 x9 J WRITE(buf, out1); -- bit_vector type
1 @! C% z; ?$ R, L WRITELINE(io_file, buf); -- write line to output file" g0 Z4 y$ S6 z/ ?8 ]1 N: i$ s
end loop;
, o1 L5 o+ ?! d3 V- C4 U: E end process writing_sims;/ D) `, K D1 Z. |. e6 m. C
end tb; |
評分
-
查看全部評分
|