“下面这点程序怎么有点看不懂了,还有对Butt_Data值乘2,每次进行蝶形运算时就将输入的两个数据变成1/4,旋转因子不变,这样6级后输出为正常的1/4096,这样防止溢出没问题,但有可能使某些数又过小结果16位精度不够变为0。。我现在得把这段程序弄明白,然后才能弄出蝶形运算来!!”
data_scaling:
process(reset, clk)
-- 该进程用于比例变换,为防乘法器溢出,相乘数据/2,乘积即为原来的1/4,所以对data1_in进行变换,存于data1_in_div4。
begin
if reset = '0' then
data1_r_in_div4 <= (others => '0');
data1_i_in_div4 <= (others => '0');
elsif Rising_Edge(clk) then
if data1_r_in(data_width-1) = '0' then
data1_r_in_div4 <= "00" & data1_r_in(data_width-1 downto 2);
else
data1_r_in_div4 <= "11" & data1_r_in(data_width-1 downto 2);
end if;
if data1_i_in(data_width-1) = '0' then
data1_i_in_div4 <= "00" & data1_i_in(data_width-1 downto 2);
else
data1_i_in_div4 <= "11" & data1_i_in(data_width-1 downto 2);
end if;
end if;
end process data_scaling;
-- 输出=原输出值/2,这里实际需要对Butt_Data值乘2。
data1_r_out <= std_logic_vector(Butt_Data1_Out_R_signed(data_width-2 downto 0)) & '0';
data1_i_out <= std_logic_vector(Butt_Data1_Out_I_signed(data_width-2 downto 0)) & '0';
data2_r_out <= std_logic_vector(Butt_Data2_Out_R_signed(data_width-2 downto 0)) & '0';
data2_i_out <= std_logic_vector(Butt_Data2_Out_I_signed(data_width-2 downto 0)) & '0';
--butterfly乘积实部计算
A_C_Mult: Multiplier
generic map (
multiplier_width => data_width,
data_width => tw_fact_width
)
port map (
load => data_rd,
mult1_data => tf1_r,
mult2_data => data2_r_in,
product => Mult_A_C_Out
);
--butterfly乘积虚部计算
A_D_Mult: Multiplier
generic map (
multiplier_width => data_width,
data_width => tw_fact_width
)
port map (
load => data_rd,
mult1_data => tf1_r,
mult2_data => data2_i_in,
product => Mult_A_D_Out
);
end rtl; |