Ignore:
Timestamp:
05/18/11 13:59:12 (13 years ago)
Author:
weitzel
Message:
several bugfixes for FTM firmware
File:
1 edited

Legend:

Unmodified
Added
Removed
  • firmware/FTM/Clock_cond_interface/Clock_cond_interface.vhd

    r10639 r10740  
    4545    clk   : IN  STD_LOGIC;               -- 50 MHz system clock
    4646
    47    
    4847    -- Clock conditioner LMK03000
    4948    -------------------------------------------------------------------------------
     
    5554    LD_Clk_Cond   : in STD_LOGIC;   -- clock conditioner lock detect                 
    5655
    57    
    5856    -- Time Marker
    5957    -------------------------------------------------------------------------------
     
    6563                                 --     operation / physics run
    6664
    67    
    6865    -- FPGA intern clock conditioner configuration data
    6966    -------------------------------------------------------------------------------
     
    7774    cc_R15            : in std_logic_vector (31 downto 0) := (others => '0');
    7875
    79    
    8076    -- FPGA intern control signals
    8177    -------------------------------------------------------------------------------
     
    9793                                       -- 0 = time marker from FPGA for normal
    9894                                       --     operation / physics run
    99    
     95    
    10096  );
    10197end Clock_cond_interface;
     
    10399
    104100architecture Behavioral of Clock_cond_interface is
    105  
    106  
     101   
    107102  component microwire_interface IS
    108103    PORT(
    109104      clk               : IN     std_logic;
    110       clk_uwire         : OUT    std_logic;  --- IN or OUT ?         
     105      clk_uwire         : OUT    std_logic;
    111106      data_uwire        : OUT    std_logic;       
    112107      le_uwire          : OUT    std_logic;
     
    118113  end component;
    119114
    120  
    121   signal clk_50M_sig : STD_LOGIC;       -- system clock
    122   --signal start_config_sig : STD_LOGIC; 
    123 
     115  signal clk_50M_sig   : STD_LOGIC;  -- system clock (50MHz)
     116  signal clk_uwire_sig : STD_LOGIC;  -- 2 MHz
     117 
    124118  signal config_ready_sig : STD_LOGIC;
    125   signal clk_uwire_sig : STD_LOGIC;
    126 
    127119  signal config_started_sig : STD_LOGIC;
    128120 
     
    151143  signal tim_sel_state : TIM_SEL_STATE_TYPE := IDLE;
    152144
     145  signal load_detect_sr : std_logic_vector (1 downto 0) := "00";
    153146
    154147begin
     
    162155        clk_cond_array      => clk_cond_array_sig, 
    163156        config_start        => start_config,
    164        
    165    --   config_start        => start_config_sig, 
    166    --   config_start        <= start_config_sig,
    167        
    168157        config_ready        => config_ready_sig,
    169158        config_started      => config_started_sig
    170159    );
    171160
    172  
    173        
     161  sync_ld_proc : process (clk_uwire_sig)
     162  begin
     163    if rising_edge(clk_uwire_sig) then
     164      load_detect_sr <= load_detect_sr(0) & LD_Clk_Cond;
     165    end if;
     166  end process sync_ld_proc;
     167 
    174168  --config_done <= config_ready_sig;  -- indicates that the configuration
    175169                                    -- has been loaded
    176170
    177 
    178  
    179   config_done <= (config_ready_sig AND LD_Clk_Cond);  -- indicates that the configuration
     171  --config_done <= (config_ready_sig AND LD_Clk_Cond);  -- indicates that the configuration
    180172                                                      -- has been loaded and
    181                                                       -- the PLL is locked again
    182 
    183 
    184  
    185   --TIM_Sel <= timemarker_select;                                   
    186 
     173                                                      -- the PLL has locked
     174 
     175  config_done <= config_ready_sig and (load_detect_sr(1) and load_detect_sr(0));
     176 
    187177  TIM_Sel <= timemarker_select_sig;
    188 
     178 
    189179  tim_sel_proc : process (clk_uwire_sig)
    190180  begin
     
    205195  end process tim_sel_proc;
    206196     
    207            
    208197  CLK_Clk_Cond <= clk_uwire_sig;
    209198
    210199  clk_50M_sig <= clk;
    211200 
    212   -- start_config_sig <= start_config;
    213   --  start_config <= start_config_sig;     
    214201  config_started <= config_started_sig;
    215202
Note: See TracChangeset for help on using the changeset viewer.