type states_t is array (0 to NUM_DEVICES - 1) of state_t;
signal state : states_t;
signal state_q : states_t;
+ signal state_qq: states_t;
type value_it is array (0 to 4) of std_logic_vector(9 downto 0);
type value_t is array (0 to NUM_DEVICES - 1) of value_it;
proc_collect_data : process
begin
wait until rising_edge(clk_data);
+ state_q(i) <= state(i);
qq(i) <= q(i);
buffer_write(i) <= '0';
case state(i) is
proc_debug : process
begin
wait until rising_edge(clk_rd);
- state_q(i) <= state(i);
+ state_qq(i) <= state_q(i);
counter_q(i) <= counter(i);
DEBUG(i * 32 + 31 downto i * 32 + 4) <= std_logic_vector(counter_q(i));
- case state_q(i) is
+ case state_qq(i) is
when S1 => DEBUG(i * 32 + 3 downto i * 32 + 0) <= x"1";
when S2 => DEBUG(i * 32 + 3 downto i * 32 + 0) <= x"2";
when S3 => DEBUG(i * 32 + 3 downto i * 32 + 0) <= x"3";
signal adc_clk : std_logic_vector(DEVICES downto 1) := (others => '1');
signal adc_clk_left, adc_clk_right : std_logic := '1';
- signal BUS_RX_adc : CTRLBUS_RX;
+ signal BUS_RX_adc, BUS_RX_sys : CTRLBUS_RX;
signal BUS_TX_adc : CTRLBUS_TX;
-- 000 - 0ff configuration
config_cfd.BaselineAlwaysOn <= buffer_ctrl_reg(4);
BUS_TX <= BUS_TX_adc when rising_edge(CLK);
- BUS_RX_adc <= BUS_RX when rising_edge(adc_clk_left);
+ BUS_RX_sys <= BUS_RX when rising_edge(CLK);
+ BUS_RX_adc <= BUS_RX_sys when rising_edge(adc_clk_left);
PROC_BUS : process
begin
elsif BUS_RX_adc.read = '1' then
if BUS_RX_adc.addr <= x"000f" then
BUS_TX_adc.ack <= '1';
- case BUS_RX.addr(3 downto 0) is
+ case BUS_RX_adc.addr(3 downto 0) is
when x"1" => BUS_TX_adc.data <= buffer_ctrl_reg;
when others => BUS_TX_adc.ack <= '0';
BUS_TX_adc.unknown <= '1';
type state_t is (IDLE, DO_RELEASE, RELEASE_DIRECT, WAIT_FOR_END, CHECK_STATUS_TRIGGER, SEND_STATUS, READOUT, WAIT_BSY, WAIT_RAM, TRIG_DLY);
signal state : state_t;
- signal statebits : std_logic_vector(7 downto 0);
+ signal statebits, statebits_adc : std_logic_vector(7 downto 0);
signal RDO_data_main : std_logic_vector(31 downto 0) := (others => '0');
signal RDO_write_main : std_logic := '0';
end if;
end process;
- statebits <= std_logic_vector(to_unsigned(state_t'pos(state), 8)) when rising_edge(CLK_ADC);
+ statebits <= std_logic_vector(to_unsigned(state_t'pos(state), 8)) when rising_edge(CLK_SYS);
+ statebits_adc <= statebits when rising_edge(CLK_ADC);
PROC_DEBUG_BUFFER : process
variable c : integer range 0 to 3;
DEBUG_BUFFER_DATA(12) <= '1'; -- ADC_VALID
DEBUG_BUFFER_DATA(19 downto 16) <= trigger_gen;
when x"6" =>
- DEBUG_BUFFER_DATA(7 downto 0) <= statebits;
+ DEBUG_BUFFER_DATA(7 downto 0) <= statebits_adc;
when others => null;
end case;
end if;