🧩 1. Install ModelSim
Download and install ModelSim (e.g., ModelSim PE, ModelSim Student Edition, or ModelSim-Altera/Intel FPGA Edition).
Follow the installer instructions and set up the environment variables (if required).
⚙️ 2. Create a New Project
Open ModelSim.
Go to File → New → Project.
Enter:
Project Name: e.g., MyVerilogProject
Project Location: choose a directory
Click OK → Add Existing File or Create New File to add your Verilog files (.v).
🧠3. Add Verilog Source Files
You typically have:
Design file — e.g., adder.v
Testbench file — e.g., tb_adder.v (used to test your design)
Example:
adder.v
module adder(a, b, sum);
input [3:0] a, b;
output [4:0] sum;
assign sum = a + b;
endmodule
tb_adder.v
module tb_adder;
reg [3:0] a, b;
wire [4:0] sum;
adder uut (.a(a), .b(b), .sum(sum));
initial begin
a = 4'b0011; b = 4'b0101;
#10;
a = 4'b1111; b = 4'b0001;
#10;
$stop;
end
endmodule
🧩 4. Compile the Code
In the Project window, right-click and select Compile → Compile All.
Check the Transcript window for compilation errors or warnings.
▶️ 5. Run the Simulation
Go to Simulate → Start Simulation.
Expand the work library → select your testbench module (e.g., tb_adder) → click OK.
A simulation window opens.
⏱️ 6. Add Signals to Waveform
In the Sim window, open the Objects tab (shows signals).
Select the signals you want to view (e.g., a, b, sum).
Right-click → Add → To Wave → Selected Signals.
Now your signals will appear in the waveform viewer.
▶️ 7. Run the Simulation
In the Simulation toolbar:
Click Run → Run 100ns (or type run 100 in the Transcript window).
You’ll see the signals change over time in the waveform viewer.
📊 8. Analyze Results
Use the waveform viewer to check that your outputs behave correctly.
You can zoom in/out or measure time intervals.
🧾 9. Optional: Save the Waveform Setup
To reuse your waveform configuration:
Go to File → Save Format in the Wave window.
ModelSim saves this as a .do file (waveform script).
✅ 10. End Simulation
When done, click Simulation → End Simulation.
You can modify your code and repeat the process as needed.
Learn VLSI Training in Hyderabad
Read More
VHDL Basics: Syntax and Structure
Parameterized Modules in Verilog
Visit Our Training Institute in Hyderabad
Subscribe by Email
Follow Updates Articles from This Blog via Email
No Comments