集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
楼主: AAT

问个verilog技巧

[复制链接]
 楼主| AAT 发表于 2010-6-26 11:37:22 | 显示全部楼层
太花哨了,如果用nlint去检查肯定很多问题<br>
<br>
老老实实写吧,真正的设计中用到的verilog语言技巧是很少的,好的设计代码是很朴实的
ICE 发表于 2010-6-26 13:22:39 | 显示全部楼层
THANK YOU!
ANG 发表于 2010-6-26 15:15:11 | 显示全部楼层
建议还是麻烦一点,一条一条赋值;<br>
其他方式当然也可以,但是必定要增加多余的逻辑,而且会影响综合的关键路径<br>
使速度降低
 楼主| AAT 发表于 2010-6-26 15:28:55 | 显示全部楼层
对,能人工做得还是自己做,给工具做不知道它长成什么样子。
 楼主| AAT 发表于 2010-6-26 16:59:37 | 显示全部楼层
数组赋值使用变量,可能不利于综合,建议还是不要使用
interige 发表于 2010-6-26 17:30:11 | 显示全部楼层
always @(posedge clk) begin : block_1<br>
&nbsp;&nbsp;integer i;<br>
&nbsp;&nbsp;if (sp == 4)<br>
&nbsp; &nbsp; sp &lt;= 0;<br>
&nbsp;&nbsp;else begin<br>
&nbsp; &nbsp; for (i = 0; i &lt;= 23; i = i + 1)<br>
&nbsp; &nbsp;&nbsp; &nbsp;dout[i+sp] &lt;= din;<br>
&nbsp; &nbsp; sp &lt;= sp + 24;<br>
&nbsp;&nbsp;end<br>
end // block_1
FFT 发表于 2010-6-26 18:11:26 | 显示全部楼层
用for循环好了
ATA 发表于 2010-6-26 19:28:25 | 显示全部楼层
LZ&nbsp; &nbsp;想做什么呢?24位数据输入几次以后在256位一起输出?不过256又不是24的倍数。。。
CHAN 发表于 2010-6-26 20:42:07 | 显示全部楼层
仿真的时候可以这么写,拿去综合的话这样写不太好吧。
ups 发表于 2010-6-26 22:03:48 | 显示全部楼层
module tm(clk,din,dout);<br>
<br>
input clk;<br>
input [23:0] din;<br>
output [255:0] dout;<br>
<br>
reg [255:0] dout;<br>
<br>
reg [4:0] sp1;<br>
reg [4:0] sp2;<br>
<br>
always@(posedge clk)<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;if(sp==4)<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;begin<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; sp1 &lt;=0;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; sp2 &lt;=23;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;else<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;begin<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; dout[sp2:sp1]&lt;=din;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; sp1 &lt;=sp1+24;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; sp2 &lt;= sp1 + 47;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; end<br>
<br>
endmodule<br>
<br>
<br>
<br>
试试这个呢
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-5-6 17:41 , Processed in 0.064302 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表