/* TestBench for State Machine */
module testbench();
parameter STEP=10;
reg clock;
reg [1:0] inx;
wire outz;
wire [1:0] cs;
stateMachine state( .clk(clock), .x(inx), .z(outz) );
いつもの呪文
always begin
#(STEP/2) clock=~clock;
end
initial begin
#0 inx=2'b00; clock=1'b0;
#(1.2*STEP) inx=2'b10;
#(2*STEP) inx=2'b01;
….
#(1*STEP) $finish;
end
initial begin
$dumpfile("tmp.vcd");
$dumpvars(0,testbench);
$monitor("%b %2b %b",clock,inx,outz);
end
クロック生成
入力x他
endmodule