This blog post reference: "Large-Scale Logic Design Guide" is very helpful for writing standard code and cultivating a good code style.
This explanation is very important. If this is not satisfied, maybe there is no problem in the simulation, but it will definitely appear during the synthesis and cannot be synthesized. I have made this mistake many times.
I once wrote a blog that specifically said:There is no problem to perform functional simulation under Modelsim, but a comprehensive error is reported in ISE, how to solve it?
Although the standard does not enforce this, it is more standardized and easier to read.
This is easier to understand. Although the Verilog HDL language has its own priority, the use of parentheses to indicate priority is clearer and more meaningful to the reader.
For example: if ((a> b) && (c> d)) ......
It is better than the following expression:
if (a> b && c> d), although the two have the same effect.
When comparing vectors, Verilog will zero-extend vectors with a small number of bits to match their lengths, and its automatic expansion is implicit. It is recommended to use display expansion. This rule also applies to the comparison of vectors and constants.
E.g:
reg [7:0] a;
reg [3:0] b;
...
if( a == {4'b0, b} ) begin
...
end
if( a == 8'b0 ) begin
...
end
When doing hardware design, it is often required to perform an action when the condition is true, and perform another action when the condition is false. Even if the condition is false, it is impossible to occur, there must be an else statement, which can be an empty Statement.
If there is no else statement, the synthesized logic may be different from the logic at the RTL level. (What does this sentence mean? If there is no else statement, the synthesis tool may synthesize something that you do not want to appear, such as synthesizing a latch. You can not use a latch, but it is because there is no else Statement, and the latch is synthesized, which not only affects the overall performance of the circuit, but also causes waste of resources.)
E.g:
always @(Cond) begin if(Cond) DataOut <= DataIn; // The else statement is missing endThe above statement DataOut will be integrated into a latch.
The above statement has priority, if has the highest priority, else if follows, else last.
V1 = 2'b00; //default
V2 = 2'b00;
v3 = 2'b00;
if(a == b) begin
V1 = 2'b01;
V2 = 2'b10; //V3 is not assigned
end
else if(a == c) begin
V2 = 2'b10;
V3 = 2'b11; //V1 is not assigned
end
else ;
The above meaning is that if the variable is not all assigned in the statement, then the variable should be given a default value at the beginning, otherwise its value is unpredictable.
case
...
default: ;
endcase
This blog post is here for the time being. Of course, there are still many places to pay attention to, and we will continue to update it in the future. The update includes modifications and additions to this blog, which are explained based on actual inspections.
For example: I haven't said much about the following sentence because I don't know it yet. In the past circuit design, functions and tasks were rarely used, so you have to learn and then practice.
Instead of repeating expressions multiple times with a function, a frequently used set of descriptions can be written to a task.
content 1. 1.1. Verilog HDL 1.2. Verilog HDL 2. 2.1. 2.1.1. 2.1.2. assign always initial 2.2. 1. (Hardware Description Language, HDL) , , (Electrionic Design Automation, EDA) , , 。 , (Application Spec...
This is an introductory article. The author has also been confused and very confused about how hardware programming is, but the effort is not disappointing. I hope my article will be recognized by rea...
FPGA learning Phase 1: Introduction to Verilog HDL and basic syntax (1) FPGA hardware development route learning plan: Since I want to learn the related content of FPGA and lay some foundation for dig...
Verilog HDL simple design example (1) statement 8-bit adder with carry end Use level-sensitive always block to design instruction decoding circuit Use task and always blocks to design the combinatoria...
First, the lexical agreement 1.Verilog is the case in case, to distinguish, where the keywords should be lowercase 2. Blank characters and spaces (/ b) and tabs (/ T) consist of, in addition to blanks...
Introduction to HDL design method Verilog is essentially a design method Verilog first impression Verilog design verification process glance Verilog is essentially a design method In the past people w...
Recommended study books: "Verilog HDL Digital Design and Comprehensive" (Second Edition) "Verilog HDL Programming Art" Currently, we will learn based on these two books and wildfir...
How to understand FPGA and Verilog HDL in a common way? - Quick Start Verilog HDL and FPGA Series 1 1. From novice to expert There are five stages in any field, from novice to expert: the exploration ...
1 Verilog HDL Digital Design Overview 1.1 Several important concepts EDA(Electronic Design Automation) Electronic technology automation EDA tools Similar to IDE (Integrated Development Environment) in...