I have made two files (or_gate
and or_gate_tb
) in vscode, and I am trying to run using the following command on the macOS terminal:
iverilog -o or_gate.vvp or_gate_tb.v
This is my result, and I can not find anything wrong with my code:
./or_gate.v:2: error: 'a' has already been declared in this scope.
./or_gate.v:1: : It was declared here as a net.
./or_gate.v:3: error: 'b' has already been declared in this scope.
./or_gate.v:1: : It was declared here as a net.
./or_gate.v:5: syntax error
./or_gate.v:5: error: Syntax error in continuous assignment
or_gate_tb.v:47: syntax error
or gate tb.v:47: error: Malformed statement
Below is my testbench file:
`include "or_gate.v"
module or_gate_tb();
reg a_tb;
reg b_tb;
wire c_tb;
/// here the test bench register values go into input of or_gate module inputs
or_gate a1(.a(a_tb),
.b(b_tb),
.c(c_tb) );
// truth table of or gate
initial begin
//row1 of truth table
// start at t ~ 0
a_tb = 0;
b_tb = 0;
#50
//row2 of truth table
// start at t ~ 50
a_tb = 0;
b_tb = 1;
#50
//row1 of truth table
// start at t ~ 100;
a_tb = 1;
b_tb = 0;
#50
//row1 of truth table
// start at t ~ 150;
a_tb = 1;
b_tb = 1;
#50
#500 $finish;
end
initial begin
$dumpfile("or_gate_tb.vcd")
$dumpvars(0,or_gate_tb);
end
endmodule
I am not sure what I am doing wrong. I have run the iverilog
command in both terminals, and I am getting the same result.