mirror of
https://github.com/openhwgroup/cvw
synced 2025-02-11 06:05:49 +00:00
Square root implemented
This commit is contained in:
parent
12a54161c0
commit
b505ef135d
@ -92,10 +92,10 @@ module srt (
|
|||||||
csa #(`DIVLEN+4) csa(WS, WC, Dsel, qp, WSA, WCA);
|
csa #(`DIVLEN+4) csa(WS, WC, Dsel, qp, WSA, WCA);
|
||||||
|
|
||||||
// If only implementing division, use divide otfc
|
// If only implementing division, use divide otfc
|
||||||
// otfc2 #(`DIVLEN) otfc2(clk, Start, qp, qz, qm, Quot);
|
otfc2 #(`DIVLEN) otfc2(clk, Start, qp, qz, qm, Quot);
|
||||||
// otherwise use sotfc
|
// otherwise use sotfc
|
||||||
creg sotfcC(clk, Start, C);
|
// creg sotfcC(clk, Start, C);
|
||||||
sotfc2 #(`DIVLEN) sotfc2(clk, Start, qp, qn, C, Quot);
|
// sotfc2 #(`DIVLEN) sotfc2(clk, Start, qp, qn, C, Quot);
|
||||||
|
|
||||||
expcalc expcalc(.XExp, .YExp, .calcExp, .Sqrt);
|
expcalc expcalc(.XExp, .YExp, .calcExp, .Sqrt);
|
||||||
|
|
||||||
@ -272,7 +272,7 @@ module sotfc2(
|
|||||||
|
|
||||||
flopr #(`DIVLEN+4) Sreg(clk, Start, SMNext, SM);
|
flopr #(`DIVLEN+4) Sreg(clk, Start, SMNext, SM);
|
||||||
mux2 #(`DIVLEN+4) Smux(SNext, {4'b0001, (`DIVLEN){1'b0}}, Start, SMux);
|
mux2 #(`DIVLEN+4) Smux(SNext, {4'b0001, (`DIVLEN){1'b0}}, Start, SMux);
|
||||||
flop #(`DIVLEN+4) SMreg(clk, SMux, M);
|
flop #(`DIVLEN+4) SMreg(clk, SMux, S);
|
||||||
|
|
||||||
always_comb begin
|
always_comb begin
|
||||||
if (sp) begin
|
if (sp) begin
|
||||||
|
@ -82,7 +82,7 @@ module testbench;
|
|||||||
|
|
||||||
// Equip Int test or Sqrt test
|
// Equip Int test or Sqrt test
|
||||||
assign Int = 1'b0;
|
assign Int = 1'b0;
|
||||||
assign Sqrt = 1'b1;
|
assign Sqrt = 1'b0;
|
||||||
|
|
||||||
// Divider
|
// Divider
|
||||||
srt srt(.clk, .Start(req),
|
srt srt(.clk, .Start(req),
|
||||||
@ -111,7 +111,7 @@ module testbench;
|
|||||||
begin
|
begin
|
||||||
testnum = 0;
|
testnum = 0;
|
||||||
errors = 0;
|
errors = 0;
|
||||||
$readmemh ("sqrttestvectors", Tests);
|
$readmemh ("testvectors", Tests);
|
||||||
Vec = Tests[testnum];
|
Vec = Tests[testnum];
|
||||||
a = Vec[`mema];
|
a = Vec[`mema];
|
||||||
{asign, aExp, afrac} = a;
|
{asign, aExp, afrac} = a;
|
||||||
|
Loading…
Reference in New Issue
Block a user