I am trying to test ReLU, but it always gives 'x' for the output.
//Relu.sv////
module ReLU # (parameter Width=8)
( input signed [2*Width -1:0] dataInput,
output reg signed [2*Width -1:0] dataOutput
);
always @*
begin
dataOutput = (dataInput[(2*Width)-1]==0)? dataInput : {2*Width-1{1'b0}};
end
endmodule
//////Relu_TB.sv/////////////////
`timescale 1ns/1ns
module ReLU_TB # (parameter Width=8);
reg signed [2*Width -1:0] dataInput;
wire signed [2*Width -1:0] dataOutput;
reg signed [2*Width -1:0]dataOutput1;
//UUT
ReLU ReluTest
(
.dataInput(dataInput),
.dataOutput(dataOutput)
);
initial
begin
$display("Start of Initial\n");
#50
dataInput=127;
$display("input val= %d\n", dataInput);
if(dataInput[(2*Width)-1]==0) begin
dataOutput1=dataInput;
end
else
begin
dataOutput1=0;
end
$display("out val= %d %d\n",dataOutput,dataOutput1);
end
endmodule
///////////////////////////////
//Results
# Start of Initial
#
# input val= 127
#
# out val= x 127
#