⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug_detect_peakvalue.vhd

📁 VHDLfullCODEforCAcodeGenerator.rar为CA码发生器的完整VHDL程序
💻 VHD
字号:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;


entity Debug_Detect_Peakvalue is
    Port ( SampleClk          : in  std_logic;
           Enable_Detect      : in  std_logic;
----       Sum_I_Tracking     : in  std_logic_vector(15 downto 0);
		     Sum_I_Prompt		: in  std_logic_vector(15 downto 0);
----		  Sum_Q_Tracking	: in  std_logic_vector(15 downto 0);
		     Sum_Q_Prompt   	: in  std_logic_vector(15 downto 0);
		     Detect             : out std_logic;
		     CodeOfSlew         : out std_logic_vector(10 downto 0)
		 );
end Debug_Detect_Peakvalue;

architecture rtl of Debug_Detect_Peakvalue is

    signal   IP_Square       : signed( 31 downto 0);
    signal   QP_Square       : signed( 31 downto 0);
    signal   ResultOfTemp    : signed( 32 downto 0);
    signal   Result          : std_logic_vector(32 downto 0);
    signal   FlagOfDetect    : std_logic_vector(33 downto 0);
    constant Th_Peak         : std_logic_vector(32 downto 0)
                          -----:= "000000000000010101011001010000001";    ----//// The Temp Threshold;
										 := "000000000000000000011111111111111";	  ---- 1*10^6;
    signal   FlagOfCompute   : std_logic;
    signal   CountOfCompute  : integer range  0 to 7;
    signal   FgOfAcquisition : std_logic;
	 signal   FlagOfGetCodeSlew : std_logic;
    signal   Temp_CodeOfSlew : std_logic_vector(10 downto 0);
   

begin

    process(SampleClk)	
    begin
       if SampleClk'event and SampleClk='1' then
	           if Enable_Detect ='1' then
		                FlagOfCompute <= '1';
              end if;
		        if FlagOfCompute ='1' then
		              if CountOfCompute= 4 then
		                    CountOfCompute <= 0;
                    else
		                    CountOfCompute <= CountOfCompute + 1;
                    end if;
              end if;
		        if CountOfCompute = 4 then
		                FlagOfCompute <= '0';
		        end if;
        end if;
    end process;
    	 -----/// every 6 clock cycles calculate a result -----
    Result        <= std_logic_vector(ResultOfTemp);

    process(SampleClk)
    begin
       if SampleClk'event and SampleClk='1' then

           IP_Square     <= signed(Sum_I_Prompt)*signed(Sum_I_Prompt);
           QP_Square     <= signed(Sum_Q_Prompt)*signed(Sum_Q_Prompt);
           ResultOfTemp  <= (IP_Square(IP_Square'high)&IP_Square)
                          + (QP_Square(QP_Square'high)&QP_Square);

	      if  CountOfCompute = 2  then
               FlagOfDetect  <= (Result(Result'high)&Result) - (Th_Peak(Th_Peak'high)&Th_Peak);
           end if;

		 if  CountOfCompute = 3  then		     
		     if  FlagOfDetect(FlagOfDetect'high)='0' then
			            FgOfAcquisition <= '1';
               else
			            FgOfAcquisition	<= '0';
               end if;
           else
		               FgOfAcquisition <= '0';
           end if;

		 if  CountOfCompute = 4 then
		     if  FgOfAcquisition = '0' then
-------///////		             Temp_CodeOfSlew   <= Temp_CodeOfSlew + 1;
		             Temp_CodeOfSlew   <= "00000000001";
				   FlagOfGetCodeSlew <= '0';
               else
			    if FlagOfGetCodeSlew='0' then
-------///////		          Temp_CodeOfSlew   <= Temp_CodeOfSlew - 1;
				   Temp_CodeOfSlew   <=  (others=>'0') ;
				   FlagOfGetCodeSlew <= '1';
                   end if;
               end if;
           end if;
       end if;
    end process;

    Detect     <= FgOfAcquisition;   
    CodeOfSlew <= Temp_CodeOfSlew;	    	              


end rtl;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -