How to Simulate Verilog code 3
How to Simulate Verilog code 3
Click on Login
You need to insert your Verilog code for your design in design.sv tab. You can try the following code
for the 2-input XOR gate. Note that a statement starting with // indicates a comment.
module xor_2_to_1 (input wire A, B,
output wire Y);
endmodule
To verify the functionality of your design you need to apply a stimulus to the inputs. To do that you
need to insert your testbench code in testbench.sv tab.
//Design (Unit Under Test (UUT)) is instantiated as component (sub-system) of the testbench
// UUT port map
//Syntax is UUT_name instance_name (.port1_name(signal1_name, .port1_name(signal1_name)…);
xor_2_to_1 U1 (.A(A), .B(B), .Y(Y));
initial
begin
#200; //wait for 200ns
$dumpfile("dump.vcd"); //needed for EDA Playground
$finish; //Stop the simulation
end
endmodule
Project Link
https://edaplayground.com/x/8Z2f