Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

cordic code compression

Status
Not open for further replies.

student13

Newbie level 6
Joined
Jun 10, 2011
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,370
can anyone help me with documents or methods as to how to compress the following cordic code? actually it is using almost all of the resources, but i still have to implement many more blocks, hence the need for compression.

module cordicnew(z0,x0,y0,xn,yn,clk);
input signed [15:0]z0,x0,y0;
input clk;
output reg signed [16:0]xn,yn;
//parameter [3:0]iter=4'd14;
reg [15:0] thetai [7:0];
reg [3:0]ii=4'd0;
//reg [3:0]i;
reg signed [16:0]xi,yi,xtemp,ytemp;
reg signed [15:0]zi;
reg init=0;
//reg [15:0]pi=16'b0110010010000111;
reg [15:0]pi2=16'b0011001001000011;
initial
begin
thetai[0]=16'b0001100100100001;
thetai[1]=16'b0000111011010110;
thetai[2]=16'b0000011111010110;
thetai[3]=16'b0000001111111010;
thetai[4]=16'b0000000111111111;
thetai[5]=16'b0000000011111111;
thetai[6]=16'b0000000001111111;
thetai[7]=16'b0000000000111111;
end
//initial
// $readmemb("C:/Users/sgs/Desktop/angle_data_new.dat", thetai, 0, 7);

always @(posedge clk)
begin
if( init ==0)
begin
if(z0[15]==0)
begin
if(z0[14:13]>2'd1)
begin
xi<=0-{y0[15],y0};
yi<={x0[15],x0};
zi=z0-pi2;
end
else
begin
xi<={x0[15],x0};
yi<={y0[15],y0};
zi=z0;
end
end
else if(z0[15]==1)
begin
if(z0[14:13]>2'd1)
begin
xi<={y0[15],y0};
yi<=0-{x0[15],x0};
zi=z0+pi2;
end
else
begin
xi<={x0[15],x0};
yi<={y0[15],y0};
zi=z0;
end
end
xn=0;
yn=0;
init=1;
end
else
begin
//for(ii=0;ii<iter;ii=ii+4'd1)
//begi
ytemp=(yi>>>ii);
xtemp=(xi>>>ii);
if(zi[15]==0)
begin
xn=xi-ytemp;
yn=yi+xtemp;
zi=zi-thetai[ii];
end
else
begin
xn=xi+ytemp;
yn=yi-xtemp;
zi=zi+thetai[ii];
end
xi<=xn;
yi<=yn;
ii=ii+4'd1;
end
//xn=xn/An;
//yn=yn/An;
end
//en
endmodule
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top