|
這裡有一段 VHDL TB 可以產生 dump file
; @+ s7 H1 r( U T1 L# |$ q- h, }- _0 t G
use std.textio.all;8 ~% n( {& P6 A' }; b- Y. \
use work.string.all;
' J Q) ^ V% o. o* r% jarchitecture tb of test is
+ O$ O# |* v! v6 n( V file io_file: TEXT open WRITE_MODE is “sim_res.dump”;0 x0 k6 d) M2 F2 E2 a8 L2 y
begin$ t& h# w8 t$ L1 l, _) A) n
writing_sims: process
0 X W7 b' j; Q/ e" W9 L variable buf: LINE; -- predefined access type in TEXTIO
' b% R$ E, Y- w: F begin- c+ l$ l7 K( G. [
WRITE(buf, “Simulation results:”);0 {" u- B$ b! V% N2 Y' }/ J; [
WRITELINE(io_file, buf);
/ r' E) Y4 W6 Z- `' a- X loop
1 v+ @8 w9 H# f7 d( k* I8 R wait on CLK; -- loop execution on every clock edge
w9 _( V, y8 T& F WRITE(buf, “Current time = “);7 f. S4 ]+ K9 S, t; K
WRITE(buf, finish_clk); -- current simulation time
; V2 H9 T: h9 M; w WRITE(buf, “, clock = “);! d' m; Z& O, m/ l) E
WRITE(buf, clk);. J2 j4 O& [0 s4 S+ R9 c3 `
WRITE(buf, “, in1 = “);
, J B1 K5 M5 Z1 _/ F& u# K WRITE(buf, in1); -- integer type
3 n) ]) x: V- H0 R WRITE(buf, “, out1 = “);, T# D7 p+ Q3 l2 w) D4 f9 T( K& _" |
WRITE(buf, out1); -- bit_vector type9 V2 V! B7 W+ {6 O4 R, }$ M% y4 c+ {
WRITELINE(io_file, buf); -- write line to output file
, S( y" Z' L' i end loop;0 Z% Y9 Q& v7 V) M& l8 w$ _
end process writing_sims;; J A6 f c0 J3 d+ n7 u
end tb; |
評分
-
查看全部評分
|