Line 3... |
Line 3... |
module fpu_mul_tb;
|
module fpu_mul_tb;
|
|
|
reg clk;
|
reg clk;
|
reg rst;
|
reg rst;
|
reg enable;
|
reg enable;
|
|
reg [1:0]rmode;
|
reg [63:0]opa;
|
reg [63:0]opa;
|
reg [63:0]opb;
|
reg [63:0]opb;
|
wire ready;
|
wire ready;
|
wire [63:0] outfp;
|
wire [63:0] outfp;
|
|
|
|
|
|
|
|
|
fpu_mul UUT (
|
fpu_mul UUT (
|
.clk(clk),
|
.clk(clk),
|
.rst(rst),
|
.rst(rst),
|
.enable(enable),
|
.enable(enable),
|
|
.rmode(rmode),
|
.opa(opa),
|
.opa(opa),
|
.opb(opb),
|
.opb(opb),
|
.ready(ready),
|
.ready(ready),
|
.outfp(outfp));
|
.outfp(outfp));
|
|
|
initial
|
initial
|
begin : STIMUL
|
begin : STIMUL
|
#0
|
#0
|
rst = 1'b1;
|
|
enable = 1'b0;
|
enable = 1'b0;
|
#10000;
|
rst = 1'b1;
|
rst = 1'b0;
|
#10000; //0
|
enable = 1'b1;
|
enable = 1'b1;
|
//inputA:5.6700000000e+001
|
rst = 1'b0;
|
//inputB:2.9900000000e+000
|
//inputA:9.6300000000e+001
|
opa = 64'b0100000001001100010110011001100110011001100110011001100110011010;
|
//inputB:-2.5600000000e-001
|
opb = 64'b0100000000000111111010111000010100011110101110000101000111101100;
|
opa = 64'b0100000001011000000100110011001100110011001100110011001100110011;
|
#10000;
|
opb = 64'b1011111111010000011000100100110111010010111100011010100111111100;
|
//inputA:3.6600000000e-003
|
rmode = 2'b11;
|
//inputB:9.9700000000e-008
|
#10000;
|
opa = 64'b0011111101101101111110111001001110001001101101010010000000001000;
|
//inputA:3.6600000000e+000
|
opb = 64'b0011111001111010110000110101010011110010110110010100110101111010;
|
//inputB:2.2500000000e+000
|
#10000;
|
opa = 64'b0100000000001101010001111010111000010100011110101110000101001000;
|
//inputA:4.5000000000e+048
|
opb = 64'b0100000000000010000000000000000000000000000000000000000000000000;
|
//inputB:2.0000000000e+067
|
rmode = 2'b00;
|
opa = 64'b0100101000001000101000011101011111010100101101100000000110000001;
|
#10000;
|
opb = 64'b0100110111100111101111010010100111010001110010000111101000011001;
|
//inputA:-5.6970000000e+001
|
#10000;
|
//inputB:1.2340000000e-001
|
//inputA:2.9999997039e-317
|
opa = 64'b1100000001001100011111000010100011110101110000101000111101011100;
|
//inputB:4.0000000000e+067
|
opb = 64'b0011111110111111100101110010010001110100010100111000111011110011;
|
opa = 64'b0000000000000000000000000000000000000000010111001010011100000011;
|
rmode = 2'b11;
|
opb = 64'b0100110111110111101111010010100111010001110010000111101000011001;
|
#10000;
|
#10000;
|
//inputA:4.5680000000e+001
|
//inputA:-4.6990000000e+000
|
//inputB:2.1300000000e+000
|
//inputB:6.0000000000e+089
|
opa = 64'b0100000001000110110101110000101000111101011100001010001111010111;
|
opa = 64'b1100000000010010110010111100011010100111111011111001110110110010;
|
opb = 64'b0100000000000001000010100011110101110000101000111101011100001010;
|
opb = 64'b0101001010010010110110011101010111010010010011000000001010101011;
|
rmode = 2'b00;
|
#10000;
|
#10000;
|
//inputA:3.0000000000e-200
|
//inputA:3.0000000000e-311
|
//inputB:4.0000000000e-077
|
//inputB:-4.0000000000e+060
|
opa = 64'b0001011010000010010111101110110110001111111110110011100111000001;
|
opa = 64'b0000000000000000000001011000010111000011011011101010101101110011;
|
opb = 64'b0011000000010010100001101101100000001110110000011001000011011100;
|
opb = 64'b1100110010000011111010011110010011100100110000101111001101000100;
|
|
rmode = 2'b10;
|
|
#10000;
|
|
//inputA:4.6300000000e+001
|
|
//inputB:2.3110000000e+001
|
|
opa = 64'b0100000001000111001001100110011001100110011001100110011001100110;
|
|
opb = 64'b0100000000110111000111000010100011110101110000101000111101011100;
|
|
rmode = 2'b00;
|
#10000;
|
#10000;
|
//inputA:5.0000000000e-250
|
//inputA:5.0000000000e-250
|
//inputB:4.0000000000e-100
|
//inputB:-1.#INF000000e+000
|
opa = 64'b0000110000101100101000111000111100110101000010110010001011011111;
|
opa = 64'b0000110000101100101000111000111100110101000010110010001011011111;
|
opb = 64'b0010101101001011111111110010111011100100100011100000010100110000;
|
opb = 64'b1111111111110000000000000000000000000000000000000000000000000000;
|
|
rmode = 2'b11;
|
#10000;
|
#10000;
|
//inputA:1.#INF000000e+000
|
//inputA:
|
//inputB:2.0000000000e-200
|
//inputB:
|
opa = 64'b0111111111110000000000000000000000000000000000000000000000000000;
|
opa = 64'b0100000000111111111111111111111111111111111111111111111111111110;
|
opb = 64'b0001011001111000011111101001001000010101010011101111011110101100;
|
opb = 64'b0100000000110000000000000000000000000000000000000000000000000001;
|
|
rmode = 2'b00;
|
|
#10000;
|
|
//inputA:1.2000000000e-001
|
|
//inputB:5.2000000000e+001
|
|
opa = 64'b0011111110111110101110000101000111101011100001010001111010111000;
|
|
opb = 64'b0100000001001010000000000000000000000000000000000000000000000000;
|
|
rmode = 2'b00;
|
#10000;
|
#10000;
|
//inputA:8.9999000000e+004
|
//inputA:8.9999000000e+004
|
//inputB:1.6000000000e+001
|
//inputB:1.6000000000e+001
|
opa = 64'b0100000011110101111110001111000000000000000000000000000000000000;
|
opa = 64'b0100000011110101111110001111000000000000000000000000000000000000;
|
opb = 64'b0100000000110000000000000000000000000000000000000000000000000000;
|
opb = 64'b0100000000110000000000000000000000000000000000000000000000000000;
|
//Output:1.695330000000000e+002
|
rmode = 2'b10;
|
#100000;
|
|
if (outfp==64'h4065310E56041894)
|
#120000;
|
|
//Output:-2.465280000000000e+001
|
|
if (outfp==64'hC038A71DE69AD42D)
|
|
$display($time,"ps Answer is correct %h", outfp);
|
|
else
|
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
|
#10000; //0
|
|
//Output:8.235000000000001e+000
|
|
if (outfp==64'h40207851EB851EB8)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
#10000; //0
|
#10000; //0
|
//Output:3.649020000000000e-010
|
//Output:-7.030098000000000e+000
|
if (outfp==64'h3DF9136C82DFC196)
|
if (outfp==64'hC01C1ED20296B335)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
#10000; //0
|
#10000; //0
|
//Output:8.999999999999999e+115
|
//Output:9.729840000000000e+001
|
if (outfp==64'h580245EF347B07BD)
|
if (outfp==64'h40585318FC504817)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
#10000; //0
|
#10000; //0
|
//Output:1.199999881578528e-249
|
//Output:-0
|
if (outfp==64'h0000000000000000)
|
if (outfp==64'h8000000000000000)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
#10000; //0
|
#10000; //0
|
//Output:-2.819400000000000e+090
|
//Output:1.069993000000000e+003
|
if (outfp==64'hD2B625266303A947)
|
if (outfp==64'h4090B7F8D4FDF3B6)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
#10000; //0
|
#10000; //0
|
//Output:1.200000000000000e-276
|
//Output:-INF
|
if (outfp==64'h06A5459E5A08DFFE)
|
if (outfp==64'hFFF0000000000000)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
#10000; //0
|
#10000; //0
|
//Output:0.000000000000000e+000
|
//Output
|
if (outfp==64'h0000000000000000)
|
if (outfp==64'h4080000000000000)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
#10000; //0
|
#10000; //0
|
//Output:3.595386269724632e+108
|
//Output:6.240000000000000e+000
|
if (outfp==64'h7FF0000000000000)
|
if (outfp==64'h4018F5C28F5C28F6)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
|
|
#10000; //0
|
#10000; //0
|
//Output:1.439984000000000e+006
|
//Output:1.439984000000000e+006
|
if (outfp==64'h4135F8F000000000)
|
if (outfp==64'h4135F8F000000000)
|
$display($time,"ps Answer is correct %h", outfp);
|
$display($time,"ps Answer is correct %h", outfp);
|
else
|
else
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
$display($time,"ps Error! out is incorrect %h", outfp);
|
#130000;
|
|
|
#290000; //10000
|
$finish;
|
$finish;
|
end
|
end // end of stimulus process
|
|
|
always
|
always
|
begin : CLOCK_clk
|
begin : CLOCK_clk
|
|
|
clk = 1'b0;
|
clk = 1'b0;
|