mirror of
https://github.com/supleed2/cordic.git
synced 2024-12-22 05:35:51 +00:00
Further adjust bit offsets, improve accuracy from 1.34601 to 0.455326
This commit is contained in:
parent
8d276e71a4
commit
bbf9bf3f0c
|
@ -62,7 +62,7 @@ end
|
||||||
/* verilator lint_on ALWCOMBORDER */
|
/* verilator lint_on ALWCOMBORDER */
|
||||||
|
|
||||||
always_comb
|
always_comb
|
||||||
if (i_qph > 16'd65508) o_sin = 16'hFFFF;
|
if (i_qph > 16'd65508) o_sin = 16'hFFFE;
|
||||||
else if (i_qph < 16'd32) o_sin = i_qph + (i_qph >> 1);
|
else if (i_qph < 16'd32) o_sin = i_qph + (i_qph >> 1);
|
||||||
else o_sin = y[19][17:2];
|
else o_sin = y[19][17:2];
|
||||||
|
|
||||||
|
|
11
saw2sin.sv
11
saw2sin.sv
|
@ -22,8 +22,13 @@ cordic cordic
|
||||||
, .o_sin (qsin)
|
, .o_sin (qsin)
|
||||||
);
|
);
|
||||||
|
|
||||||
always_comb o_sin = invert
|
logic [16:0] sin;
|
||||||
? ~{1'b1, qsin[15:1]} + 1 // Invert
|
always_comb sin = reverse
|
||||||
: {1'b1, qsin[15:1]}; // Normal
|
? (invert ? ~{1'b1, qsin[15:0]} // Reverse, Invert
|
||||||
|
: {1'b1, qsin[15:0]} + 17'd1) // Reverse, Normal
|
||||||
|
: (invert ? ~{1'b1, qsin[15:0]} + 17'd2 // Normal, Invert
|
||||||
|
: {1'b1, qsin[15:0]} + 17'd0); // Normal, Normal
|
||||||
|
|
||||||
|
always_comb o_sin = sin[16:1];
|
||||||
|
|
||||||
endmodule
|
endmodule
|
||||||
|
|
Loading…
Reference in a new issue