|
這裡有一段 VHDL TB 可以產生 dump file # `4 C+ U0 W$ J; ?. u ^) o8 d0 D5 q v
, ^7 D5 f# @0 W7 ?" Y& V9 e4 f% vuse std.textio.all;" q u. }% n4 G Z/ g+ b2 @4 R$ z" ^
use work.string.all;" S* Q& O9 F( Y, U: P- \
architecture tb of test is" a, V2 `/ D8 f R+ y! r( ]
file io_file: TEXT open WRITE_MODE is “sim_res.dump”;# R z9 ]3 l- P' E2 C1 g
begin6 x0 x- H$ v% c' P4 {# d
writing_sims: process
5 k; K8 s3 h3 g1 U3 Z0 l! _8 J variable buf: LINE; -- predefined access type in TEXTIO
; y9 u5 a5 I' g! | begin' y( n9 y& O, s1 Q
WRITE(buf, “Simulation results:”);" H& Z5 L4 o3 b8 \' O2 e l
WRITELINE(io_file, buf);
/ |$ i* \, b, o) Z7 _ loop
) j2 r1 j+ O6 Q- o. m. i3 h+ o. }# H wait on CLK; -- loop execution on every clock edge
' h+ u$ h4 ]9 K$ s WRITE(buf, “Current time = “);- b) `0 Q, M: C! ?( d4 p
WRITE(buf, finish_clk); -- current simulation time
# [" c% j: c, W* _& l$ G# W# v WRITE(buf, “, clock = “);
" z- [% @7 E6 M# ^0 s: G WRITE(buf, clk);
0 Q0 M& V. _ S: h/ Q) O WRITE(buf, “, in1 = “);
: `# R, o* \) {0 d' R WRITE(buf, in1); -- integer type- o% f8 |+ ~! C* b9 g1 M& r
WRITE(buf, “, out1 = “);; Q& t3 ~! L) p- E, I6 c# @
WRITE(buf, out1); -- bit_vector type. f( A! I: V1 [
WRITELINE(io_file, buf); -- write line to output file
; z3 @: T5 E/ a* \4 H6 l end loop;
" w; m% @5 h! v x1 [- ^ end process writing_sims;
# F2 l+ u" Q1 P1 r7 G. ~end tb; |
評分
-
查看全部評分
|