Skip to content
Snippets Groups Projects
Commit 23e9d36e authored by David Gabriel Monk's avatar David Gabriel Monk
Browse files

Added extra debug signals to Aggregator

parent 06c36925
No related branches found
No related tags found
1 merge request!34Add functionality for multiple module types in a single image
Pipeline #6174004 passed
......@@ -14,6 +14,7 @@ src LinkCombinerIPBus.vhd
src --vhdl2008 TrackReconstructor.vhd
src mprocessor_data_types.vhd
src PayloadHeaderGenerator.vhd
src TrackFinder.vhd
src EcalLinkInterface.vhd
src EcalDataDecoder.vhd
......
......@@ -30,6 +30,7 @@ entity LinkAggregatorCore is
--- Debug Ports ---
status_bits : out std_logic_vector(15 downto 0);
debug_tracking_event_count : out std_logic_vector(31 downto 0) := (others => '0');
debug_tracking_stubs_out : out ldata(5 downto 0) := (others => LWORD_NULL);
non_empty_counts : out ipb_reg_v(8*N_LINKS - 1 downto 0);
bx_valid_count_out : out ipb_reg_v(0 downto 0)
);
......@@ -145,8 +146,10 @@ architecture compressed of LinkAggregatorCore is
signal pBx_counter : integer := 0;
signal readout_reset_signal : std_logic := '0';
signal links_out_signal : ldata(7 downto 0) := (others => LWORD_NULL);
signal uncompressed_stubs_signal : ldata(N_LINKS * 8 - 1 downto 0) := (others => LWORD_NULL);
signal track_stubs : tTrackStubs := (others => LWORD_NULL);
signal track_stubs : ldata(5 downto 0) := (others => LWORD_NULL);
signal single_stub_event : std_logic_vector(N_LINKS - 1 downto 0) := (others => '0');
signal event_valid_for_tracking : std_logic := '0';
signal tracking_event_count : unsigned(31 downto 0) := (others => '0');
......@@ -270,8 +273,8 @@ begin
-- Enable writing of routing FIFO using the valid flag of the cache FIFO
wr_en_route <= valid_cache;
din_route <= dout_cache;
uncompressed_stubs(cBoxcarBx * i + j).data <= dout_cache;
uncompressed_stubs(cBoxcarBx * i + j).valid <= valid_cache;
uncompressed_stubs_signal(cBoxcarBx * i + j).data <= dout_cache;
uncompressed_stubs_signal(cBoxcarBx * i + j).valid <= valid_cache;
--==============================--
......@@ -313,7 +316,7 @@ begin
data_count => count_route
);
-- Combine the IPBus 'reset' with the 'packet_start_buffered' signal to generate the reset signal for the routing FIFO.
-- Combine the IPBus 'reset' with the 'packet_start' signal to generate the reset signal for the routing FIFO.
route_reset <= reset or packet_start_buffered;
end generate genLinkBxCache;
......@@ -400,13 +403,13 @@ begin
end if;
if valid = '1' then
links_out(i).valid <= '1';
links_out(i).data <= dout;
links_out_signal(i).valid <= '1';
links_out_signal(i).data <= dout;
else
links_out(i).valid <= '0';
links_out(i).data <= (others => '0');
links_out_signal(i).valid <= '0';
links_out_signal(i).data <= (others => '0');
end if;
links_out(i).strobe <= '1';
links_out_signal(i).strobe <= '1';
end if;
end process pIteratePointer;
......@@ -453,7 +456,7 @@ begin
end if;
end if;
-- If counter is at the end of a packet, then start to readout the contents of the aggregated FIFOs
if counter = 48 then
if counter = 49 then
readout_reset_signal <= '1';
else
readout_reset_signal <= '0';
......@@ -489,19 +492,31 @@ begin
end if;
end process pCountValidBits;
--==============================--
pExtractTrackingEvent : process(clk_p)
--==============================--
begin
if rising_edge(clk_p) then
event_valid_for_tracking <= and_reduce(single_stub_event);
if readout_reset_signal = '1' and event_valid_for_tracking = '1' then
tracking_event_count <= tracking_event_count + 1;
if readout_reset_signal = '1' then
if event_valid_for_tracking = '1' then
tracking_event_count <= tracking_event_count + 1;
for i in 0 to 5 loop
track_stubs(i).valid <= '1';
track_stubs(i).data <= uncompressed_stubs_signal(8*i).data;
end loop;
else
track_stubs <= (others => LWORD_NULL);
end if;
end if;
end if;
end process pExtractTrackingEvent;
readout_reset <= readout_reset_signal;
links_out <= links_out_signal;
uncompressed_stubs <= uncompressed_stubs_signal;
--==============================--
-- Debug
......@@ -519,5 +534,6 @@ begin
non_empty_counts <= non_empty_fifo_count;
bx_valid_count_out <= bx_valid_count;
debug_tracking_event_count <= std_logic_vector(tracking_event_count);
debug_tracking_stubs_out <= track_stubs;
end compressed;
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 09/09/2023 11:30:24 PM
-- Design Name:
-- Module Name: TrackFinder - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
use IEEE.STD_LOGIC_MISC.ALL;
use work.emp_data_types.all;
use work.tracking_constants.all;
entity TrackFinder is
port (
clk_p : in STD_LOGIC;
stubs_in : in ldata(5 downto 0) := (others => LWORD_NULL);
header_start : in std_logic
);
end TrackFinder;
architecture Behavioral of TrackFinder is
signal stub_array : tDecodedStubArray := (others => cNullDecodedStub);
signal valid_event_array : std_logic_vector(5 downto 0);
signal valid_event : std_logic := '0';
begin
genValidEventArray: for i in 0 to 5 generate
begin
valid_event_array(i) <= stubs_in(i).valid;
end generate;
pMain : process(clk_p)
begin
if rising_edge(clk_p) then
if header_start = '1' then
valid_event <= and_reduce(valid_event_array);
for i in 0 to 5 loop
if stubs_in(i).valid = '1' then
stub_array(i) <= convertStubtoDecodedStub(convertSLVtoStub(stubs_in(i).data));
end if;
end loop;
end if;
end if;
end process pMain;
end Behavioral;
......@@ -8,4 +8,59 @@ package tracking_constants is
type tTrackStubs is array (0 to 5) of lword;
end package tracking_constants;
\ No newline at end of file
type tStub is record
z : std_logic_vector(3 downto 0);
bend : std_logic_vector(3 downto 0);
address : std_logic_vector(7 downto 0);
cbc : std_logic_vector(2 downto 0);
cic : std_logic_vector(0 downto 0);
end record;
constant cNullStub : tStub := ((others => '0'), (others => '0'), (others => '0'), (others => '0'), (others => '0'));
type tStubArray is array(0 to 5) of tStub;
function convertSLVtoStub(word_in : in std_logic_vector(63 downto 0)) return tStub;
type tCICMappingArray is array (0 to 7) of integer;
constant cCICMapping : tCICMappingArray := (0, 1, 2, 3, 7, 6, 5, 4);
type tDecodedStub is record
localx : integer;
localy : integer;
end record;
constant cNullDecodedStub : tDecodedStub := (0, 0);
type tDecodedStubArray is array(0 to 5) of tDecodedStub;
function convertStubtoDecodedStub(stub_in: tStub) return tDecodedStub;
end package tracking_constants;
package body tracking_constants is
function convertSLVtoStub(word_in : in std_logic_vector(63 downto 0)) return tStub is
variable stub : tStub;
begin
stub.z := word_in(3 downto 0);
stub.bend := word_in(7 downto 4);
stub.address := word_in(15 downto 8);
stub.cbc := word_in(18 downto 16);
stub.cic := word_in(50 downto 50);
return stub;
end convertSLVtoStub;
function convertStubtoDecodedStub(stub_in: tStub) return tDecodedStub is
variable decoded_stub : tDecodedStub;
begin
if stub_in.cic = "1" then
decoded_stub.localy := 1;
decoded_stub.localx := 2032 - to_integer(unsigned(stub_in.address)) - 254*cCICMapping(to_integer(unsigned(stub_in.cbc))) + 2;
else
decoded_stub.localy := 0;
decoded_stub.localx := to_integer(unsigned(stub_in.address)) + 254* cCICMapping(to_integer(unsigned(stub_in.cbc)));
end if;
return decoded_stub;
end convertStubtoDecodedStub;
end tracking_constants;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment