Hello World in Verilog

Our first program will print the classic “hello world” message. Here’s the full source code.

module HelloWorld;
  initial begin
    $display("hello world");
    $finish;
  end
endmodule

To run the program, you will typically use a Verilog simulator. Below is an example of how you would run it with a simulator like Icarus Verilog.

$ iverilog -o hello-world HelloWorld.v
$ ./hello-world
hello world

Sometimes we’ll want to run our programs directly. We can do this using a simulator command.

$ vvp hello-world
hello world

Now that we can run and build basic Verilog programs, let’s learn more about the language.