Skip to content

Commit

Permalink
ad_dds_cordic_pipe.v: Optimize for implementation
Browse files Browse the repository at this point in the history
The present changes make better use of the Carry Chain blocks resulting in
fewer FPGA resources being used.
  • Loading branch information
AndreiGrozav committed Jul 18, 2018
1 parent dc80048 commit 43f460e
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions library/common/ad_dds_cordic_pipe.v
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ module ad_dds_cordic_pipe#(

// interface

input clk,
(* keep = "TRUE" *) input dir,
(* keep = "TRUE" *) input signed [ DW-1:0] dataa_x,
(* keep = "TRUE" *) input signed [ DW-1:0] dataa_y,
(* keep = "TRUE" *) input signed [ DW-1:0] dataa_z,
(* keep = "TRUE" *) input signed [ DW-1:0] datab_x,
(* keep = "TRUE" *) input signed [ DW-1:0] datab_y,
(* keep = "TRUE" *) input signed [ DW-1:0] datab_z,
(* keep = "TRUE" *) output reg signed [ DW-1:0] result_x,
(* keep = "TRUE" *) output reg signed [ DW-1:0] result_y,
(* keep = "TRUE" *) output reg signed [ DW-1:0] result_z,
input clk,
(* keep = "TRUE" *) input dir,
(* keep = "TRUE" *) input [ DW-1:0] dataa_x,
(* keep = "TRUE" *) input [ DW-1:0] dataa_y,
(* keep = "TRUE" *) input [ DW-1:0] dataa_z,
(* keep = "TRUE" *) input [ DW-1:0] datab_x,
(* keep = "TRUE" *) input [ DW-1:0] datab_y,
(* keep = "TRUE" *) input [ DW-1:0] datab_z,
(* keep = "TRUE" *) output reg [ DW-1:0] result_x,
(* keep = "TRUE" *) output reg [ DW-1:0] result_y,
(* keep = "TRUE" *) output reg [ DW-1:0] result_z,
output signed [ DW-1:0] sgn_shift_x,
output signed [ DW-1:0] sgn_shift_y,
input [DELAY_DW:1] data_delay_in,
Expand All @@ -66,22 +66,15 @@ module ad_dds_cordic_pipe#(

reg [DELAY_DW:1] data_delay = 'd0;

wire dir_inv = ~dir;

// stage rotation

always @(posedge clk)
begin
case(dir)
1'b0: begin
result_x <= dataa_x - datab_y;
result_y <= dataa_y + datab_x;
result_z <= dataa_z - datab_z;
end
1'b1: begin
result_x <= dataa_x + datab_y;
result_y <= dataa_y - datab_x;
result_z <= dataa_z + datab_z;
end
endcase
result_x <= dataa_x + ({DW{dir_inv}} ^ datab_y) + dir_inv;
result_y <= dataa_y + ({DW{dir}} ^ datab_x) + dir;
result_z <= dataa_z + ({DW{dir_inv}} ^ datab_z) + dir_inv;
end

// stage shift
Expand All @@ -100,4 +93,4 @@ module ad_dds_cordic_pipe#(

assign data_delay_out = data_delay;

endmodule
endmodule

0 comments on commit 43f460e

Please sign in to comment.