0
我試圖採取50 MHz的時鐘在lab7tb產生(),並將其與一週期的6微秒,或接近轉換爲一個。當我運行波形時鐘是紅色的,不知道爲什麼。Verilog的基地2時鐘分頻器
`timescale 1 ns/1 ns //time scale for the test bench
module p2divider(clockin, clockout);
input clockin;
output wire clockout;
parameter n = 9;
reg [n:0] count;
[email protected](posedge clockin)
begin
count <= count + 1;
end
assign clockout = count[n];
endmodule
module lab7tb(); // the test bench module
reg clock_sig;
wire clock_out;
// Instantiate the Unit Under Test (UUT)
p2divider a (clock_sig, clock_out);
integer i;
initial begin
for(i=0; i<100; i=i+1)
begin
clock_sig <=1;
#10;
clock_sig <=0;
#10;
end
end
endmodule