当前位置:网站首页>Verilog tutorial (11) initial block in Verilog
Verilog tutorial (11) initial block in Verilog
2022-07-04 23:59:00 【mb611f1478c9b26】
List of articles
- Preface
- Text
- Grammar format
- initial What is the block used for ?
- initial When the block begins and when it ends ?
- How many... Are allowed in a module initial block ?
Preface
In a simulation, a set of Verilog sentence . These statements are placed in a block . stay Verilog There are two main types of blocks in –initial Block and always block .
Text
Grammar format
initial Block can be understood as an initialization block , stay initial The starting position of the statement in 0 The moment begins to execute , After that, if there is a delay , The next statement is executed after the delay .
The syntax is as follows :
initial
[single statement]
initial begin
[multiple statements]
end
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
If initial There are multiple statements in , Then place the begin …end Between .
initial What is the block used for ?
The initial block is not integrable , So it can't be converted into a hardware schematic with digital elements . Therefore, in addition to being used in simulation , It doesn't help much . These blocks are mainly used to initialize variables and design ports with specific values .
Be careful : In chip logic design ,initial Blocks really can only be used for behavioral simulation , But in FPGA In design , Simple use initial The initialization of variables can be integrated .
for example :
reg a, b, c;
initial begin
a = 0;
b = 0;
c = 0;
end
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
But we initialize more at the moment of variable definition , This is the recommended usage .
for example :
reg a = 0;
- 1.
Or use a reset signal to initialize , But this will increase the burden of generic cabling , You can consciously reduce , Unless you have to .
for example :
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
initial When the block begins and when it ends ?
At the beginning of the simulation , In time 0 Unit starts an initial block . Throughout the simulation process , This block of code is executed only once . once initial All statements in the block are executed ,initial The execution of the block ends .
If initial There's just one sentence in the block , So the beginning is the end , The statement is executed to end this initial block , Such as :
The code shown in the figure below has an extra statement , It gives the signal b Assigned some values , But this only happens when the previous statement is executed 10 After units of time . It means a First assigned to a given value , And then in 10 After units of time ,b Assigned to 0.
How many... Are allowed in a module initial block ?
There can be multiple ( Arbitrarily )initial block .
Multiple initial Blocks are executed simultaneously , It's all from the moment 0 Start execution .
The code shown in the figure below has three initial blocks , All the initial blocks start and run in parallel at the same time . However , According to the statement and delay in each initial block , The time required to complete the block may vary .
$finish It's a Verilog System tasks , It tells the emulator to terminate the current simulation .
If the last block has 30 Time unit delay , As shown in the figure below , The simulation will be in 30 Time units end , So it killed all the others that were active at the time initial block .
initial begin
#30 $finish;
end
- 1.
- 2.
- 3.
Reference material
- WeChat official account : FPGA LAB
边栏推荐
- How to save your code works quickly to better protect your labor achievements
- 解决无法通过ssh服务远程连接虚拟机
- 【路径规划】RRT增加动力模型进行轨迹规划
- [论文阅读] CarveMix: A Simple Data Augmentation Method for Brain Lesion Segmentation
- [binary tree] the maximum difference between a node and its ancestor
- Why does infographic help your SEO
- Instructions for go defer
- What is the difference between port mapping and port forwarding
- Skills in analyzing the trend chart of London Silver
- He worked as a foreign lead and paid off all the housing loans in a year
猜你喜欢
ICML 2022 || 3DLinker: 用于分子链接设计的E(3)等变变分自编码器
How to do the project of computer remote company in foreign Internet?
Data on the number of functional divisions of national wetland parks in Qinghai Province, data on the distribution of wetlands and marshes across the country, and natural reserves in provinces, cities
[JS] - [sort related] - Notes
45 year old professor, she threw two super unicorns
Significance of acrel EMS integrated energy efficiency platform in campus construction
Font design symbol combination multifunctional wechat applet source code
Solution record of jamming when using CAD to move bricks in high configuration notebook
Hong Kong Jewelry tycoon, 2.2 billion "bargain hunting" Giordano
A new method for analyzing the trend chart of London Silver
随机推荐
Fast parsing intranet penetration helps enterprises quickly achieve collaborative office
Application of multi loop instrument in base station "switching to direct"
How to effectively monitor the DC column head cabinet
[IELTS reading] Wang Xiwei reading P4 (matching1)
ICML 2022 || 3DLinker: 用于分子链接设计的E(3)等变变分自编码器
Build your own minecraft server with fast parsing
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
快解析内网穿透帮助企业快速实现协同办公
Solution record of jamming when using CAD to move bricks in high configuration notebook
go踩坑——no required module provides package : go.mod file not found in current directory or any parent
Jar批量管理小工具
The pit of sizeof operator in C language
js正则表达式之中文验证(转)
Examples of time (calculation) total tools: start time and end time of this year, etc
ECCV 2022 | Tencent Youtu proposed disco: the effect of saving small models in self supervised learning
Robot reinforcement learning synergies between pushing and grassing with self supervised DRL (2018)
Hong Kong Jewelry tycoon, 2.2 billion "bargain hunting" Giordano
The Chinese output of servlet server and client is garbled
PMP certificate renewal process
Power operation and maintenance cloud platform: open the new mode of "unattended and few people on duty" of power system