Add click to saw2sin.sv to fix glitches

This commit is contained in:
Aadi Desai 2023-06-04 14:30:44 +01:00 committed by GitHub
parent 550827217c
commit 36b8ed998e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,8 @@
`default_nettype none `default_nettype none
module saw2sin module saw2sin
( input var [15:0] i_saw ( input var i_clk
, input var [15:0] i_saw
, output var [15:0] o_sin , output var [15:0] o_sin
); );
@ -23,7 +24,7 @@ cordic cordic
); );
logic [16:0] sin; logic [16:0] sin;
always_comb sin = reverse always_ff @(posedge i_clk) sin <= reverse
? (invert ? ~{1'b1, qsin[15:0]} // Reverse, Invert ? (invert ? ~{1'b1, qsin[15:0]} // Reverse, Invert
: {1'b1, qsin[15:0]} + 17'd1) // Reverse, Normal : {1'b1, qsin[15:0]} + 17'd1) // Reverse, Normal
: (invert ? ~{1'b1, qsin[15:0]} + 17'd2 // Normal, Invert : (invert ? ~{1'b1, qsin[15:0]} + 17'd2 // Normal, Invert