signal inp_inv : std_logic_vector(INPUTS-1 downto 0) := (others => '0');
signal inp_long : std_logic_vector(INPUTS-1 downto 0) := (others => '0');
signal inp_verylong : std_logic_vector(INPUTS-1 downto 0) := (others => '0');
+signal inp_edge : std_logic_vector(INPUTS-1 downto 0) := (others => '0');
signal output_i : std_logic_vector(OUTPUTS-1 downto 0) := (others => '0');
signal out_reg : std_logic_vector(OUTPUTS-1 downto 0) := (others => '0');
signal multiplicity_enable : std_logic_vector(31 downto 0);
signal set_output_coin, set_output_mult, set_output_simplecoin : std_logic_vector(7 downto 0);
+signal edge_enable : std_logic_vector(7 downto 0) := (others => '0');
-type coincidence_arr is array(0 to 16) of integer range 0 to 31;
+type coincidence_arr is array(0 to 16) of integer range 0 to 63;
signal coincidence_config_1, coincidence_config_2 : coincidence_arr;
signal coincidence_enable : std_logic_vector(15 downto 0);
end case;
end if;
elsif BUS_RX.addr(6 downto 4) = "100" then
- coincidence_config_1(to_integer(unsigned(BUS_RX.addr(3 downto 0)))) <= to_integer(unsigned(BUS_RX.data(12 downto 8)));
- coincidence_config_2(to_integer(unsigned(BUS_RX.addr(3 downto 0)))) <= to_integer(unsigned(BUS_RX.data(4 downto 0)));
+ coincidence_config_1(to_integer(unsigned(BUS_RX.addr(3 downto 0)))) <= to_integer(unsigned(BUS_RX.data(13 downto 8)));
+ coincidence_config_2(to_integer(unsigned(BUS_RX.addr(3 downto 0)))) <= to_integer(unsigned(BUS_RX.data(5 downto 0)));
coincidence_enable(to_integer(unsigned(BUS_RX.addr(3 downto 0)))) <= BUS_RX.data(31);
elsif BUS_RX.addr(6 downto 0) = "0110010" then
set_multiplicity <= unsigned(BUS_RX.data(23 downto 16));
set_output_simplecoin <= BUS_RX.data(7 downto 0);
set_output_mult <= BUS_RX.data(15 downto 8);
set_output_coin <= BUS_RX.data(23 downto 16);
+ edge_enable <= BUS_RX.data(31 downto 24);
+
else
BUS_TX.nack <= '1';
BUS_TX.ack <= '0';
BUS_TX.unknown <= '1';
end if;
elsif BUS_RX.addr(6 downto 4) = "100" then
- BUS_TX.data(12 downto 8) <= std_logic_vector(to_unsigned(coincidence_config_1(to_integer(unsigned(BUS_RX.addr(3 downto 0)))),5));
- BUS_TX.data( 4 downto 0) <= std_logic_vector(to_unsigned(coincidence_config_2(to_integer(unsigned(BUS_RX.addr(3 downto 0)))),5));
+ BUS_TX.data(13 downto 8) <= std_logic_vector(to_unsigned(coincidence_config_1(to_integer(unsigned(BUS_RX.addr(3 downto 0)))),6));
+ BUS_TX.data( 5 downto 0) <= std_logic_vector(to_unsigned(coincidence_config_2(to_integer(unsigned(BUS_RX.addr(3 downto 0)))),6));
BUS_TX.data(31) <= coincidence_enable(to_integer(unsigned(BUS_RX.addr(3 downto 0))));
elsif BUS_RX.addr(6 downto 0) = "0110000" then
BUS_TX.data(OUTPUTS-1 downto 0) <= out_reg;
elsif BUS_RX.addr(6 downto 0) = "0110011" then
BUS_TX.data <= multiplicity_enable;
elsif BUS_RX.addr(6 downto 0) = "0110100" then
- BUS_TX.data <= x"00" & set_output_coin & set_output_mult & set_output_simplecoin;
+ BUS_TX.data <= edge_enable & set_output_coin & set_output_mult & set_output_simplecoin;
else
BUS_TX.nack <= '1';
BUS_TX.ack <= '0';
inp_long <= inp_shift(0) or inp_shift(1);
inp_verylong <= inp_shift(1) or inp_shift(2) or inp_shift(3) or inp_shift(4) when rising_edge(CLK);
+inp_edge <= not inp_shift(1) and inp_shift(2) when rising_edge(CLK);
----------------------------
-- Outputs
----------------------------
gen_outs : for i in 0 to OUTPUTS-1 generate
- output_i(i) <= or_all(((inp_long and stretch_inp(INPUTS-1 downto 0)) or (inp_inv(INPUTS-1 downto 0) and not stretch_inp(INPUTS-1 downto 0))) and enable(i)(INPUTS-1 downto 0))
+ output_i(i) <= (or_all(inp_long and stretch_inp(INPUTS-1 downto 0) and enable(i)(INPUTS-1 downto 0)) and not edge_enable(i))
+ or (or_all(inp_inv(INPUTS-1 downto 0) and not stretch_inp(INPUTS-1 downto 0) and enable(i)(INPUTS-1 downto 0)) and not edge_enable(i))
+ or (or_all(inp_edge(INPUTS-1 downto 0) and enable(i)(INPUTS-1 downto 0)) and edge_enable(i))
or (got_simplecoin and set_output_simplecoin(i))
or (multiplicity_trigger and set_output_mult(i))
or (got_coincidence and set_output_coin(i))