System Verilog Notes: Basics To Advance
System Verilog Notes: Basics To Advance
System Verilog Notes: Basics To Advance
BASICS TO ADVANCE
TYPES OF SIGNALS
(CLK,RST) (raddr,waddr)
Data Signal
(rdata,wdata)
1) Adding control statement to block that helps us to enable waveform viewer( System task
at the start of simulation).
Random waveform for a multibit signal this we will predominantly using with a verification env.
10 x 1ns
ALWAYS BLOCK
- Combinational ckts → always@(a,b)
Usage of Always block → Executing / evaluating expression till the end of simulation.
1. Generate clock
10ns
=5
2
Time Unit(TU)
𝑇𝑈 Number of precision
= 1 = 100 digits, We can’t use
𝑇𝑃
floating point
#10.1 → 10
We can have 3
𝑇𝑈 10−9 digits after decimal
= −12 = 103
𝑇𝑃 10
Understanding parameters for generating clock :
Ton
𝐷𝑢𝑡𝑦 𝑐𝑦𝑐𝑙𝑒 =
Ton + Toff
Period = 1/freq
real period → nsec
reg
Hardware
wire
Fixed
Variable
DATA TYPES Floating
Real time
Simulation
2 state
Fixed
4 state
Variable
Floating
Declaring various data types
Variables
signed Unsigned
8-bit → byte
16-bit→ short int
32-bit→int
64-bit→long int
$time
$realtime
Cin
Sout
a
S
Half
Half Adder
Adder C
b Cout
OR
Following will be declared within the Full adder module.
➔ Cin
➔ a
➔ b
➔ Sout
➔ Cout
Whenever with a module we have to connect the blocks, we have undefined nets.
Incorrect Implementation
module ha (
input wire a, b,
);
assign sout = a ^ b;
endmodule
module fa
input a , b, cin,
output s, c
);
assign c = t2 | t3;
endmodule
Correct Implementation
module ha (
input wire a, b,
);
assign sout = a ^ b;
endmodule
module fa
input a , b, cin,
output s, c
);
assign c = t2 | t3;
endmodule
UNDERSTANDING ARRAYS:
Output
Repetitive Value
Unique Values arr[] = `{ 6{1} }
arr[ ] = {1,2,3,4}
Array Operations
1. Copy
2. Compare
Dynamic Array:
Queue :
Gives fast access to elements of array.
Declaring Queue
Output
Adding New element to Queue:
Output
Output
Before inserting
How do we correct it ?
OUTPUT :
OUTPUT
VERIFICATION FUNDAMENTALS:
Learning how to create verification plan :
Let us take example we are planning to verify a single port RAM
CLK
RST
dout
wr Single Port RAM
din
addr
So what is the difference between SV and Verilog, as we create a handler in SV but just
doing this will not help us access the class because class is a dynamic object whereas
module is static object i.e when we perform simulations right from start to end the
object will be present when we refer to static whereas for a class we don’t keep object
live for entire simulation.
➔ new constructor
when we create constructor new, it allocates space in memory for the data
members of class along with that it will also initialize default value the data member
can have.
The approach as shown here, we
follow similar approach in
creating testbenches also when
working with class.
Functions
Tasks
➔ Do not support timing
➔ Support timing control control.
➔ Do not support output
@(posedge clk);
port.
➔ Multiple output ports
FUNCTIONS :