I wanted to use floating point numbers in System Verilog using the real
data type. I tried the following code, but it doesn't seem to work. I'm getting 2.000000
where I expect 2.500000
.
Module:
module real_check(input [31:0]a, [31:0]b,
output real c);
assign c = a/b;
endmodule
Test bench:
module tb_real_check();
real c;
reg[31:0] a, b;
real_check dut(a, b, c);
initial
begin
a <= 5;
b <= 2;
#50;
$display("Answer : %f ", c);
end
endmodule