Ready-to-run snippets

Code Examples

Ready-to-run Verilog, SystemVerilog, and UVM examples. Click any to open it live in the IDE.

← All examples

Enhanced Literal

SystemVerilog Data Types

Example of how ' literal can be used to assign full 1s

Open in IDE
Related tutorial:
design.v
module tb;
  reg [7:0]  m_var1;
  reg [15:0] m_var2;

  initial begin
    m_var1 = '1;
    m_var2 = '1;

    $display("m_var1=0x%0h  m_var2=0x%0h", m_var1, m_var2);

    // This does not work - Radix must be specified !
    //m_var1 = 'F0;
    //m_var2 = 'cafe;
  end
endmodule
testbench.v
// Enter testbench code
Admin mode — edit and delete controls are visible on each row. Use the IDE to add new snippets via File → Save as Snippet.