|
這裡有一段 VHDL TB 可以產生 dump file ) t/ ]6 N; ]% B, [5 g1 L
/ D9 [9 R6 t. R5 [$ q
use std.textio.all;
$ I3 L( e" O7 F; X) K% j; Wuse work.string.all;" D$ X: B) j7 _4 w
architecture tb of test is
3 ~# O- i0 E: H6 t0 Q7 l" H file io_file: TEXT open WRITE_MODE is “sim_res.dump”;
0 K( A7 Y, I1 Z) V7 C. V, L: tbegin. u* U$ |' f; W( ^6 m2 _$ r
writing_sims: process) z% u# G( G( Z! K5 {- h
variable buf: LINE; -- predefined access type in TEXTIO
/ C7 K/ d5 d; N- D7 N. c! ^' ~% F begin* L: n0 F9 W' V
WRITE(buf, “Simulation results:”);, S. Y+ y5 q' R2 p9 }9 @
WRITELINE(io_file, buf);: ~3 T8 k: E- H0 _+ m' V5 V6 s" ?
loop
; ?: f! o8 L* g/ t, D) J- s% h+ m wait on CLK; -- loop execution on every clock edge) b/ \4 b# n9 @6 v, `( i. ~
WRITE(buf, “Current time = “);
, S3 K4 [: z1 Y& _ WRITE(buf, finish_clk); -- current simulation time4 ^8 A3 Y5 a+ y6 ~2 o
WRITE(buf, “, clock = “);6 `" d% B v5 B; s' [/ l8 k
WRITE(buf, clk);4 L7 P. u% J' R( A# l( k
WRITE(buf, “, in1 = “);% ~* V; V: o7 m$ B+ c/ b( z
WRITE(buf, in1); -- integer type
4 g4 K" a3 z( M9 O- p4 e2 u$ q; ~ WRITE(buf, “, out1 = “);
+ A: B3 F7 b6 D6 {) Y( p% o WRITE(buf, out1); -- bit_vector type% K/ L# P. |) a/ B2 o# |
WRITELINE(io_file, buf); -- write line to output file
& s/ V u: T2 T- W! B& ? end loop;( s7 W0 k. V# G' d8 V" c- U
end process writing_sims;
" J5 x. D* l1 s. d3 _3 Dend tb; |
評分
-
查看全部評分
|