From ec9536f983e5229b5e2d48ce5df4de9a46903a58 Mon Sep 17 00:00:00 2001 From: cturek Date: Thu, 14 Jul 2022 22:52:09 +0000 Subject: [PATCH] Square root radix 2 working, does not work with division --- pipelined/srt/srt.sv | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pipelined/srt/srt.sv b/pipelined/srt/srt.sv index 5dcf7e96f..949335bf0 100644 --- a/pipelined/srt/srt.sv +++ b/pipelined/srt/srt.sv @@ -75,7 +75,7 @@ module srt ( // Quotient Selection logic // Given partial remainder, select quotient of +1, 0, or -1 (qp, qz, pm) - qsel2 qsel2(WS[`DIVLEN+3:`DIVLEN-1], WC[`DIVLEN+3:`DIVLEN-1], qp, qz, qn); + qsel2 qsel2(WS[`DIVLEN+3:`DIVLEN-1], WC[`DIVLEN+3:`DIVLEN-1], Sqrt, qp, qz, qn); flopen #(`NE) expflop(clk, Start, calcExp, rExp); flopen #(1) signflop(clk, Start, calcSign, rsign); @@ -170,6 +170,7 @@ endmodule ///////////////////////////////// module qsel2 ( // *** eventually just change to 4 bits input logic [`DIVLEN+3:`DIVLEN-1] ps, pc, + input logic Sqrt, output logic qp, qz, qn ); @@ -185,7 +186,7 @@ module qsel2 ( // *** eventually just change to 4 bits assign g = ps & pc; assign #1 magnitude = ~(&p[`DIVLEN+2:`DIVLEN-1]); - assign #1 cout = g[`DIVLEN+2] | (p[`DIVLEN+2] & (g[`DIVLEN+1] | p[`DIVLEN+1] & (g[`DIVLEN] | (p[`DIVLEN] & g[`DIVLEN-1])))); + assign #1 cout = g[`DIVLEN+2] | (p[`DIVLEN+2] & (g[`DIVLEN+1] | p[`DIVLEN+1] & (g[`DIVLEN] | (Sqrt & (p[`DIVLEN] & g[`DIVLEN-1]))))); assign #1 sign = p[`DIVLEN+3] ^ cout; /* assign #1 magnitude = ~((ps[54]^pc[54]) & (ps[53]^pc[53]) & (ps[52]^pc[52]));