Professional Documents
Culture Documents
Online Extra Concepts Reading
Online Extra Concepts Reading
A set of Verilog statements are usually executed sequentially in a simulation. These statements
are placed inside a procedural block. There are mainly two types of procedural blocks in Verilog
- initial and always.
An initial block is not synthesizable and hence cannot be converted into a hardware schematic
with digital elements. Hence initial blocks do not serve much purpose than to be used in
simulations. These blocks are primarily used to initialize variables and drive design ports with
specific values.
Each initial block executed once per simulation. While always block run continuously during
simulation (always clk=! clk; //It is an infinite loop.)
For example, mixed sensitive list of signals and edges is not synthesizable, because a
flip-flop cannot be edge-tiggered and level-triggered at the same time.
Adding timing delays would not be synthesisable, but often used in verification. Also
some tools will complain if you try to synthesise display statements.
Lecture 1:
Resources:
https://verificationguide.com/
https://www.chipverify.com/
http://verificationexcellence.in/online-courses/
http://www.sunburst-design.com/papers/
X in IF statement will always consider as false, hence output will be Inpu2; other than X and 0 all
will be true in IF statement.
In ternary operator, it will look at both inputs, if both the inputs are different than X will be
output, if both the inputs are same than output will be same as input.
Negate (!): 01 is considered as true, hence ! 01 will be false.
Invert (~): But invert 01 , invert each bit, hence ~ 01 will be 10, which is 2 i.e true.
0->Z considered as posedge as Z may settle in 0 or 1, if settle to zero than no change, if settle to
1 than it is posedge, this is how logically language define posedge and negedge.
Lecture 2:
The int type was introduced as a part of the SystemVerilog extension. However, the key
difference between the integer and int types is that the int type uses only 2 states (o/1).
Verilog has two data type.
Net: Nets are used to connect between hardware entities like logic gates and
hence do not store any value on its own.
e.g. wire .
Above example is of write-write race, depending upon the compiler out may be 0 or 1 i.e
whichever is executed first.
In above example a is of wire type and both trying to drive a with different value, in such
cases output will be x. It is not race.
logic variable cannot be drive by mixed I.e., structural, procedural drive, primitive drive, driven
by module any of the two at the same time but both can be drive procedurally.
Reg—Verilog/SV
Logic---SV
(RS: As no resolution exist, to prevent you from wasting time.)
Packed allowed complete access in oneshot, also individual array element can be access
individual array element. As element are begin stored side by side in memory.
**Try to read big Indian little Indian for & 7:0 and 0:7.
%P to print complete contain at one go in array, structure, enum.
Packed and unpacked structure are synthesizable.
New stuff comapir to Verilog, esily maintainable, as for automatically change if size of array
changes.
https://www.edaplayground.com/x/4xCG
https://www.edaplayground.com/x/vmZz
I am getting run time error, source and destination type is mismatched while filling a vector
with all 1. I tried for 0, x,z similar error has observed.
Infinite loop: simulation hang occurs, because control hangs at that point it won’t allow other
parallel task to get execute, hence always use delay inside infinite loop.
Break --- control will go end of while loop, stop executing loop.
Continue---- skip remaining statement in the loop and start the loop execution again.
$urandom ----- generate unsigned random values.
In general thumb rule for adding sensitivity list --- > signals that u are reading or sampling.
Driving--- use this word for output port connected to wire, and in procedural assignment i.e. in
assign statement.
Verilog will not issue any error for such scenario (i.e. if use always *). But with always_comb
issue compiler error.
At time zero:
First time control come to always block it note down the values of signals which are part of
sensitivity list and goes to waiting mode (actvating always block available at 0).
(It is behavior of language--- at time 0 control first go to always, note down value of sensitivity
list and goes to waiting mode.) i.e. logically to see changes on sensitivity list it must need first
note value of sensitivity list hence languge maje control goes to always make it on wait state.
Than delay
So at time zero always is waiting control goes to always block, than always executed and
always note down new value of inp1 and inp2.
In simulation parallelism mean--- do one task if it goes to wai than it moves to other task in
same time. (i.e task getting switched e.g between initial always).
Start initial block first. Both always initial goes in waiting ,
Those always com which not executed in time 0, executed once in time 0 , irrespective of
change in selectivity list to mimic exact rela combo behavor. (genral always block mimicking
combo after time zero and not behaving like combo only at time zero.)
How to solve time zero initialization in evrilog,, apply stimulus in <=.
Always_latch also executed once in time zero iirrespective there sensitivity list changed or not.
Programm block as it i
Topic 9:
Why at time 5, d=1 and q2=0? Even if q1 is directly connected to D of second flop.
Clk appearing simultaneously at each flop, hence it samples whatever valve available at q1 i.e 0
hence 0 at q2. (as flop executing in parallel)
At T5 Q1=1 Q2= 0 Q3=0.
When clk and data available at same time flop sample old value to mimic rela hardware
behaviors.
Reading and updating of Q1 happning at same time which is causing the issue, if we read old
value and update latter than behvaiour will be correct hence language introduces non blocking
assignement i.e to read old value.
Model sequential using blocking, so that it sample old value to mimic rela hardware behaviors.
IF RTL executed thread executed first than issue will also resolves (first case.)
Topic 10
Code from program end program as part of “Re”.
Above two chances are possible in SV language. Hence clk generation must not be part of
program block it needs to be done in top module.