OpenCores
URL https://opencores.org/ocsvn/cordic_atan_iq/cordic_atan_iq/trunk

Subversion Repositories cordic_atan_iq

[/] [cordic_atan_iq/] [cordic_atan_abs.sv] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 Papayaved
`ifndef _cordic_atan_abs_
2
`define _cordic_atan_abs_
3
`include "cordic_atan_iq.sv"
4
 
5
module cordic_atan_abs(clk, IS, QS, angle, abs);
6
        import ConstPkg::K_u32;
7
 
8
        input wire clk;
9
        input wire signed [29:0] IS, QS;
10
        output reg signed [31:0] angle;
11
        output reg [30:0] abs; // sqrt(I^2 + Q^2)
12
 
13
        wire signed [31:0] angle_res;
14
        wire [31:0] coe_radius;
15
 
16
        cordic_atan_iq cordic_inst(.clk, .IS, .QS, .angle(angle_res), .coe_radius);
17
 
18
        reg [($bits(coe_radius) + $bits(K_u32) - 1):0] abs_reg;
19
 
20
        always_ff @(posedge clk)
21
                abs_reg <= coe_radius * K_u32;
22
 
23
        assign abs = abs_reg[$bits(K_u32)+:31];
24
 
25
        always_ff @(posedge clk)
26
                angle <= angle_res;
27
 
28
endmodule :cordic_atan_abs
29
 
30
`endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.