System Verilog Data Type Part 1 1738628703
System Verilog Data Type Part 1 1738628703
LOGIC:
X UNKNOWN
Z HIGH IMPEDENCE
1
SYSTEM VERILOG DATA TYPES BY VIKRAM RENESAS
SIMPLE CODE:
Logic data type used for sequential assignment
Logic data type used for procedural assignment
Logic used for module & gates
EDA EXAMPLE:
https://edaplayground.com/x/vyxH
2
SYSTEM VERILOG DATA TYPES BY VIKRAM RENESAS
DEFAULT/RESET/INITIAL VALUES:
EDA EXAMPLE:
https://edaplayground.com/x/iG47
3
SYSTEM VERILOG DATA TYPES BY VIKRAM RENESAS
Result
4
SYSTEM VERILOG DATA TYPES BY VIKRAM RENESAS
5
SYSTEM VERILOG DATA TYPES BY VIKRAM RENESAS
o Signed and unsigned versions of these types also exist (like reg
signed [3:0] or wire [7:0]).
https://edaplayground.com/x/ngS5
Result:
Compiler version U-2023.03-SP2_Full64; Runtime version U-2023.03-
SP2_Full64; Jan 29 04:22 2025
Data value: xx01
The register 'data' contains an unknown value (x or z).
The wire 'signal' contains an unknown value (x or z).
VCS Simulation Report
6
SYSTEM VERILOG DATA TYPES BY VIKRAM RENESAS
Explanation:
Key Points:
1. Unsigned:
o Used for variables that should only hold non-negative values.
o Example: reg [7:0] unsigned_data;
2. Signed:
o Used for variables that can hold both positive and negative values.
o Example: reg signed [7:0] signed_data;
3. Two's Complement Representation:
o SystemVerilog uses two's complement to represent negative
numbers in signed types.
o The MSB (Most Significant Bit) determines the sign: 0 for positive
and 1 for negative.
4. No Implicit Sign:
o If you declare a variable with no explicit signed or unsigned,
SystemVerilog assumes unsigned by default.
7
SYSTEM VERILOG DATA TYPES BY VIKRAM RENESAS
8
SYSTEM VERILOG DATA TYPES BY VIKRAM RENESAS
Result:
FINAL CONCLUSION:
Data Default Bit Width Signed/Unsigned 2-State / Floating
Type Value 4-State Point
int 0 32 bits Signed 2-state No
reg x (unknown) Depends Can be signed or 4-state No
on size unsigned
(commonly
32 bits)
wire z (high Depends Can be signed or 4-state No
impedance) on size unsigned
(commonly
1 bit)
logic x (unknown) Depends Can be signed or 4-state No
on size unsigned
(commonly
1 bit)
bit 0 1 bit Unsigned 2-state No
byte 8'bxxxxxxxx 8 bits Unsigned 4-state No
(unknown)
shortint 0 16 bits Signed 2-state No
longint 0 64 bits Signed 2-state No
real 0 64 bits N/A (Floating- 2-state Yes
point)
string "" (empty Dynamic N/A (Strings are N/A No
string) (variable not (Variable
length) signed/unsigned) length)