|
這裡有一段 VHDL TB 可以產生 dump file ) R5 _3 P# R, h: M
; S" M$ `3 C4 Q4 ^. T
use std.textio.all;
( l& N5 y1 I$ ?use work.string.all;
8 Z( p$ y( @" L5 }architecture tb of test is: @' p4 S/ T: d# q, y8 {& a
file io_file: TEXT open WRITE_MODE is “sim_res.dump”;
* B4 W! s# V, b/ ?begin
* M# p! R4 p& E) _ writing_sims: process
, D7 f0 p3 k4 z9 Z variable buf: LINE; -- predefined access type in TEXTIO, o2 j; M& B0 t* H9 N1 Y& R
begin
% y. l' A! d. Y WRITE(buf, “Simulation results:”);2 T2 a- [; H$ _1 d, I
WRITELINE(io_file, buf);; [5 v' i7 D- h1 U
loop
' \' P" J: U a+ u# K c) d wait on CLK; -- loop execution on every clock edge
* L- N, O& R/ B8 q WRITE(buf, “Current time = “);! Q4 [# u# A1 g
WRITE(buf, finish_clk); -- current simulation time
; m! j9 ^: u4 x( q% N WRITE(buf, “, clock = “);# o5 o5 R' g# C- ]
WRITE(buf, clk);
! W) C! W& }+ Q WRITE(buf, “, in1 = “);
2 l( R/ }% h/ h9 C4 F2 g WRITE(buf, in1); -- integer type8 B1 e- \# E+ h/ M
WRITE(buf, “, out1 = “);4 \3 i7 Q! q f7 `0 l
WRITE(buf, out1); -- bit_vector type
. H( i9 k6 p9 [# J, ?+ u4 p$ v WRITELINE(io_file, buf); -- write line to output file
4 P" s/ ^+ |4 x; n7 @ end loop;7 G/ ?3 g% f7 I' `, L: Q" X8 U
end process writing_sims;
8 @2 p# r2 i# H& dend tb; |
評分
-
查看全部評分
|