Line 78... |
Line 78... |
end
|
end
|
end
|
end
|
end
|
end
|
endgenerate
|
endgenerate
|
|
|
reg [7:0] count;
|
reg [15:0] count;
|
always @(posedge clk)
|
always @(posedge clk)
|
if (rst) begin
|
if (rst) begin
|
adr <= 0;
|
adr <= 0;
|
count <= 0;
|
count <= 0;
|
end
|
end
|
Line 91... |
Line 91... |
if (adr==0) begin
|
if (adr==0) begin
|
outfile = $fopen("f:/cores2022/Float/dfpu/test_bench/DFPAddsub96_tvo.txt", "wb");
|
outfile = $fopen("f:/cores2022/Float/dfpu/test_bench/DFPAddsub96_tvo.txt", "wb");
|
$fwrite(outfile, " rm ------- A ------ ------- B ------ ------ sum ----- -- SIM Sum --\n");
|
$fwrite(outfile, " rm ------- A ------ ------- B ------ ------ sum ----- -- SIM Sum --\n");
|
end
|
end
|
count <= count + 1;
|
count <= count + 1;
|
if (count > 35)
|
if (count > 50)
|
count <= 1'd1;
|
count <= 1'd1;
|
if (count==2) begin
|
if (count==2) begin
|
a <= a1;
|
a <= a1;
|
b <= b1;
|
b <= b1;
|
a[95:92] <= 4'h5;
|
a[95:92] <= 4'h5;
|
b[95:92] <= 4'h5;
|
b[95:92] <= 4'h5;
|
rm <= adr[14:12];
|
rm <= adr[14:12];
|
//ad <= memd[adr][63: 0];
|
//ad <= memd[adr][63: 0];
|
//bd <= memd[adr][127:64];
|
//bd <= memd[adr][127:64];
|
end
|
end
|
if (adr==1 && count==2) begin
|
|
a <= 96'h25ff00000000000000000000; // 1
|
//-0 543771554911558566002677 581816070341546924523033 543771554911558566002677
|
b <= 96'h25ff00000000000000000000; // 1
|
|
|
if (adr==3 && count==2) begin
|
|
a <= 96'h543771554911558566002677;
|
|
b <= 96'h543716070341546924523033;
|
|
//a <= 96'h25ff00000000000000000000; // 1
|
|
//b <= 96'h25ff00000000000000000000; // 1
|
end
|
end
|
if (adr==2 && count==2) begin
|
if (adr==2 && count==2) begin
|
a <= 96'h260000000000000000000000; // 10
|
a <= 96'h260000000000000000000000; // 10
|
b <= 96'h260000000000000000000000; // 10
|
b <= 96'h25ff00000000000000000000; // 1
|
end
|
end
|
if (adr==3 && count==2) begin
|
if (adr==1 && count==2) begin
|
a <= 96'h260100000000000000000000; // 100
|
a <= 96'h260100000000000000000000; // 100
|
b <= 96'h260100000000000000000000; // 100
|
b <= 96'h25ff00000000000000000000; // 1
|
end
|
end
|
if (adr==4 && count==2) begin
|
if (adr==4 && count==2) begin
|
a <= 96'h260200000000000000000000; // 1000
|
a <= 96'h260200000000000000000000; // 1000
|
b <= 96'h260200000000000000000000; // 1000
|
b <= 96'h25ff00000000000000000000; // 1
|
end
|
end
|
if (adr==5 && count==2) begin
|
if (adr==5 && count==2) begin
|
a <= 96'h26064D2E7030000000000000; // 12345678
|
a <= 96'h26064D2E7030000000000000; // 12345678
|
b <= 96'h260000000000000000000000; // 10
|
b <= 96'h260000000000000000000000; // 10
|
end
|
end
|
Line 130... |
Line 135... |
end
|
end
|
if (adr==7 && count==2) begin
|
if (adr==7 && count==2) begin
|
a <= 96'h440040000000000000000000;
|
a <= 96'h440040000000000000000000;
|
b <= 96'h440040000000000000000000;
|
b <= 96'h440040000000000000000000;
|
end
|
end
|
if (count==35) begin
|
if (count==50) begin
|
if (adr[11]) begin
|
if (~adr[11]) begin
|
$fwrite(outfile, "%c%h\t%h\t%h\t%h\n", "-",rm, a, b, o);
|
$fwrite(outfile, "%c%h\t%h\t%h\t%h\n", "-",rm, a, b, o);
|
end
|
end
|
else begin
|
else begin
|
$fwrite(outfile, "%c%h\t%h\t%h\t%h\n", "+",rm, a, b, o);
|
$fwrite(outfile, "%c%h\t%h\t%h\t%h\n", "+",rm, a, b, o);
|
end
|
end
|
Line 145... |
Line 150... |
|
|
//fpMulnr #(64) u1 (clk, 1'b1, a, b, o, rm);//, sign_exe, inf, overflow, underflow);
|
//fpMulnr #(64) u1 (clk, 1'b1, a, b, o, rm);//, sign_exe, inf, overflow, underflow);
|
DFPAddsub96nr u6 (
|
DFPAddsub96nr u6 (
|
.clk(clk),
|
.clk(clk),
|
.ce(1'b1),
|
.ce(1'b1),
|
.op(adr[11]),
|
.op(~adr[11]),
|
.a(a),
|
.a(a),
|
.b(b),
|
.b(b),
|
.o(o),
|
.o(o),
|
.rm(rm)
|
.rm(rm)
|
);
|
);
|