Skip to content
asicguru.tech@gmail.com
REGISTER LOGIN
AsicGuru Ventures
  • All Courses
  • CONTACT
  • GALLERY
  • HOME
  • Tutorials

0

Verilog Tutorial

17
  • Introduction
  • Lexical Tokens
  • Gate-Level Modelling
  • Data Types
  • Operators
  • Operands
  • Modules
  • Behavioral Modeling
  • Timing Controls
  • Procedures: Always and Initial Blocks
  • Functions
  • Tasks
  • Component Inference
  • Finite State Machines.
  • Compiler Directives
  • System Tasks and Functions
  • Test Benches

System Verilog

23
  • System Verilog Introduction
  • Data Types
  • Type Casting
  • Arrays
  • Associative Arrays
  • Dynamic Arrays
  • Queue
  • Operators
  • Procedural statements and Control flow
  • Classes
  • Inheritance
  • Encapsulation
  • This and Super operator
  • In-Line Constraints
  • Class Constraints
  • Virtual Classes
  • Parameterized Classes
  • Classes Summary
  • Singleton Classes
  • Functional Coverage Introduction
  • Covergroup
  • Tools
  • Books

Scripting

15
  • Introduction
  • Perl Tutorial
  • What is Perl
  • Perl: Syntax And Variable
  • Perl Strings
  • Perl Arrays
  • Perl Associative Arrays
  • If/While Syntax
  • File Input
  • Print Output
  • String Processing with Regular Expressions
  • Subroutines
  • Running External Programs
  • References
  • Terse Perl

Makefile

1
  • Makefile Tutorial

Interview Questions

2
  • SystemVerilog Interview Questions
  • Verilog Interview Questions

Handwritten Notes

3
  • Perl (Scripting)
  • Linting
  • CMOS Logic Design
View Categories
  • Home
  • Tutorials
  • System Verilog
  • Data Types

Data Types

2 min read

Introduction #

SystemVerilog enhances Verilog by introducing powerful and flexible data types. These allow better modeling of hardware behavior, efficient simulation, and support for object-oriented testbenches.

SystemVerilog data types fall into four main categories:

  1. Net Types
  2. Variable Types
  3. User-Defined Types
  4. Special Types (Queue, Enum, Struct, etc.)

1. Net Types #

What are Net Types?

Net types represent physical connections in hardware (e.g., wires). They model continuous assignments, like in combinational circuits.

Net TypeDescription
wireMost commonly used for connecting modules
triUsed for tri-state buses
wandWired-AND connection
worWired-OR connection

Example:

wire a, b, c;
assign c = a & b; // Continuous assignment

2. Variable Types #

What are Variable Types?

These are procedural storage types, used in always, initial, function, and task blocks. They hold values until explicitly changed.

SystemVerilog offers:

4-state types: can take values 0, 1, x, z

2-state types: only 0 or 1 (faster simulation)

4-State Variable Types

TypeDescription
logicReplacement for reg and wire (4-state)
regLegacy Verilog type (still works)
byte8-bit signed integer
shortint16-bit signed integer
int32-bit signed integer
longint64-bit signed integer
integer32-bit signed (legacy)
time64-bit unsigned for simulation time

2-State Variable Types

TypeDescription
bit1-bit 2-state logic

Example:

logic [3:0] a;       // 4-bit logic type
bit       enable;    // 1-bit, only 0 or 1
int       counter;   // 32-bit signed integer

3. User-Defined Types #

SystemVerilog allows creating your own types for better abstraction and reusability.

typedef #

Used to define a new name for an existing type.

typedef logic [7:0] byte_t;
byte_t data;

enum (Enumeration) #

Defines a set of named values (states, modes, etc.)

typedef enum {IDLE, READ, WRITE} state_t;
state_t current_state;

struct #

Used to group multiple related variables.

typedef struct {
  logic [7:0] addr;
  logic [7:0] data;
} packet_t;

packet_t pkt;

union #

Overlays multiple members in the same memory location.

typedef union {
  logic [15:0] half_word;
  logic [7:0]  bytes[2];
} data_u;

4. Special Types #

queue #

A dynamic, indexable array that can grow or shrink.

int queue1[$];        // Unbounded queue
queue1.push_back(10); // Add at end
queue1.pop_front();   // Remove from front

string #

Used to store text data.

string name = "SystemVerilog";
$display("Hello, %s", name);

Updated on August 3, 2025

What are your Feelings

  • Happy
  • Normal
  • Sad
Share This Article :
  • Facebook
  • X
  • LinkedIn
  • Pinterest
System Verilog IntroductionType Casting

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Table of Contents
  • Introduction
  • 1. Net Types
  • 2. Variable Types
  • 3. User-Defined Types
    • typedef
    • enum (Enumeration)
    • struct
    • union
  • 4. Special Types
    • queue
    • string

Archives

  • May 2025

Categories

  • Slider Post
  • Uncategorized

Copyright @ Asicguru Ventures by Misbah WP | Proudly powered by WordPress