本人初学,想学习用modelsim,可是今天调了一下午也没调出来,大家帮帮忙呗
module test(clk,out);
input clk;
output reg[7:0] out;
reg[24:0] count;
always @ (posedge clk)
begin
if(out == 0)out = 1;
if(count==25000000)//25MHz
begin
count <= 0;
if(out == 8'b1000_0000)out = 8'b0000_0001;
else out = out << 1;
end
else
begin
count <= count + 1;
end
end
endmodule
测试文件为
`
timescale 1ns/1ps
module testtop;
reg clk,reset;
wire [7:0] out;
parameter period = 40;
test top(.clk(clk),.out(out));
initial begin
clk = 0;
reset = 0;
#10000;
reset = 1;
forever #(period/2) clk=~clk;
end
endmodule
一周热门 更多>