Eecs2070 02 Introduction To Systemverilog
Eecs2070 02 Introduction To Systemverilog
Eecs2070 02 Introduction To Systemverilog
Introduction to SystemVerilog
黃稚存
國立清華大學
Lecture 19
資訊工程學系
l SystemVerilog (SV) is a Hardware Description and
Verification language (HDVL)
l SystemVerilog for RTL is an extension of IEEE 1364
Verilog-2005 standards
u SystemVerilog is the superset of Verilog
u IEEE standard 1800-2017 standard
l SystemVerilog for verification uses extensive object-
oriented programming techniques
u This portion is more closely related to C/C++/Java than
Verilog
u These constructs are generally not synthesizable
Src: http://www.asicguru.com/system-verilog/tutorial/introduction/1/
Lec19 EECS2070 02 CT 2019 3
Advantages of SystemVerilog
l Multidimensional array
logic [1:0][2:0] my_register[0:9];
u Packed dimensions are [3:0] and [7:0]
u Unpacked dimension is [0:9]
l Packed dimensions:
u to be laid out contiguously in memory
u can be copied on to any other packed object
u can be sliced ("part-selects")
u are restricted to the "bit" types (bit, logic, int etc.),
some of which (e.g. int) have a fixed size.
Design DUT (
.Clock(Clock), .Reset(Reset),
.Data(Data), .Q(Q)
);
l Combinational logic
always_comb begin
tmp = b * b - 4 * a * c;
no_root = (tmp < 0);
end
l Level-sensitive latch
always_latch
if (en) q <= d;
l Synchronous edge-sensitive sequential logic
always_ff @(posedge clk)
count <= count + 1;
initial begin
// Drive and monitor the bus
TheBus.RWn = 0;
TheBus.Addr = 0;
for (int I=0; I<7; I++)
TheBus.Addr = TheBus.Addr + 1;
TheBus.RWn = 1;
TheBus.Data = mem[0];
end
endmodule
module TestRAM;
logic Clk;
MSBus TheBus(.Clk(Clk));
RAM TheRAM (.MemBus(TheBus.Slave));
...
endmodule
» Not synthesizable
» Assisting in creation of test benches
l Variable-length text
string s1 = "Hello";
string s2 = "world";
string p = ".?!";
// string concatenation
string s3 = {s1, ", ", s2, p[2]};
// dynamic array
int da[];
initial begin
cmdline_elements = 16;
// Allocate array with 16 elements
da = new[ cmdline_elements ];
end
In addition, there is $warning for less severity level,, and $info with
no specific severity
Lec19 EECS2070 02 CT 2019 22
Concurrent Assertions
l https://www.doulos.com/knowhow/sysverilog/
l http://www.asic-
world.com/systemverilog/index.html