Funvizeo logo
  • Contents
      • Back
      • Verilog
      • SystemVerilog
      • UVM
      • Digital Basics
      • Verification
Most Popular
Verification
  Testbench Evolution
  Constraint Random Verification
  Verification Techniques
  Verification Plan
  Code Coverage

Verilog
  Data Types
  Basic Constructs
  Behavioral Modeling
  Gate Modeling
  Simulation Basics
  Design Examples
  Interview Questions

SystemVerilog
  Data Types
  Class
  Interface
  Constraints and more!
  Testbench Examples
  Interview Questions

UVM
  Sequences
  Testbench Components
  TLM Tutorial
  Register Model Tutorial
  Testbench Examples
  Interview Questions

Digital Fundamentals
  Binary Arithmetic
  Boolean Logic
  Karnaugh Maps
  Combinational Logic
  Sequential Logic

Verilog $random

  1. Syntax

The system function $random provides a way to generate random numbers in Verilog. Each time it is called, the function returns a new 32-bit random number, which is a signed integer that can be either positive or negative.

Syntax


$random([seed]);

The seed argument controls the output of the $random function, ensuring that different seeds produce distinct random streams. This seed argument can be a reg, an integer, or a time variable. It is important to assign a value to this variable before calling $random.

Read more: Verilog $random

Verilog VCD Dump

A VCD file is an ASCII file that includes header information, definitions of variables, and the value changes for all variables specified in the task calls. Various system tasks can be incorporated into the source description to create and manage the VCD file.

Read more on Value Change Dump (VCD) !

Simulation variables can be dumped into a VCD file using the following tasks:

Read more: Verilog VCD Dump

Verilog VCD

VCD files, or Value Change Dump files, are a standardized ASCII format used to store simulation data from Verilog and other hardware description languages. They are primarily utilized for recording and analyzing the changes in values of variables during a simulation.

VCD files are generated by simulation tools to capture the state changes of signals over time. This data can be visualized using waveform viewers, allowing designers to analyze the behavior of their digital designs.

Read more: Verilog VCD

Verilog Namespace

  1. Global Namespace

In Verilog, namespaces are a way to organize and manage identifiers (such as variables, types, tasks, and functions) to avoid naming conflicts and improve code modularity. There are multiple namespaces; two are classified as global, while the others are local. The global namespaces consist of definitions and text macros.

Global Namespace

The definitions namespace consolidates all module and primitive definitions. Once a name is assigned to a module or primitive, it cannot be reused to declare another module or primitive.


module A;
  // Statements
endmodule

// cannot use 'module A' because it is already declared in global namespace
module B;  
  // Statements
endmodule

Read more: Verilog Namespace

Verilog $stop $finish

  1. $stop

In Verilog, the $stop and $finish system tasks are both used to end the simulation, but they serve different purposes.

These are called simulation control system tasks and is typically used in a testbench to end advancement of time, especially if there is an infinite loop by a forever loop or an always block with no sensitivity list. Note that initial blocks exit automatically after executing all statements within it.

$stop


  $stop([N]);

  // where N is
  // 0   :   Prints nothing
  // 1   :   Prints simulation time and location
  // 2   :   Prints simulation time, location, and statistics about the memory
  //         and central processing unit (CPU) time used in simulation

The $stop task is used to pause the simulation at a specific point. When invoked, it effectively acts like a breakpoint, allowing the user to inspect the current state of the simulation without terminating it. You can resume the simulation manually after examining the state.

Read more: Verilog $stop $finish

  1. Verilog Specify Block
  2. Verilog FSM
  3. Verilog sdf_annotate
  4. Gate Level Simulations
  5. Standard Delay Format (SDF)

Page 1 of 68

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
Interview Questions
  Verilog Interview Set 1
  Verilog Interview Set 2
  Verilog Interview Set 3
  Verilog Interview Set 4
  Verilog Interview Set 5

  SystemVerilog Interview Set 1
  SystemVerilog Interview Set 2
  SystemVerilog Interview Set 3
  SystemVerilog Interview Set 4
  SystemVerilog Interview Set 5

  UVM Interview Set 1
  UVM Interview Set 2
  UVM Interview Set 3
  UVM Interview Set 4
Related Topics
  Digital Fundamentals
  Verilog Tutorial

  Verification
  SystemVerilog Tutorial
  UVM Tutorial
Latest in Verilog
  • Verilog $random
  • Verilog VCD Dump
  • Verilog VCD
  • Verilog Namespace
  • Verilog $stop $finish
Latest in SystemVerilog
  • SystemVerilog Callback
  • SystemVerilog Interview Questions Set 10
  • SystemVerilog Interview Questions Set 9
  • SystemVerilog Interview Questions Set 8
  • SystemVerilog Interview Questions Set 7
Latest in UVM
  • UVM Callback
  • UVM Singleton Object
  • UVM Component [uvm_component]
  • UVM Object [uvm_object]
  • UVM Root [uvm_root]
© 2025 Funvizeo
Terms and Conditions