6 use IEEE.STD_LOGIC_1164.
all;
7 use ieee.numeric_std.
all;
10 use ipbus_lib.ipbus.
all;
16 clk_ipb : in std_logic;
19 ipb_out : out ipb_rbus;
21 BCNIn : in std_logic_vector(11 downto 0);
22 SpyBCNIn : in std_logic := '0';
26 we : in std_logic := '0';
34 component SortingInputRAM
38 wea :
in std_logic_vector(
0 downto 0);
39 addra :
in std_logic_vector(
9 downto 0);
40 dina :
in std_logic_vector(
31 downto 0);
41 douta :
out std_logic_vector(
31 downto 0);
44 web :
in std_logic_vector(
0 downto 0);
45 addrb :
in std_logic_vector(
6 downto 0);
46 dinb :
in std_logic_vector(
255 downto 0);
47 doutb :
out std_logic_vector(
255 downto 0)
53 signal dSync : std_logic_vector(5 downto 0);
54 signal din : std_logic_vector(255 downto 0);
55 signal q : std_logic_vector(255 downto 0);
56 signal address : std_logic_vector(6 downto 0) := "0000000";
57 signal counter : std_logic_vector(2 downto 0) := "000";
58 signal BC_counter : std_logic_vector(3 downto 0) := "0000";
59 signal FirstFive : std_logic := '0';
61 type AlgoOutputArray is array (3 downto 0) of AlgoOutput;
62 signal dOutput : AlgoOutputArray;
65 signal ack : std_logic;
66 signal ack2 : std_logic;
67 signal ipbus_write : std_logic_vector(0 downto 0);
68 signal write_enable : std_logic_vector(0 downto 0);
71 IPBUS_RAM :
process(clk_ipb)
73 if rising_edge(clk_ipb) then
74 if ipb_in.ipb_strobe = '1' and ipb_in.ipb_write = '1' then
75 ipbus_write(0) <= '1';
77 ipbus_write(0) <= '0';
79 ack2 <= ipb_in.ipb_strobe and (not ack2) and (not ack);
85 ipb_out.ipb_ack <= ack;
86 ipb_out.ipb_err <= '0';
89 FirstFive <= '0' when counter = "101" or counter = "110" or counter = "111" else '1';
91 write_enable(0) <= we and FirstFive;
93 COUNTER_PROC :
process(rclk)
95 if rising_edge(rclk) then
97 dSync(dSync'high downto 1) <= dSync(dSync'high-1 downto 0);
99 if dSync(5) = '1' then
100 BC_counter <= std_logic_vector(unsigned(BC_counter) + 1);
103 if BC_Counter = "0000" and dSync(5) = '1' then
104 counter <= (others => '0');
105 address <= (others => '0');
107 if counter = "110" then
108 counter <= (others => '0');
110 counter <= std_logic_vector(unsigned(counter) + 1);
113 if FirstFive = '1' then
114 if address = "1001111" then
115 address <= (others => '0');
117 address <= std_logic_vector(unsigned(address) + 1);
124 dOutput(0) <= to_AlgoOutput(q);
125 dOutput(dOutput'high downto 1) <= dOutput(dOutput'high-1 downto 0);
130 ALGO_OUTPUT_RAM : SortingInputRAM
133 ena => ipb_in.ipb_strobe,
135 addra => ipb_in.ipb_addr
(9 downto 0),
136 dina => ipb_in.ipb_wdata,
137 douta => ipb_out.ipb_rdata,
146 SortingOut <= dOutput(3);
147 din <= to_LogicVector(SortingIn) when spyBCNIn = '0' else to_LogicVector(SortingIn)(din'high - 32 downto 0) & x"f" & BCNIn & x"0fff";
External data-types and functions.
( OUTPUT_TOBS- 1 downto 0) AlgoTriggerObject AlgoOutput
Algorithm OUTPUT port.