From 4a4f153eef5bb2756340861e37c065a576d0e451 Mon Sep 17 00:00:00 2001 From: cturek Date: Thu, 26 May 2022 16:45:28 +0000 Subject: [PATCH] Set up the divider for on-the-fly conversion --- addins/riscv-arch-test | 2 +- pipelined/srt/srt.sv | 19 ++++++++++++++++++- pipelined/srt/testbench.sv | 11 +++++++++-- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/addins/riscv-arch-test b/addins/riscv-arch-test index be67c99b..307c77b2 160000 --- a/addins/riscv-arch-test +++ b/addins/riscv-arch-test @@ -1 +1 @@ -Subproject commit be67c99bd461742aa1c100bcc0732657faae2230 +Subproject commit 307c77b26e070ae85ffea665ad9b642b40e33c86 diff --git a/pipelined/srt/srt.sv b/pipelined/srt/srt.sv index bbcabccb..c5e83718 100644 --- a/pipelined/srt/srt.sv +++ b/pipelined/srt/srt.sv @@ -47,7 +47,7 @@ module srt #(parameter Nf=52) ( input logic Int, // Choose integer inputss input logic Sqrt, // perform square root, not divide output logic rsign, - output logic [Nf-1:0] Quot, Rem, // *** later handle integers + output logic [Nf-1:0] Quot, Rem, QuotOTFC, // *** later handle integers output logic [`NE-1:0] rExp, output logic [3:0] Flags ); @@ -91,6 +91,8 @@ module srt #(parameter Nf=52) ( signcalc signcalc(.XSign, .YSign, .calcSign); srtpostproc postproc(rp, rm, Quot); + + otfc otfc(qp, qz, qm, Quot, QuotOTFC); endmodule module srtpostproc #(parameter N=52) ( @@ -210,9 +212,24 @@ module qacc #(parameter N=55) ( end */ endmodule +////////// +// otfc // +////////// + +module otfc #(parameter N=52) ( + input logic qp, qz, qm, + input logic [N-1:0] Quot, + output logic [N-1:0] QuotOTFC +); + + assign QuotOTFC = Quot; + +endmodule + ///////// // inv // ///////// + module inv(input logic [55:0] in, output logic [55:0] out); diff --git a/pipelined/srt/testbench.sv b/pipelined/srt/testbench.sv index 08b5d0d7..022fa845 100644 --- a/pipelined/srt/testbench.sv +++ b/pipelined/srt/testbench.sv @@ -44,7 +44,7 @@ module testbench; logic [51:0] afrac, bfrac; logic [10:0] aExp, bExp; logic asign, bsign; - logic [51:0] r; + logic [51:0] r, rOTFC; logic [54:0] rp, rm; // positive quotient digits // Test parameters @@ -72,7 +72,7 @@ module testbench; .SrcXFrac(afrac), .SrcYFrac(bfrac), .SrcA('0), .SrcB('0), .Fmt(2'b00), .W64(1'b0), .Signed(1'b0), .Int(1'b0), .Sqrt(1'b0), - .Quot(r), .Rem(), .Flags()); + .Quot(r), .QuotOTFC(rOTFC), .Rem(), .Flags()); // Counter counter counter(clk, req, done); @@ -117,6 +117,13 @@ module testbench; $display("failed\n"); $stop; end + if (r !== rOTFC) // Check if OTFC works + begin + errors = errors+1; + $display("OTFC is %h, should be %h\n", rOTFC, r); + $display("failed/n"); + $stop; + end if (afrac === 52'hxxxxxxxxxxxxx) begin $display("%d Tests completed successfully", testnum);