Verilog: simple 4 bit OR operation

//code

module ex1( c,a, b   );
output [3:0]c;
input [3:0]a;
input[3:0]b;
wire [3:0]c;
assign c= (a | b);
endmodule
   
//Testbench
`timescale 1ns / 1ps

module test2;

    // Inputs
    reg [3:0] a;
    reg [3:0] b;

    // Outputs
    wire [3:0] c;

    // Instantiate the Unit Under Test (UUT)
    ex1 uut (
        .c(c),
        .a(a),
        .b(b)
    );

    initial begin
        // Initialize Inputs
        a = 0;
        b = 0;

        // Wait 100 ns for global reset to finish
        #100;
       
        a=4'b0001;
        b=4'b0001;
        #100;
       
        a=4'b1001;
        b=4'b0001;
        #100;
       
        a=4'b0101;
        b=4'b0001;
        #100;
       
       
        // Add stimulus here

    end
     
endmodule





//Output

No comments:

Post a Comment