Friday 2 December 2016

Decoder ( VERILOG ) with Test Fixture



Test Fixture Program :-

module tf_Decoder_vlog;

// Inputs
reg e;
reg a;
reg b;

// Outputs
wire firstout;
wire secondout;
wire thirdout;
wire fourthout;

// Instantiate the Unit Under Test (UUT)
Decoder_vlog uut (
.e(e),
.a(a),
.b(b),
.firstout(firstout),
.secondout(secondout),
.thirdout(thirdout),
.fourthout(fourthout)
);

initial begin
// Initialize Inputs
e = 0; a = 0; b = 0; #100;
e = 1; a = 0; b = 0; #100;
e = 1; a = 0; b = 1; #100;
e = 1; a = 1; b = 0; #100;
e = 1; a = 1; b = 1; #100;
end
     
endmodule


--------------------------------------------------------------------------------------------------------------------------

Program for DECODER (  VERILOG  ) :-

module Decoder_vlog( input e,
input a, input b,
      output firstout,
output secondout,
output thirdout,
output fourthout);

assign firstout = (e & ~a & ~b) ;
assign secondout = (e & ~a & b) ;
assign thirdout = (e & a & ~b) ;
assign fourthout = (e & a & b) ;
endmodule




No comments:

Post a Comment