最初のページ 戻る 次へ 最後のページ 画像

テストベンチ(testbench.v)

`timescale 1us/1us

module testBench;

parameter  STEP = 1;

reg clock,reset;

reg [7:0] iport;

wire [7:0] oport;

cpu mycpu(

.clock(clock), .reset(reset),

.inputPort(iport), .outputPort(oport)

);

always begin #(STEP) clock=~clock; end

initial begin

$dumpfile("tmp.vcd");

$dumpvars(0,testBench);

end

initial begin

#STEP clock=1'b0;reset=1'b0;iport=8'd4;

#(2*STEP) reset=1'b1;

#(1024*STEP) $finish;//無限ループ時は1024ステップで終了

end

endmodule

少し遅れてreset=1

いつもの呪文

クロック生成

CPUをインスタンス化

入出力信号を宣言