24小时热门版块排行榜    

查看: 596  |  回复: 2

rosary

新虫 (初入文坛)

[交流] 【求助】初学者,求大神们看下这段简单的verilog代码 【已解决】 已有2人参与

初始输出out为0
我是想在20个时钟上升沿之后让out为1
要求使用repeat语句

module add_delay20(out,clock);
output reg out;
input clock;
integer count;

initial
begin
        out=1'b0;
        counter=1;
        repeat(20)
                begin
                always@(posedge clock)
                count=count+1;
                end
        out=1'b1;
end
endmodule

初试,轻拍
Error (10170): Verilog HDL syntax error at add_delay20.v(11) near text "always";  expecting "end"


终于搞对了!!!!
module add_delay20(out,clock);
output reg out;
input clock;
integer count;

initial
        out=1'b0;

initial
begin
                count=1;
                repeat(20)
                        @(posedge clock)                         count=count+1;
            out=1'b1;
end
endmodule
真不容易哈哈哈开心

[ Last edited by rosary on 2010-11-5 at 10:46 ]
回复此楼

» 猜你喜欢

LDPCdecoder
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

yalefield

金虫 (文坛精英)

老汉一枚

加个分号吧
2楼2010-11-04 16:54:06
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

rosary

新虫 (初入文坛)

引用回帖:
Originally posted by yalefield at 2010-11-04 16:54:06:
加个分号吧

能详细说说嘛,在哪里加分号
LDPCdecoder
3楼2010-11-04 19:09:59
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 rosary 的主题更新
普通表情 高级回复 (可上传附件)
信息提示
请填处理意见