当前位置:网站首页>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&#
边栏推荐
猜你喜欢

只让电脑运行某个程序设置

Navicat for Oracle Cannot create oci environment

虹科Automation softPLC | 虹科KPA MoDK运行环境与搭建步骤(2)——MoDK运行环境搭建

day12_ Multithreading

子网数、主机数与子网掩码的关系

Access、Hybrid和Trunk三种模式的理解

day10_ Exception handling & enumeration

day14_单元测试&日期常用类&字符串常用类

Official tutorial redshift 05 system parameter detailed explanation

JVM memory structure
随机推荐
Noi online 2022 popular group problem solving & personal understanding
SQL Developer图形化窗口创建数据库(表空间和用户)
6898 changing matrix problem solution
Thinking about MySQL taking shell through OS shell
JVM memory structure
Idea practical shortcut key novice must see
如何判断业务被DDoS攻击?又会造成哪些危害?
虹科 | 使用JESD204串行接口高速桥接模拟和数字世界
waf防护是什么
右值引用和移动构造
Official tutorial redshift 06 opt parameters
day10_异常处理&枚举
day09_static&final&代码块&抽象类&接口&内部类
Arrays & object & System & Math & random & Packaging
服务器135、137、138、139、445等端口解释和关闭方法
Unity中简单的cubecap+fresnel shader的实现
Official tutorial redshift 07 instances and proxy
2022 summer second day information competition learning achievement sharing 1
Official tutorial redshift 05 AOVs
FTP的两种模式详解