用quartus 11与modelsim 66,仿真
module led_twinkle(led,clk);// 模块名及端口参数
output [7:0] led;
input clk;
reg[7:0] led;// 输出端口定义为寄存器型
reg[7:0] counter; // 中间变量counter定义为寄存器型
always@(posedge clk)
begin
counter=counter+1;
if(counter==8'd100)
begin
led=8'd0;
end
else if(counter==8'd200)
begin
led=8'd255;
counter=0;
end
end
endmodule
仿真结果怎么也不对,LED输出始终是xxxxxxxx |