Professional Documents
Culture Documents
Johny Srouji
Intel
Chair – SV-Basic Committee
reg a;
Verilog reg and integer
Verilog type bits can contain x
integer i;
SystemVerilog and z values
Equivalent to these
logic a;
SystemVerilog logic signed [31:0] i; 4-valued
SystemVerilog types
IfIfyou
youdon't
don'tneed
needthe
theXXand
andZZvalues
valuesthen
then
use
usethe
theSystemVerilog
SystemVerilogbit
bitand
andint
inttypes
types
which
whichMAKE
MAKEEXECUTION
EXECUTIONFASTER
FASTER
Like
LikeininCCbut
butwithout
without
the
theoptional
optionalstructure
structure
tags
tagsbefore
beforethe
the{{
u_type u;
structs and unions can be
initial assigned as a whole
begin Can be passed through
u.n = 27; int
tasks/functions/ports as a
$display("n=%d", u.n);
whole
u.f = 3.1415; real
$display("f=%f",u.f); can contain fixed size packed
$finish(0); or unpacked arrays
end
This works
like in Verilog Adds time literals
#10 a <= 1;
#5ns b <= !b;
#1ps $display("%b", b);
Colors col;
integer a, b;
a=2*3=6
a = blue * 3; col=3
col = yellow; b=3+1=4
b = col + green;
initial
begin
repeat(10) @(posedge clk) ;
$finish(0);
end
Parameter used
endmodule before definition
endmodule
43 DAC2003 Accellera SystemVerilog Workshop
Variable Types
• Static variables • Global variables
– Allocated and initialized at – Defined outside of any module
time 0 (i.e. in $root)
– Exist for the entire – Accessible from any scope
simulation – Must be static
– Tasks and functions can be
• Automatic variables global too
– Enable recursive tasks and • Local variables
functions
– Accessible at the scope where
– Reallocated and initialized they are defined and below
each time entering a block – Default to static, can made
– May not be used to trigger automatic
an event – Accessible from outside the
scope with a hierarchical
pathname
Complex signals
SystemVerilog Bus protocol repeated in blocks
Interface Bus Hard to add signal through hierarchy
Design Signal 1
Signal 2
Read()
Communication encapsulated in interface
Write()
- Reduces errors, easier to modify
Bus Bus Assert
- Significant code reduction saves time
- Enables efficient transaction modeling
Bus
- Allows automated block verification
int i; int i;
logic [7:0] a; wire [7:0] a;
• Complex
• Post- tbS interconnect
Integration S • Hard to create tests
to check all signals
Need to check A B • Slow, runs whole
interconnect,
structure (missing design even if only
wires, twisted structure is tested
busses) as well as
functionality