Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
lerwys committed Sep 7, 2020
2 parents 577f1ec + b8d4233 commit c63e829
Show file tree
Hide file tree
Showing 44 changed files with 17,380 additions and 2,027 deletions.
2 changes: 1 addition & 1 deletion hdl/ip_cores/general-cores
87 changes: 76 additions & 11 deletions hdl/modules/bpm_cores_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ package bpm_cores_pkg is
g_fofb_cordic_stages : positive := 15;
g_fofb_cordic_iter_per_clk : positive := 3;
g_fofb_cordic_ratio : positive := 4;
g_k_width : natural := 24;
g_k_width : natural := 25;
g_offset_width : natural := 32;
g_IQ_width : natural := 32);
port (
adc_ch0_i : in std_logic_vector(g_input_width-1 downto 0);
Expand All @@ -243,6 +244,8 @@ package bpm_cores_pkg is
ksum_i : in std_logic_vector(g_k_width-1 downto 0);
kx_i : in std_logic_vector(g_k_width-1 downto 0);
ky_i : in std_logic_vector(g_k_width-1 downto 0);
offset_x_i : in std_logic_vector(g_offset_width-1 downto 0) := (others => '0');
offset_y_i : in std_logic_vector(g_offset_width-1 downto 0) := (others => '0');
mix_ch0_i_o : out std_logic_vector(g_IQ_width-1 downto 0);
mix_ch0_q_o : out std_logic_vector(g_IQ_width-1 downto 0);
mix_ch1_i_o : out std_logic_vector(g_IQ_width-1 downto 0);
Expand Down Expand Up @@ -642,7 +645,10 @@ package bpm_cores_pkg is
g_fofb_cordic_ratio : positive := 4;

-- width of K constants
g_k_width : natural := 24;
g_k_width : natural := 25;

-- width of offset constants
g_offset_width : natural := 32;

--width for IQ output
g_IQ_width : natural := 32;
Expand Down Expand Up @@ -884,7 +890,10 @@ package bpm_cores_pkg is
g_monit_decim_width : natural := 32;

-- width of K constants
g_k_width : natural := 24;
g_k_width : natural := 25;

-- width of offset constants
g_offset_width : natural := 32;

--width for IQ output
g_IQ_width : natural := 32;
Expand Down Expand Up @@ -1143,28 +1152,56 @@ package bpm_cores_pkg is
intlk_trans_bigger_x_o : out std_logic;
intlk_trans_bigger_y_o : out std_logic;

-- only cleared when intlk_trans_clr_i is asserted
intlk_trans_bigger_ltc_x_o : out std_logic;
intlk_trans_bigger_ltc_y_o : out std_logic;

intlk_trans_bigger_any_o : out std_logic;

-- only cleared when intlk_trans_clr_i is asserted
intlk_trans_bigger_ltc_o : out std_logic;
-- conditional to intlk_trans_en_i
intlk_trans_bigger_o : out std_logic;

intlk_trans_smaller_x_o : out std_logic;
intlk_trans_smaller_y_o : out std_logic;

-- only cleared when intlk_trans_clr_i is asserted
intlk_trans_ltc_o : out std_logic;
intlk_trans_smaller_ltc_x_o : out std_logic;
intlk_trans_smaller_ltc_y_o : out std_logic;

intlk_trans_smaller_any_o : out std_logic;

-- only cleared when intlk_trans_clr_i is asserted
intlk_trans_smaller_ltc_o : out std_logic;
-- conditional to intlk_trans_en_i
intlk_trans_o : out std_logic;
intlk_trans_smaller_o : out std_logic;

intlk_ang_bigger_x_o : out std_logic;
intlk_ang_bigger_y_o : out std_logic;

intlk_ang_bigger_ltc_x_o : out std_logic;
intlk_ang_bigger_ltc_y_o : out std_logic;

intlk_ang_bigger_any_o : out std_logic;

-- only cleared when intlk_ang_clr_i is asserted
intlk_ang_bigger_ltc_o : out std_logic;
-- conditional to intlk_ang_en_i
intlk_ang_bigger_o : out std_logic;

intlk_ang_smaller_x_o : out std_logic;
intlk_ang_smaller_y_o : out std_logic;

intlk_ang_smaller_ltc_x_o : out std_logic;
intlk_ang_smaller_ltc_y_o : out std_logic;

intlk_ang_smaller_any_o : out std_logic;

-- only cleared when intlk_ang_clr_i is asserted
intlk_ang_ltc_o : out std_logic;
intlk_ang_smaller_ltc_o : out std_logic;
-- conditional to intlk_ang_en_i
intlk_ang_o : out std_logic;
intlk_ang_smaller_o : out std_logic;

-- only cleared when intlk_clr_i is asserted
intlk_ltc_o : out std_logic;
Expand Down Expand Up @@ -1246,28 +1283,56 @@ package bpm_cores_pkg is
intlk_trans_bigger_x_o : out std_logic;
intlk_trans_bigger_y_o : out std_logic;

-- only cleared when intlk_trans_clr_i is asserted
intlk_trans_bigger_ltc_x_o : out std_logic;
intlk_trans_bigger_ltc_y_o : out std_logic;

intlk_trans_bigger_any_o : out std_logic;

-- only cleared when intlk_trans_clr_i is asserted
intlk_trans_bigger_ltc_o : out std_logic;
-- conditional to intlk_trans_en_i
intlk_trans_bigger_o : out std_logic;

intlk_trans_smaller_x_o : out std_logic;
intlk_trans_smaller_y_o : out std_logic;

-- only cleared when intlk_trans_clr_i is asserted
intlk_trans_ltc_o : out std_logic;
intlk_trans_smaller_ltc_x_o : out std_logic;
intlk_trans_smaller_ltc_y_o : out std_logic;

intlk_trans_smaller_any_o : out std_logic;

-- only cleared when intlk_trans_clr_i is asserted
intlk_trans_smaller_ltc_o : out std_logic;
-- conditional to intlk_trans_en_i
intlk_trans_o : out std_logic;
intlk_trans_smaller_o : out std_logic;

intlk_ang_bigger_x_o : out std_logic;
intlk_ang_bigger_y_o : out std_logic;

intlk_ang_bigger_ltc_x_o : out std_logic;
intlk_ang_bigger_ltc_y_o : out std_logic;

intlk_ang_bigger_any_o : out std_logic;

-- only cleared when intlk_ang_clr_i is asserted
intlk_ang_bigger_ltc_o : out std_logic;
-- conditional to intlk_ang_en_i
intlk_ang_bigger_o : out std_logic;

intlk_ang_smaller_x_o : out std_logic;
intlk_ang_smaller_y_o : out std_logic;

intlk_ang_smaller_ltc_x_o : out std_logic;
intlk_ang_smaller_ltc_y_o : out std_logic;

intlk_ang_smaller_any_o : out std_logic;

-- only cleared when intlk_ang_clr_i is asserted
intlk_ang_ltc_o : out std_logic;
intlk_ang_smaller_ltc_o : out std_logic;
-- conditional to intlk_ang_en_i
intlk_ang_o : out std_logic;
intlk_ang_smaller_o : out std_logic;

-- only cleared when intlk_clr_i is asserted
intlk_ltc_o : out std_logic;
Expand Down
3 changes: 2 additions & 1 deletion hdl/modules/machine/pbpm_fmcpico1M/machine_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ package machine_pkg is
-- them, so we gain in latency.
constant c_pos_calc_fofb_cordic_ratio : positive := 1;

constant c_pos_calc_k_width : natural := 24;
constant c_pos_calc_k_width : natural := 25;
constant c_pos_calc_offset_width : natural := 32;
constant c_pos_calc_IQ_width : natural := c_pos_calc_mixed_width;

constant c_pos_calc_k_sum : natural := 85e5;
Expand Down
3 changes: 2 additions & 1 deletion hdl/modules/machine/sirius_bo_250M/machine_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ package machine_pkg is
constant c_pos_calc_fofb_cordic_iter_per_clk : positive := 3;
constant c_pos_calc_fofb_cordic_ratio : positive := 8;

constant c_pos_calc_k_width : natural := 24;
constant c_pos_calc_k_width : natural := 25;
constant c_pos_calc_offset_width : natural := 32;
constant c_pos_calc_IQ_width : natural := c_pos_calc_mixed_width;

constant c_pos_calc_k_sum : natural := 85e5;
Expand Down
3 changes: 2 additions & 1 deletion hdl/modules/machine/sirius_sr_130M/machine_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ package machine_pkg is
constant c_pos_calc_fofb_cordic_iter_per_clk : positive := 3;
constant c_pos_calc_fofb_cordic_ratio : positive := 4;

constant c_pos_calc_k_width : natural := 24;
constant c_pos_calc_k_width : natural := 25;
constant c_pos_calc_offset_width : natural := 32;
constant c_pos_calc_IQ_width : natural := c_pos_calc_mixed_width;

constant c_pos_calc_k_sum : natural := 85e5;
Expand Down
3 changes: 2 additions & 1 deletion hdl/modules/machine/sirius_sr_250M/machine_pkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ package machine_pkg is
constant c_pos_calc_fofb_cordic_iter_per_clk : positive := 3;
constant c_pos_calc_fofb_cordic_ratio : positive := 8;

constant c_pos_calc_k_width : natural := 24;
constant c_pos_calc_k_width : natural := 25;
constant c_pos_calc_offset_width : natural := 32;
constant c_pos_calc_IQ_width : natural := c_pos_calc_mixed_width;

constant c_pos_calc_k_sum : natural := 85e5;
Expand Down
36 changes: 29 additions & 7 deletions hdl/modules/position_calc/position_calc.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ entity position_calc is
g_fofb_cordic_ratio : positive := 4;

-- width of K constants
g_k_width : natural := 24;
g_k_width : natural := 25;

-- width of offset constants
g_offset_width : natural := 32;

--width for IQ output
g_IQ_width : natural := 32
Expand All @@ -121,6 +124,9 @@ entity position_calc is
kx_i : in std_logic_vector(g_k_width-1 downto 0);
ky_i : in std_logic_vector(g_k_width-1 downto 0);

offset_x_i : in std_logic_vector(g_offset_width-1 downto 0) := (others => '0');
offset_y_i : in std_logic_vector(g_offset_width-1 downto 0) := (others => '0');

mix_ch0_i_o : out std_logic_vector(g_IQ_width-1 downto 0);
mix_ch0_q_o : out std_logic_vector(g_IQ_width-1 downto 0);
mix_ch1_i_o : out std_logic_vector(g_IQ_width-1 downto 0);
Expand Down Expand Up @@ -388,6 +394,9 @@ architecture rtl of position_calc is
signal fofb_x_pre, fofb_y_pre, fofb_q_pre, fofb_sum_pre :
std_logic_vector(g_fofb_decim_width-1 downto 0) := (others => '0');

signal fofb_pos_x_int, fofb_pos_y_int, fofb_pos_q_int, fofb_pos_sum_int :
std_logic_vector(g_fofb_decim_width-1 downto 0) := (others => '0');

signal tbt_x_pre, tbt_y_pre, tbt_q_pre, tbt_sum_pre :
std_logic_vector(g_tbt_decim_width-1 downto 0) := (others => '0');

Expand Down Expand Up @@ -782,10 +791,16 @@ begin

end generate gen_ddc;

-- x, y, and q are fixed point with:
-- sign bit = MSB
-- word length = g_width
-- integer length = g_k_width + 1
-- fractional length = g_width - (integer length)
cmp_fofb_ds : delta_sigma
generic map (
g_width => g_fofb_decim_width,
g_k_width => g_k_width)
g_k_width => g_k_width,
g_offset_width => g_offset_width)
port map (
a_i => fofb_mag(0),
b_i => fofb_mag(1),
Expand All @@ -794,15 +809,17 @@ begin
kx_i => kx_i,
ky_i => ky_i,
ksum_i => ksum_i,
offset_x_i => offset_x_i,
offset_y_i => offset_y_i,
clk_i => clk_i,
ce_i => ce_fofb_cordic(0),
valid_i => valid_fofb_cordic(0),
valid_o => valid_fofb_ds,
rst_i => rst_i,
x_o => fofb_pos_x_o,
y_o => fofb_pos_y_o,
q_o => fofb_pos_q_o,
sum_o => fofb_pos_sum_o);
x_o => fofb_pos_x_int,
y_o => fofb_pos_y_int,
q_o => fofb_pos_q_int,
sum_o => fofb_pos_sum_int);

-- desync counters. Use only one of the channels as a sample
tbt_tag_desync_cnt_o <= tbt_tag_desync_cnt(0);
Expand Down Expand Up @@ -890,10 +907,15 @@ begin
fofb_pos_valid_o <= valid_fofb_ds;
fofb_pos_ce_o <= ce_fofb_cordic(0);

fofb_pos_x_o <= std_logic_vector(shift_right(signed(fofb_pos_x_int), g_fofb_decim_width-g_k_width));
fofb_pos_y_o <= std_logic_vector(shift_right(signed(fofb_pos_y_int), g_fofb_decim_width-g_k_width));
fofb_pos_q_o <= std_logic_vector(shift_right(signed(fofb_pos_q_int), g_fofb_decim_width-g_k_width));
fofb_pos_sum_o <= fofb_pos_sum_int;

-- Removed to speed synthesis during test
tbt_pos_valid_o <= '0';
tbt_pos_ce_o <= '0';

-- Removed to speed synthesis during test
tbt_pos_x_o <= (others => '0');
tbt_pos_y_o <= (others => '0');
tbt_pos_q_o <= (others => '0');
Expand Down
Loading

0 comments on commit c63e829

Please sign in to comment.