Radical Computer Technologies
DSP / entity

cordic_atan2

Documentation version: 0.2.1 / Subpackage: dsp_transform / Source package: raddsp

Pipelined CORDIC atan2 engine for fixed-point vector phase estimation. Accepts signed in-phase and quadrature samples and produces angle-oriented output suitable for streaming DSP chains.

Use Cases

Block Diagram

cordic_atan2 radhdl entity clk rst input_valid x_in y_in input_ready busy phase_valid phase_out
VHDL Include And Instantiation Template

File Header

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

library radhdl;
-- Direct entity instantiation below does not require importing the entity name.
use radhdl.dsp.all;
-- Narrower alternative: use radhdl.dsp_transform.all;

Component Declaration

component cordic_atan2 is
  generic (
    G_INPUT_WIDTH : integer := 16;
    G_PHASE_WIDTH : integer := 32;
    G_ITERATIONS : integer := 24
  );
  port (
    clk : in std_logic;
    rst : in std_logic;
    input_valid : in std_logic;
    x_in : in signed(G_INPUT_WIDTH - 1 downto 0);
    y_in : in signed(G_INPUT_WIDTH - 1 downto 0);
    input_ready : out std_logic;
    busy : out std_logic;
    phase_valid : out std_logic;
    phase_out : out signed(G_PHASE_WIDTH - 1 downto 0)
  );
end component;

Direct Entity Instantiation

u_cordic_atan2 : entity radhdl.cordic_atan2
  generic map (
    G_INPUT_WIDTH => 16,
    G_PHASE_WIDTH => 32,
    G_ITERATIONS  => 24
  )
  port map (
    clk         => <clk_signal>,
    rst         => <rst_signal>,
    input_valid => <input_valid_signal>,
    x_in        => <x_in_signal>,
    y_in        => <y_in_signal>,
    input_ready => <input_ready_signal>,
    busy        => <busy_signal>,
    phase_valid => <phase_valid_signal>,
    phase_out   => <phase_out_signal>
  );

Generics

NameTypeDefaultDescription
G_INPUT_WIDTHinteger16Sets the bit width for G INPUT WIDTH values carried by this module.
G_PHASE_WIDTHinteger32Sets the bit width for G PHASE WIDTH values carried by this module.
G_ITERATIONSinteger24Configures G ITERATIONS for this instance.

Ports

NameDirectionTypeDescription
clkinstd_logicClock for the associated synchronous logic and handshake domain.
rstinstd_logicActive-high synchronous reset for this clock domain.
input_validinstd_logicInput valid interface signal.
x_ininsigned(G_INPUT_WIDTH - 1 downto 0)X in interface signal.
y_ininsigned(G_INPUT_WIDTH - 1 downto 0)Y in interface signal.
input_readyoutstd_logicInput ready interface signal.
busyoutstd_logicBusy interface signal.
phase_validoutstd_logicPhase valid interface signal.
phase_outoutsigned(G_PHASE_WIDTH - 1 downto 0)Phase out interface signal.

Testbenches

tb_cordic_atan2 captured waveform

Source: dsp/hdl/testbenches/tb_cordic_atan2.vhd

Self-checking or stimulus-focused testbench for cordic atan2. Exercises representative handshakes, reset behavior, frame boundaries, and numeric corner cases for regression runs.

Artifacts: status, vcd

Data Plots

CORDIC Atan2 Input Vectors

Signed X/Y vectors swept through the atan2 pipeline.

01.63.24.86.48327671.64e+04-0.5-1.64e+04-32768Signed Q15 value vs Vector sampleXY

CORDIC Atan2 Phase Code

Unsigned phase accumulator code emitted by the CORDIC after pipeline latency.

03.67.210.814.41842949672953.22e+092.15e+091.07e+090Phase code vs Output samplePhase

Captured GHDL Waveform

Source: dsp/hdl/testbenches/tb_cordic_atan2.vhd

clk
rst
input_valid
x_in[15:0]
y_in[15:0]
input_ready
busy
phase_valid
phase_out[31:0]
valid_pipe[0:24]

Sources