Verilog Compiler

Code
Output

        

What Is the Verilog Online Compiler?

This tool lets you compile and simulate Verilog HDL (Hardware Description Language) code directly in your browser without installing any EDA tools. Whether you are learning digital design concepts or quickly testing a module, this compiler provides instant simulation results.

Verilog is one of the most widely used hardware description languages for designing and verifying digital circuits, from simple logic gates to complex processors and FPGA designs. This online environment uses Icarus Verilog, an open-source Verilog simulation and synthesis tool, to compile and simulate your designs.

All code executes on a remote sandboxed server powered by the Piston API. Your browser sends the Verilog source to the server, which compiles it with Icarus Verilog, runs the simulation, and returns the text output including any $display or $monitor messages.

How It Works

  1. Write your Verilog code in the editor panel. The editor starts with a simple module that prints a message using $display. You can replace it with any valid Verilog design and testbench.
  2. Include a testbench in the same file to drive your design. Use initial blocks with $display statements to observe signal values during simulation.
  3. Click the Run button to send your code to the Piston execution server. The server compiles your Verilog source with Icarus Verilog and runs the simulation.
  4. View the results in the Output panel. You will see all text output from system tasks like $display, $monitor, and $write, along with any compilation errors or warnings.

Step-by-Step Example

Suppose you want to design a simple 2-to-1 multiplexer and verify it with a testbench. Here is how you would do it:

First, type the following code into the editor panel:

module mux2to1(input a, input b, input sel, output y);
    assign y = sel ? b : a;
endmodule

module tb_mux;
    reg a, b, sel;
    wire y;

    mux2to1 uut(.a(a), .b(b), .sel(sel), .y(y));

    initial begin
        $monitor("a=%b b=%b sel=%b | y=%b", a, b, sel, y);
        a = 0; b = 0; sel = 0; #10;
        a = 1; b = 0; sel = 0; #10;
        a = 0; b = 1; sel = 1; #10;
        a = 1; b = 1; sel = 1; #10;
        $finish;
    end
endmodule

Click the Run button. The compiler builds your design and runs the simulation. The Output panel displays the monitored signal values at each time step:

a=0 b=0 sel=0 | y=0
a=1 b=0 sel=0 | y=1
a=0 b=1 sel=1 | y=1
a=1 b=1 sel=1 | y=1

You can verify that when sel=0 the output follows input a, and when sel=1 the output follows input b.

Use Cases

Limitations and Notes

Frequently Asked Questions

What Verilog version does this compiler use?

It uses Icarus Verilog provided by the Piston execution engine.

Does this support SystemVerilog?

SystemVerilog support is limited. Icarus Verilog supports some SystemVerilog features but not the full specification.

Can I write testbenches?

Yes, you can write testbenches with initial blocks, $display, $monitor, and $finish to verify your designs.

Does this support synthesis?

No, this is a simulation-only environment. It compiles and simulates your Verilog code but does not perform synthesis for hardware.

Do $display and $monitor work?

Yes, system tasks like $display, $monitor, $write, and $strobe work and their output appears in the output panel.

Can I use always blocks?

Yes, always blocks with sensitivity lists are fully supported for modeling combinational and sequential logic.

Can I instantiate modules?

Yes, you can define multiple modules in a single file and instantiate them to build hierarchical designs.

Can I generate VCD output?

VCD output support is limited. While $dumpfile and $dumpvars compile, the generated VCD files cannot be downloaded or viewed as waveforms in this environment.

Sources and References

Related Compilers