Skip to content

csinha134/iverilog-embed-sys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Verilog Setup and Execution Guide

This guide provides instructions on how to set up and run Verilog files with a testbench on your device. Verilog is a hardware description language used for modeling and simulating digital circuits.

Table of Contents

  1. Prerequisites
  2. Installing Verilog Tools
  3. Running Verilog Files with a Testbench
  4. Example Verilog Files
  5. Additional Resources

Prerequisites

Before you can run Verilog files with a testbench, ensure you have the following prerequisites:

  • A working computer with a compatible operating system (Windows, macOS, or Linux).
  • An integrated development environment (IDE) or text editor of your choice (e.g., Visual Studio Code, Sublime Text, or Notepad++).
  • A Verilog simulator for compiling and executing Verilog files. We recommend Icarus Verilog (iverilog) for this guide.

Installing Verilog Tools

Step 1: Download and Install Icarus Verilog

  1. Visit the Icarus Verilog website at http://iverilog.icarus.com/.

  2. Download the appropriate version of Icarus Verilog for your operating system (Windows, macOS, or Linux).

  3. Follow the installation instructions provided on the website to complete the installation.

Step 2: Verify the Installation

To verify that Icarus Verilog has been successfully installed, open a command prompt or terminal window and run the following command:

iverilog -v

You should see the version information for Icarus Verilog.

Running Verilog Files with a Testbench

Step 1: Create Verilog Files

  1. Create two Verilog files: one for your main design module (e.g., my_design.v) and another for your testbench (e.g., my_design_tb.v).

  2. Write your Verilog code for the main design module in my_design.v and the testbench code in my_design_tb.v.

Step 2: Compile and Simulate

  1. Open a command prompt or terminal window.

  2. Navigate to the directory where your Verilog files are located:

    cd /path/to/your/verilog/files
  3. Compile both your main design module and the testbench using Icarus Verilog:

    iverilog -o my_simulation my_design.v my_design_tb.v

    This command generates an executable file named my_simulation.

  4. Run the simulation:

    vvp my_simulation
  5. Observe the simulation results and any output as specified in your Verilog code and testbench.

Example Verilog Files

Here's a simple example of a Verilog main design module and its corresponding testbench:

Main Design Module (my_design.v)

module and_gate (
  input a,
  input b,
  output y
);
  assign y = a & b;
endmodule

Testbench (my_design_tb.v)

module and_gate_tb;
  reg a, b;
  wire y;

  and_gate my_and_gate(a, b, y);

  initial begin
    a = 0;
    b = 0;
    #10
    a = 0;
    b = 1;
    #10
    a = 1;
    b = 0;
    #10
    a = 1;
    b = 1;
    $finish;
  end
endmodule

Additional Resources

That's it! You've now installed Verilog tools and learned how to run Verilog files with a testbench on your device. Feel free to explore more advanced Verilog topics and develop your own digital circuit designs.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published