在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 3045|回复: 13

[讨论] verilog 编码问题 求解答

[复制链接]
发表于 2014-12-18 17:35:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
请教大家一个基础的问题。自己写一个数据源,如下.状态在i=1时,Dataout有跳变,在状态i=2时,只计数,计1600次,信号LEN跳变,不管Dataout;经在开发板上测试发现,在这1600次计数过程中,Dataout会有输出。这是为什么呢,不是有时钟来了Dataout才会有输出吗?
initial
begin
  i <= 6'd0;
  j <=0;
end

always @(negedge clk)
                begin
                        case (i)
                                6'd0:        
                                                begin
                                                       LEN <= 0;
                                                        i <= 6'd1;
                                                end
                                6'd1:
                                                begin
                                                        if(j >= 20)
                                                                begin
                                                                        i <= 6'd2;
                                                                        j <= 0;
                                                                        LEN <=1;
                                                                        Dataout <= Dataout + 1;
                                                                end
                                                        else
                                                                begin
                                                                        i <= 6'd1;
                                                                        j <= j + 1;
                                                                end
                                                end
                                6'd2:
                                                begin
                                                        if(col_cnt >= 1600)
                                                                begin
                                                                        LEN <= 1;
                                                                        col_cnt <= 0;
                                                                        i <= 6'd3;
                                                                        line_cnt <= line_cnt + 1;
                                                                end
                                                        else
                                                                begin
                                                                        i <= 6'd2;
                                                                  col_cnt <= col_cnt + 1;                                 
                                                              end
                                                end
                                          ..........................
发表于 2014-12-18 18:19:18 | 显示全部楼层
你定义的i是几比特宽带啊?
 楼主| 发表于 2014-12-18 21:46:16 | 显示全部楼层
回复 2# william_kuang


   这不是重点 代码是两分钟随便写的
发表于 2014-12-18 23:22:18 | 显示全部楼层
Do you know what is the blocking and non-blocking assignment?
That is the first topic of the learn the coding of verilog.
The rtl coding has many concept doesn't same as c language.
The RTL has some block can be parallel execution but the c language does the sequential execution of the program.
So I suggest you to make sure you are understand what's differnt of blocking and non-blocking assignment.
发表于 2014-12-19 13:41:26 | 显示全部楼层
谢谢,学习学习
发表于 2014-12-19 13:44:03 | 显示全部楼层
关注一下  同求答案
发表于 2014-12-19 13:54:27 | 显示全部楼层
同求答案
发表于 2014-12-19 13:58:26 | 显示全部楼层
The first make sure your code is a behavior model or synthesizable RTL code.
If the RTL code that can't have a initial statement. You may be written a test bench to connect your DUT to do the function simulation.
发表于 2014-12-19 15:33:03 | 显示全部楼层
硬件代码岂能随便写?要明白每一段代码,实际上,就是对应的某一个既定固件,看得到摸得着的物理存在
一般来讲,楼主提到的现象,就是代码风格问题,你想要的逻辑控制单元,并不是那么复杂
发表于 2014-12-19 20:44:24 | 显示全部楼层
回复 3# zl138764


    呵呵
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

×

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-28 12:52 , Processed in 0.029283 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表