Ignore:
Timestamp:
01/05/11 17:19:13 (14 years ago)
Author:
neise
Message:
DRS write shift register & write config register
File:
1 edited

Legend:

Unmodified
Added
Removed
  • firmware/FAD/FACT_FAD_20MHz_VAR_PS/FACT_FAD_lib/hdl/data_generator.vhd.bak

    r10073 r10081  
    6767
    6868      drs_read_s_cell_ready : in std_logic;
    69       drs_s_cell_array : in drs_s_cell_array_type
     69      drs_s_cell_array : in drs_s_cell_array_type;
     70     
     71      drs_readout_started : out std_logic
    7072      );
    7173end data_generator ;
     
    7375architecture Behavioral of data_generator is
    7476
    75 type state_generate_type is (INIT, CONFIG, CONFIG1, CONFIG2,CONFIG3, CONFIG4, CONFIG5, CONFIG6, WRITE_HEADER, WRITE_EXTERNAL_TRIGGER, WRITE_INTERNAL_TRIGGER, WRITE_BOARD_ID, WRITE_TEMPERATURES,
     77type state_generate_type is (INIT, CONFIG, CONFIG1, CONFIG2,CONFIG3, CONFIG4, CONFIG5, CONFIG6, CONFIG7, WRITE_HEADER, WRITE_EXTERNAL_TRIGGER, WRITE_INTERNAL_TRIGGER, WRITE_BOARD_ID, WRITE_TEMPERATURES,
    7678                             WRITE_DAC1, WRITE_DAC2, WRITE_CHANNEL_ID, WRITE_START_CELL, WRITE_ROI, WRITE_ADC_DATA, WRITE_DATA_END, WRITE_DATA_END_WAIT,
    7779                             WRITE_END_FLAG, WRITE_DATA_STOP,
     
    9395signal roi_max_int : roi_max_type;
    9496
     97signal sig_drs_readout_started : std_logic := '0';
     98
    9599begin
    96100 
     101  drs_readout_started <= sig_drs_readout_started;
    97102 
    98103        generate_data : process (clk)
     
    142147        when CONFIG4 =>
    143148          drs_channel_id <= DRS_WRITE_SHIFT_REG;
    144           drs_srin_data <= "10101010";
     149          drs_srin_data <= "11111111";
    145150          drs_srin_write_8b <= '1';
    146151          if (drs_srin_write_ack = '1') then
     
    151156          if (drs_srin_write_ready = '1') then
    152157            roi_max_int <= roi_max;
    153             state_generate <= WRITE_DATA_IDLE;
    154           end if;
     158            state_generate <= CONFIG6;
     159          end if;
     160          when CONFIG6 =>
     161            drs_channel_id <= DRS_WRITE_CONFIG_REG;
     162            drs_srin_data <= "11111111";
     163            drs_srin_write_8b <= '1';
     164            if (drs_srin_write_ack = '1') then
     165              drs_srin_write_8b <= '0';
     166              state_generate <= CONFIG7;
     167            end if;
     168          when CONFIG7 =>
     169            if (drs_srin_write_ready = '1') then
     170              roi_max_int <= roi_max;
     171              state_generate <= WRITE_DATA_IDLE;
     172            end if;
    155173        -- end configure DRS
    156174
     
    161179--          if (ram_write_ea = '1' and (trigger_flag = '1' or s_trigger = '1')) then
    162180          if (ram_write_ea = '1' and trigger_flag = '1') then
     181            sig_drs_readout_started <= '1'; -- is set to '0' in state WRITE_DAC1
    163182            -- stop drs, dwrite low
    164183            drs_dwrite <= '0';
     
    193212
    194213        when WRITE_DAC1 =>
     214          sig_drs_readout_started <= '0'; -- is set to '1' in state WRITE_DATA_IDLE
    195215          data_out <= conv_std_logic_vector (dac_array (3), 16)
    196216                    & conv_std_logic_vector (dac_array (2), 16)
     
    252272        when WRITE_ADC_DATA =>
    253273          if (data_cntr < roi_max (channel_id)) then
    254             data_out <= "000" & adc_otr(3) & adc_data_array(3)
    255                       & "000" & adc_otr(2) & adc_data_array(2)
    256                       & "000" & adc_otr(1) & adc_data_array(1)
    257                       & "000" & adc_otr(0) & adc_data_array(0);
    258 --              data_out <= "00000" & conv_std_logic_vector (data_cntr, 11)
    259 --                          & "00010" & conv_std_logic_vector (data_cntr, 11)
    260 --                          & "00100" & conv_std_logic_vector (data_cntr, 11)
    261 --                          & "00110" & conv_std_logic_vector (data_cntr, 11) ;
     274--            data_out <= "000" & adc_otr(3) & adc_data_array(3)
     275--                      & "000" & adc_otr(2) & adc_data_array(2)
     276--                      & "000" & adc_otr(1) & adc_data_array(1)
     277--                      & "000" & adc_otr(0) & adc_data_array(0);
     278              data_out <= "00000" & conv_std_logic_vector (data_cntr, 11)
     279                          & "00010" & conv_std_logic_vector (data_cntr, 11)
     280                          & "00100" & conv_std_logic_vector (data_cntr, 11)
     281                          & "00110" & conv_std_logic_vector (data_cntr, 11) ;
    262282            addr_cntr <= addr_cntr + 1;
    263283            state_generate <= WRITE_ADC_DATA;
Note: See TracChangeset for help on using the changeset viewer.