verilog简单的赋值问题出错了
一个流水灯程序如下:下面那个outdat<=outdat+1;然后端口就是乱码不是+1的结果,而outdat=8'b1010_1010;却是正常的,这个事怎么不是modu...
一个流水灯程序如下:下面那个outdat <= outdat+1;然后端口就是乱码不是+1的结果,而outdat = 8'b1010_1010;却是正常的,这个事怎么不是
module LED(outdat,clk);
input clk;
output [7:0] outdat;
reg [7:0] outdat =8'b1000_0001;
reg [31:0] count = 0;
reg led1 = 0;
always @(posedge clk)
begin
if(count < 32'd30_000_000)
count <= count+1;
else
count <= 0;
end
always @(posedge clk)
begin
if(count == 32'd30_000_000)
led1 <= ~led1;
end
always @(posedge clk)
begin
if(led1)
//outdat <= outdat+1;
outdat = 8'b1010_1010;
end
endmodule 展开
module LED(outdat,clk);
input clk;
output [7:0] outdat;
reg [7:0] outdat =8'b1000_0001;
reg [31:0] count = 0;
reg led1 = 0;
always @(posedge clk)
begin
if(count < 32'd30_000_000)
count <= count+1;
else
count <= 0;
end
always @(posedge clk)
begin
if(count == 32'd30_000_000)
led1 <= ~led1;
end
always @(posedge clk)
begin
if(led1)
//outdat <= outdat+1;
outdat = 8'b1010_1010;
end
endmodule 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询