2002 HDLCon Presentation SystemVerilog
2002 HDLCon Presentation SystemVerilog
2002 HDLCon Presentation SystemVerilog
by
Stuart Sutherland
Verilog HDL and PLI Expert
Sutherland HDL, Inc.
Sutherland
Training engineers H D
to be HDL wizards L
1
March 11 - 12, 2002
Sutherland
Overview HD
L
Sutherland
What is SystemVerilog HD
L
Sutherland
Why Enhance Verilog? HD
L
Sutherland
SystemVerilog is an Evolution HD
L
typedef
typedef struct
struct {string
{string s;
s; int
int left}
left} node;
node;
C int
int visited
visited == 0;
0; //global
//global data
data
C language
language abstractions
abstractions
Structures
Structures function
function int
int treeFind(string
treeFind(string str,
str, parent);
parent);
Globals
Globals if
if (parent
(parent ==
== null)
null)
++
++ operator
operator return
return null;
null;
Enumerated
Enumerated types
types visited++;
visited++;
...
...
endfunction
endfunction
state
state {S0,
{S0, S1,
S1, S2}
S2} cstate;
cstate; //enumeration
//enumeration types
types
Standard
Standard Verilog
Verilog HDL
HDL always
always @(posedge
@(posedge clk)
clk)
Familiar
Familiar to
to H/W
H/W engineers
engineers begin
begin
Concurrency
Concurrency case
case (cstate)
(cstate)
Proven
Proven to
to work
work ...
...
end
end
Stuart Sutherland, Sutherland HDL, Inc. 5
March 11 - 12, 2002
Sutherland
Who is Accellera? HD
L
! EDA companies
! Hardware design companies
! Consultants
! Promotes the use and evolution of Verilog and VHDL
! Several subcommittees explore solutions to current and
future needs in hardware design
! The Accellera HDL+ committee is exploring the future needs for
the Verilog language
! SystemVerilog is a result of that exploration
Stuart Sutherland, Sutherland HDL, Inc. 6
Why is Accellera Specifying March 11 - 12, 2002
Sutherland
Changes to an IEEE Standard? HD
L
! Our design needs are changing much faster than the IEEE
can react
! It took the IEEE 4 years to define and ratify Verilog-2001
Sutherland
SystemVerilogs Roots HD
L
extensions to SystemVerilog
Stuart Sutherland, Sutherland HDL, Inc. 8
A Mile High View of March 11 - 12, 2002
Sutherland
SystemVerilog HD
L
SystemVerilog
int enum break continue
User Defined Ports Block Labeling
State Machines shortint typedef return goto
Dynamic Processes
Interfaces Assertions longint struct union ++ -- += -= *=
Packed Arrays 2/4 State Variables shortreal casting /= >>= <<=
Structures
Unions
Timeunits C double const
&= |= ^= %=
unique/priority fork/case/if char void
globals
ANSI C style ports standard file I/O (* attributes *) multi dimensional arrays
Verilog 2001
generate $value$plusargs configurations signed unsigned
localparam `ifndef `elsif `line memory part selects automatic
Verilog 1995
const func @* variable part select ** (power operator)
modules $finish $fopen $fclose initial wire reg begin end +=*/
parameters $display $write disable integer real while %
function/tasks $monitor events time for forever >> <<
always @ `define `ifdef `else wait # @ packed arrays if else
assign `include `timescale fork/join 2D memory repeat
Sutherland
Interfaces HD
L
if design changes
! Port declarations must be
bundled together
! Connection definitions are
Sutherland
Interface Example HD
L
interface
interface chip_bus;
chip_bus; //
// Define
Define the
the interface
interface
wire
wire read_request,
read_request, read_grant;
read_grant;
wire
wire [7:0]
[7:0] address,
address, data;
data;
endinterface:
endinterface: chip_bus
chip_bus
module
module top;
top;
reg
reg clk
clk == 0;
0;
chip_bus
chip_bus a;a; //instantiate
//instantiate the
the interface
interface
RAM
RAM mem(a,
mem(a, clk);
clk); //connect
//connect interface
interface to
to module
module instance
instance
CPU
CPU cpu(a,
cpu(a, clk);
clk); //connect
//connect interface
interface to
to module
module instance
instance
endmodule
endmodule
module
module RAM(chip_bus
RAM(chip_bus io,
io, input
input clk);
clk);
//io.read_request
//io.read_request references
references aa signal
signal in
in the
the interface
interface
endmodule
endmodule
Stuart Sutherland, Sutherland HDL, Inc. 11
March 11 - 12, 2002
Sutherland
Interfaces Can Contain Logic HD
L
Sutherland
and Global Statements HD
L
! Verilog-1995/2001:
! Does not have a true global name space
Sutherland
Functionality Example HD
L
function
function compare
compare (...);
(...); //global
//global function
function global
global declarations
declarations
and
and statements
statements
always
always @(error_flag)
@(error_flag) //global
//global statement
statement
...
...
module
module chip1
chip1 (...);
(...);
FSM
FSM u2
u2 (...);
(...);
always
always @(data)
@(data)
error_flag
error_flag == compare(data,
compare(data, expected);
expected);
endmodule
endmodule
module
module FSM
FSM (...);
(...);
...
...
always
always @(state)
@(state)
error_flag
error_flag == compare(state,
compare(state, expected);
expected);
endmodule
endmodule
Stuart Sutherland, Sutherland HDL, Inc. 14
March 11 - 12, 2002
Sutherland
Time Unit and Precision HD
L
forever
forever #5
#5 clock
clock == ~clock;
~clock; 55 what?
what?
! SystemVerilog adds:
! Time units can be specified as part of the time value
forever
forever #5ns
#5ns clock
clock == ~clock;
~clock;
Sutherland
Abstract Data Type HD
L
Sutherland
The 2-state bit Data Type HD
L
Sutherland
The 4-state logic data type HD
L
Sutherland
Signed and Unsigned Modifiers HD
L
reg
reg signed
signed [63:0]
[63:0] data_bus;
data_bus;
byte
byte unsigned
unsigned ubyte;
ubyte;
Stuart Sutherland, Sutherland HDL, Inc. 19
March 11 - 12, 2002
Sutherland
User-defined Types HD
L
typedef
typedef unsigned
unsigned int
int uint;
uint;
uint
uint a,
a, b;
b; //two
//two unsigned
unsigned integers
integers
Sutherland
Enumerated Types HD
L
Sutherland
Structures and Unions HD
L
struct
struct {{ typedef
typedef struct
struct {{
reg
reg [15:0]
[15:0] opcode;
opcode; bit
bit [7:0]
[7:0] opcode;
opcode;
reg
reg [23:0]
[23:0] addr;
addr; bit
bit [23:0]
[23:0] addr;
addr;
}} IR;
IR; }} instruction;
instruction; //named
//named structure
structure type
type
union
union {{ instruction
instruction IR;
IR; //allocate
//allocate aa structure
structure
int
int i;
i;
shortreal
shortreal f;
f; IR
IR == {5,
{5, 200};
200}; //fill
//fill the
the structure
structure
}} N;
N;
Sutherland
Module Port Connections HD
L
through ports
! Arrays can be passed through ports
Sutherland
Redefinable Data Types HD
L
module
module foo
foo #(parameter
#(parameter type
type VAR_TYPE
VAR_TYPE == shortint;)
shortint;)
(input
(input logic
logic [7:0]
[7:0] i,
i, output
output logic
logic [7:0]
[7:0] o);
o);
VAR_TYPE
VAR_TYPE jj == 0;
0; /*
/* jj is
is of
of type
type shortint
shortint unless
unless redefined
redefined */
*/
...
...
endmodule
endmodule
module
module bar;
bar;
logic
logic [3:0]
[3:0] i,o;
i,o;
foo
foo #(.VAR_TYPE(int))
#(.VAR_TYPE(int)) u1
u1 (i,
(i, o);
o); //redefines
//redefines VAR_TYPE
VAR_TYPE to
to an
an int
int
endmodule
endmodule
Stuart Sutherland, Sutherland HDL, Inc. 24
March 11 - 12, 2002
Sutherland
Assigning Literal Values HD
L
! Verilog-1995/2001
! Cannot fill all bits with 1 without specifying a vector size
statement
! SystemVerilog enhances assignments of a literal value
! All bits of a vector can be filled with a literal 1-bit value
Sutherland
Type Casting HD
L
Sutherland
New Operators HD
L
! SystemVerilog adds:
! ++ and -- increment and decrement operators
! +=, -=, *=, /=, %=, &=, ^=, |=, <<=, >>=, <<<=, >>>=
assignment operators
for
for (i
(i == 0;
0; ii <=
<= 255;
255; i++)
i++)
...
...
Sutherland
Unique and Priority Decisions HD
L
Sutherland
Bottom Testing Loops HD
L
Sutherland
Jump Statements HD
L
the group
! Can be used as a form of the C break and continue
statements
! Can be used to exit a task or function prematurely
Sutherland
Labels HD
L
begin:
begin: block1
block1 ...
... end
end
! SystemVerilog adds:
! A name can be specified after the end keyword
Sutherland
Qualified Sensitivity Lists HD
L
always
always @(data
@(data or
or enable
enable iff
iff enable
enable ==
== 1)
1)
out
out <=
<= enable;
enable;
Sutherland
Expressions in Sensitivity Lists HD
L
always
always @(
@( (a
(a ** b)
b) )) ...
...
always
always @(
@( memory[address]
memory[address] )) ...
...
always
always @(changed
@(changed (a
(a ** b)
b) )) ...
...
always
always @(changed
@(changed memory[address]
memory[address] )) ...
...
Sutherland
Specialized Procedural Blocks HD
L
Sutherland
Dynamic Processes HD
L
is reached
begin
begin Both
Both tasks
tasks run
run in
in parallel
parallel
process
process send_packet_task(1,255,0);
send_packet_task(1,255,0);
process
process send_packet_task(7,128,5);
send_packet_task(7,128,5); Will
Will end
end without
without waiting
waiting
end
end for
for tasks
tasks to
to finish
finish
Stuart Sutherland, Sutherland HDL, Inc. 35
Static and Automatic March 11 - 12, 2002
Sutherland
Task/Function Enhancements HD
L
! SystemVerilog adds:
! Static storage in an automatic task or function
Sutherland
in Tasks and Functions HD
L
in a beginend block
Sutherland
Enhancements HD
L
assignments
! The reg variable type cannot be used
Sutherland
State Machine Modeling HD
L
! Enumerated types
Sutherland
Assertions HD
L
Sutherland
Status of SystemVerilog HD
L
(e.g. defparam)
! Review for accuracy
Sutherland
Plans for SystemVerilog HD
L
synthesis
! Accellera will turn over SystemVerilog to the IEEE 1364
Verilog standards group
! Accellera hopes the IEEE will use SystemVerilog as a basis
Sutherland
Conclusion HD
L
instead of 4 or 5 years
Sutherland
HD
L
Any Questions?
A
A copy
copy of
of this
this presentation
presentation will
will be
be available
available at
at
www.sutherland-hdl.com
www.sutherland-hdl.com