// ジョンソン・カウンタ シミュレーション記述 `timescale 1ps/1ps module johnson_tp; reg ck, res; wire [3:0] q; parameter STEP = 100000; always #(STEP/2) ck = ~ck; /* 4ビット ジョンソン・カウンタ(同期リセット) */ johnson_cnt johnson( ck, res, q ); initial begin ck = 0; res = 0; #STEP res = 1; #STEP res = 0; #(STEP*10) res = 1; #STEP $display("Bad Loop"); res = 0; johnson.q[1] = 1; // johnson.q[2] = 1; #(STEP*12) $finish; end initial $monitor( $stime, " ck=%b res=%b q=%b", ck, res, q ); endmodule