当前位置:网站首页>Use of for statement in Verilog
Use of for statement in Verilog
2022-07-29 06:33:00 【qq_ forty-six million four hundred and seventy-five thousand on】
stay C In language , Frequently used for Loop statement , But in hardware description language for The use of statements is more C Language and other software description languages are quite different .
stay Verilog In addition to in Testbench( Imitation test incentives ) Use in for Out of loop statement , stay Testbench in for Statements are commonly used in generating excitation signals , But in RTL Level coding is rarely used for Loop statement . The main reason is for The loop will be expanded by the synthesizer into execution statements for all variable cases , Each variable occupies register resources independently , Each execution statement cannot effectively reuse hardware logic resources , It's a huge waste of resources . Simply put ;for The statement loops several times , Is to copy the same circuit several times , So the more cycles , The larger the occupied area , The slower the synthesis .
stay RTL Hardware description , Encounter a similar algorithm , The recommended method is to find out the timing requirements of the design first , Make one rea Type a counter . Accumulate along each clock , And judge the counter condition at each clock edge , Do the corresponding treatment , Reusable processing modules should be reused as much as possible , Even if all operations cannot be reused , Also used case Statement expansion processing .
For the following for Loop statement :
1 for(i=0;i<16;i++)
2 DoSomething();
The following code can be used to realize :
reg [3:0] counter;
always @(posedge clk)
if(syn_rst)
counter<=4'b0;
else
counter<=counter+1:
always @(posedge clk)
begin
case(counter)
4'b0000:
4'b0001:
......
default:
endcase
end
in addition , There are several grammatical details that need attention .for(i&#
边栏推荐
猜你喜欢
赛博朋克版特效shader
Thinking about MySQL taking shell through OS shell
EtherCAT主站掉线后,如何保证目标系统免受故障影响?
虹科分享 | 带你全面了解“CAN总线错误”(四)——在实践中生产和记录CAN错误
角色shader小练习
Vivado IP核之定点数转为浮点数Floating-point
Official tutorial redshift 09 camera
Unity-默认渲染管线-刻晴卡渲shader
Ue5 landscape conversion Nanite conversion method and it does not support the use method of starting dynamic mesh with lumen and lumen
day14_单元测试&日期常用类&字符串常用类
随机推荐
day10_异常处理&枚举
Official tutorial redshift 08 light
黑客攻击入侵服务器的6种常见方式
官方教程 Redshift 04 渲染参数
网站被挂马的解决方案
Vivado IP核之定点数转为浮点数Floating-point
Official tutorial redshift 06 opt parameters
Vivado IP核之浮点数乘除法 Floating-point
c语言面试准备一(谈谈理解系类)
虹科分享 | 如何测试与验证复杂的FPGA设计(1)——面向实体或块的仿真
2022 summer second day information competition learning achievement sharing 2
虹科分享 | FPGA 实现的直通与存储转发切换延迟
DDoS详解
NoClassDefFoundError processing
Official tutorial redshift 07 instances and proxy
网络安全学习(二)
Learning notes of bit operation
多路IO用法
虹科分享 | 测试与验证复杂的FPGA设计(2)——如何在IP核中执行面向全局的仿真
Official tutorial redshift 05 AOVs