MCU_fans 发表于 2010-6-25 11:31:27

help~谢谢

module led(clck,led);
input clck;
outputled;
reg jinz;
reg jinz2;
reg co,en,co1,en1,LED;
assign led=LED;
always @(posedge clck)
begin        
        if(en)
        begin
        if(jinz<20_000_000-1)begin jinz=jinz+1;co=0;end
        else begin jinz=0;co=1;end
    end        
end
always @(posedge clck)
begin        
        if(en1)
        begin
        if(jinz2<80_000_000-1)begin jinz2=jinz2+1;co1=0;end
        else begin jinz2=0;co1=1;end
    end        
end
always @(posedge co)
begin
en=0;
en1=1;
LED=1;
end
always @(posedge co1)
begin
en1=0;
en=1;
LED=0;
end
endmodule

assign led=LED;这条语句如果换成assign led=0;就没错了。为什么???

tear086 发表于 2010-6-25 12:10:33

你的代码不符合规范。HDL的每句话都是有逻辑电路与之对应的。此处,组合和时序,阻塞与非阻塞,你都没描述正确。
楼主哥,你如果时间比较充裕,建议HDL与数电一起看,大约一周即可。理解后,就不会常出问题了。

MCU_fans 发表于 2010-6-25 12:30:35

回复【1楼】tear086 .COM 缺氧
-----------------------------------------------------------------------

嗯,谢谢指点啊!

amoFUCK 发表于 2010-6-25 17:00:36

enya 发表于 2010-6-25 17:09:02

……
页: [1]
查看完整版本: help~谢谢