Further adjust bit offsets, improve accuracy from 1.34601 to 0.455326

This commit is contained in:
Aadi Desai 2023-05-30 13:49:23 +01:00
parent 8d276e71a4
commit bbf9bf3f0c
No known key found for this signature in database
2 changed files with 9 additions and 4 deletions

View file

@ -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];

View file

@ -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