Digital Signal Processing Reference
In-Depth Information
index = b[15:12];
beta0 = {{12{~c0[5]}},c0[4:0],1'b1};
beta1 = {{14{(~c1[3])}},c1[2:0],1'b1};
beta2 = {{16{~c2[1]}},c2[0], 1'b1};
const2 = {1'b0,16'h8000,1'b0} - (beta0 + beta1 + beta2);
const1 = {{6{~b[11]}},b[10:0],1'b1};
end
always@*
begin
mpy0 = const2 * x4;
mpy1 = const1 * y4;
xK = mpy0[34:16] - mpy1[34:16];
mpy2 = const1 * x4;
mpy3 = const2 * y4;
yK = mpy2[34:16] + mpy3[34:16];
end
always @* // replace by sequential block with clock for sythesis timing
begin
b = bin;
cos_theta = xK;
sin_theta = yK;
end
endmodule
//
module stimulus;
parameter P = 18;
parameter N = 16;
reg signed [N - 1:0] theta_d;
wire signed [P - 1:0] x_o;
wire signed [P - 1:0] y_o;
integer i;
integer outFile;
CORDIC_Merged merged (
theta_d,
x_o,
y_o);
initial
outFile = $fopen("monitor_merge.txt","w");
always@ (x_o, y_o)
$fwrite(outFile, " %d %d\n", x_o, y_o);
initial
begin
#5 theta_d = 0;
Search WWH ::




Custom Search