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

Merge branch 'new-dtc' into 'master'

Integrate recent changes into MProcessor

See merge request !32
parents 733c273e 5ddb0fc0
No related branches found
No related tags found
1 merge request!32Integrate recent changes into MProcessor
Pipeline #5889374 passed
Showing
with 171 additions and 26 deletions
*.code-workspace
\ No newline at end of file
...@@ -3,7 +3,7 @@ include: ...@@ -3,7 +3,7 @@ include:
file: "/ci/templates/vivado-jobs.yml" file: "/ci/templates/vivado-jobs.yml"
variables: variables:
VIVADO_VER: "2020.2" VIVADO_VER: "2022.2"
PROJECT_DEPFILE: top.dep PROJECT_DEPFILE: top.dep
PROJECT_ALGORITHM: top PROJECT_ALGORITHM: top
PROJECT_NAME: mprocessor PROJECT_NAME: mprocessor
......
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
<node id="control" address="0x001" fwinfo="endpoint;width=0"> <node id="control" address="0x001" fwinfo="endpoint;width=0">
<node id="input_link_mask" mask="0x03f"/> <node id="input_link_mask" mask="0x03f"/>
<node id="reset" mask="0x40"/> <node id="reset" mask="0x40"/>
<node id="trigger_threshold" mask="0x780"/>
</node>
<node id="rate_monitoring" address="0x004" fwinfo="endpoint;width=2">
<node id="bx_valid_count" address="0x0"/>
</node> </node>
<node id="monitoring" address="0x008" fwinfo="endpoint;width=3"> <node id="monitoring" address="0x008" fwinfo="endpoint;width=3">
<node id="non_empty_count_0" address="0x0"/> <node id="non_empty_count_0" address="0x0"/>
......
...@@ -10,8 +10,9 @@ ...@@ -10,8 +10,9 @@
<node id="header_user_bits" address="0x1"/> <node id="header_user_bits" address="0x1"/>
</node> </node>
<node id="csr" address="0x22" description="MProcessor control and status" fwinfo="endpoint;width=1"> <node id="csr" address="0x24" description="MProcessor control and status" fwinfo="endpoint;width=2">
<node id="header_start_select" address="0x0" mask="0x7"/> <node id="header_start_select" address="0x0" mask="0x7"/>
<node id="lff" address="0x1" mask="0x0001"/> <node id="lff" address="0x2" mask="0x0001"/>
<node id="super_id" address="0x3"/>
</node> </node>
</node> </node>
setup -f --cd ../cfg settings.tcl
src fixed_pkg_2008.vhd
src mprocessor_constants.vhd
src MProcessor.vhd
src LinkAggregatorCore.vhd
src LinkAggregatorIPBus.vhd
src LinkCombinerCore.vhd
src LinkCombinerIPBus.vhd
src --vhdl2008 TrackReconstructor.vhd
src ipbus_decode_link_aggregator.vhd
src ipbus_decode_mprocessor.vhd
addrtab -t mprocessor.xml
addrtab -t link_aggregator.xml
# IP Cores
src --cd ../cgn link_agg_single_link_fifo.xci
setup -f --cd ../cgn link_agg_single_link_fifo.tcl
src --cd ../cgn link_agg_single_link_fifo_fwft.xci
setup -f --cd ../cgn link_agg_single_link_fifo_fwft.tcl
src --cd ../cgn link_agg_all_links_fifo.xci
setup -f --cd ../cgn link_agg_all_links_fifo.tcl
src --cd ../cgn link_combin_buffer.xci
setup -f --cd ../cgn link_combin_buffer.tcl
\ No newline at end of file
File moved
...@@ -17,6 +17,7 @@ entity LinkAggregatorCore is ...@@ -17,6 +17,7 @@ entity LinkAggregatorCore is
reset : in std_logic; reset : in std_logic;
packet_start : in std_logic; packet_start : in std_logic;
links_in : in ldata(N_LINKS - 1 downto 0); links_in : in ldata(N_LINKS - 1 downto 0);
trigger_threshold : in integer := 0;
--- Output Ports --- --- Output Ports ---
links_out : out ldata(7 downto 0) := (others => LWORD_NULL); links_out : out ldata(7 downto 0) := (others => LWORD_NULL);
uncompressed_stubs : out ldata(N_LINKS * 8 - 1 downto 0) := (others => LWORD_NULL); uncompressed_stubs : out ldata(N_LINKS * 8 - 1 downto 0) := (others => LWORD_NULL);
...@@ -24,7 +25,8 @@ entity LinkAggregatorCore is ...@@ -24,7 +25,8 @@ entity LinkAggregatorCore is
--- Debug Ports --- --- Debug Ports ---
status_bits : out std_logic_vector(15 downto 0); status_bits : out std_logic_vector(15 downto 0);
--- IPBus Ports --- --- IPBus Ports ---
non_empty_counts : out ipb_reg_v(8*N_LINKS - 1 downto 0) non_empty_counts : out ipb_reg_v(8*N_LINKS - 1 downto 0);
bx_valid_count_out : out ipb_reg_v(0 downto 0)
); );
end LinkAggregatorCore; end LinkAggregatorCore;
...@@ -127,9 +129,12 @@ architecture compressed of LinkAggregatorCore is ...@@ -127,9 +129,12 @@ architecture compressed of LinkAggregatorCore is
signal output_overflow_array : std_logic_vector(cBoxcarBx - 1 downto 0) := (others => '0'); signal output_overflow_array : std_logic_vector(cBoxcarBx - 1 downto 0) := (others => '0');
signal route_overflow_array : tEnableArray := cNullEnableArray; signal route_overflow_array : tEnableArray := cNullEnableArray;
signal cache_overflow_array : tEnableArray := cNullEnableArray; signal cache_overflow_array : tEnableArray := cNullEnableArray;
signal bx_valid_array : std_logic_vector(N_LINKS * cBoxcarBx - 1 downto 0) := (others => '0');
signal non_empty_fifo_count : ipb_reg_v(8*N_LINKS - 1 downto 0) := (others => (others => '0')); signal non_empty_fifo_count : ipb_reg_v(8*N_LINKS - 1 downto 0) := (others => (others => '0'));
signal bx_valid_count : ipb_reg_v(0 downto 0) := (others => (others => '0'));
signal pBx_counter : integer := 0;
begin begin
...@@ -168,6 +173,7 @@ begin ...@@ -168,6 +173,7 @@ begin
signal din_route, dout_route : std_logic_vector(cFIFOWidth - 1 downto 0) := (others => '0'); signal din_route, dout_route : std_logic_vector(cFIFOWidth - 1 downto 0) := (others => '0');
signal count_route : std_logic_vector(4 downto 0); signal count_route : std_logic_vector(4 downto 0);
signal route_reset : std_logic := '0'; signal route_reset : std_logic := '0';
signal countdown_iterator : unsigned(3 downto 0) := (others => '0');
begin begin
...@@ -181,23 +187,45 @@ begin ...@@ -181,23 +187,45 @@ begin
if packet_start = '1' then if packet_start = '1' then
if empty_cache = '0' then if empty_cache = '0' then
rd_en_cache <= '1'; rd_en_cache <= '1';
countdown_iterator <= unsigned(count_cache) - 1;
end if; end if;
end if; else
if rd_en_cache = '1' then if countdown_iterator > 0 then
-- Use almost empty flag to avoid underflow countdown_iterator <= countdown_iterator - 1;
if almost_empty_cache = '1' then else
countdown_iterator <= countdown_iterator;
rd_en_cache <= '0'; rd_en_cache <= '0';
end if; end if;
end if; end if;
-- Check for non-empty FIFOs at reset -- Check for non-empty FIFOs at reset
if route_reset = '1' then if reset = '1' then
if empty_route = '0' then non_empty_fifo_count(N_LINKS*j + i) <= (others => '0');
non_empty_fifo_count(N_LINKS*j + i) <= std_logic_vector(unsigned(non_empty_fifo_count(N_LINKS*j + i)) + 1); else
if route_reset = '1' then
if empty_route = '0' then
non_empty_fifo_count(N_LINKS*j + i) <= std_logic_vector(unsigned(non_empty_fifo_count(N_LINKS*j + i)) + 1);
end if;
end if; end if;
end if; end if;
end if; end if;
end process pTransferToRoutingFIFO; end process pTransferToRoutingFIFO;
--==============================--
pCheckBxValidConditionPerLink : process(clk_p)
--==============================--
begin
if rising_edge(clk_p) then
if packet_start = '1' then
if unsigned(count_cache) >= trigger_threshold then
bx_valid_array(N_LINKS*j + i) <= '1';
else
bx_valid_array(N_LINKS*j + i) <= '0';
end if;
end if;
end if;
end process pCheckBxValidConditionPerLink;
-- Enable writing of routing FIFO using the valid flag of the cache FIFO -- Enable writing of routing FIFO using the valid flag of the cache FIFO
wr_en_route <= valid_cache; wr_en_route <= valid_cache;
din_route <= dout_cache; din_route <= dout_cache;
...@@ -266,6 +294,8 @@ begin ...@@ -266,6 +294,8 @@ begin
signal compressed_stub_pointer : integer range 0 to 1 := 0; signal compressed_stub_pointer : integer range 0 to 1 := 0;
signal previous_valid_row : std_logic_vector(N_LINKS - 1 downto 0) := (others => '0'); signal previous_valid_row : std_logic_vector(N_LINKS - 1 downto 0) := (others => '0');
signal all_links_reset : std_logic := '0'; signal all_links_reset : std_logic := '0';
signal bx_valid : std_logic := '0';
begin begin
--==============================-- --==============================--
...@@ -273,6 +303,8 @@ begin ...@@ -273,6 +303,8 @@ begin
-- Process to iterate of the link FIFOs and route the data to the output FIFO, if data is present on a given link. -- Process to iterate of the link FIFOs and route the data to the output FIFO, if data is present on a given link.
-- The process uses a rotating pointer to repeatedly iterate over all links, taking one stub per iteration, until all link FIFOs are empty. -- The process uses a rotating pointer to repeatedly iterate over all links, taking one stub per iteration, until all link FIFOs are empty.
--==============================-- --==============================--
variable bx_valid_variable : std_logic := '0';
begin begin
if rising_edge(clk_p) then if rising_edge(clk_p) then
...@@ -312,10 +344,18 @@ begin ...@@ -312,10 +344,18 @@ begin
wr_en <= '0'; wr_en <= '0';
end if; end if;
-- Check if Bx is valid
bx_valid_variable := '1';
for j in 0 to N_LINKS - 1 loop
bx_valid_variable := bx_valid_variable and bx_valid_array(N_LINKS*i + j);
end loop;
bx_valid <= bx_valid_variable;
-- If counter is at the end of a packet, then start to readout the contents of the aggregated FIFOs -- If counter is at the end of a packet, then start to readout the contents of the aggregated FIFOs
if counter = 47 and empty = '0' then if counter = 47 then
rd_en <= '1'; if empty = '0' and bx_valid = '1' then
rd_en <= '1';
end if;
end if; end if;
if rd_en = '1' then if rd_en = '1' then
if almost_empty = '1' then if almost_empty = '1' then
...@@ -331,6 +371,7 @@ begin ...@@ -331,6 +371,7 @@ begin
links_out(i).data <= (others => '0'); links_out(i).data <= (others => '0');
end if; end if;
links_out(i).strobe <= '1'; links_out(i).strobe <= '1';
end if; end if;
end process pIteratePointer; end process pIteratePointer;
...@@ -385,6 +426,40 @@ begin ...@@ -385,6 +426,40 @@ begin
end if; end if;
end process pReadoutReset; end process pReadoutReset;
--==============================--
pCountValidBits : process(clk_p)
--==============================--
variable bx_valid_variable : std_logic := '0';
begin
if rising_edge(clk_p) then
if counter = 47 then
pBx_counter <= 0;
else
if pBx_counter = 8 then
pBx_counter <= pBx_counter;
else
pBx_counter <= pBx_counter + 1;
end if;
end if;
if pBx_counter < 8 then
bx_valid_variable := '1';
for j in 0 to N_LINKS - 1 loop
bx_valid_variable := bx_valid_variable and bx_valid_array(N_LINKS*pBx_counter + j);
end loop;
end if;
-- Increment counter if bx_valid is set high when readout is started
if reset = '1' then
bx_valid_count(0) <= (others => '0');
else
if bx_valid_variable = '1' and pBx_counter < 8 then
bx_valid_count(0) <= std_logic_vector(unsigned(bx_valid_count(0)) + 1);
end if;
end if;
end if;
end process pCountValidBits;
--==============================-- --==============================--
-- Debug -- Debug
--==============================-- --==============================--
...@@ -399,5 +474,6 @@ begin ...@@ -399,5 +474,6 @@ begin
status_bits(8) <= cache_overflow_array(0)(0); -- link_aggregator_cache_0_0_overflow; status_bits(8) <= cache_overflow_array(0)(0); -- link_aggregator_cache_0_0_overflow;
status_bits(9) <= route_overflow_array(0)(0); -- link_aggregator_route_0_0_overflow; status_bits(9) <= route_overflow_array(0)(0); -- link_aggregator_route_0_0_overflow;
non_empty_counts <= non_empty_fifo_count; non_empty_counts <= non_empty_fifo_count;
bx_valid_count_out <= bx_valid_count;
end compressed; end compressed;
...@@ -38,11 +38,13 @@ architecture Behavorial of LinkAggregatorIPBus is ...@@ -38,11 +38,13 @@ architecture Behavorial of LinkAggregatorIPBus is
signal channel_sel : ipb_reg_v(0 downto 0); signal channel_sel : ipb_reg_v(0 downto 0);
signal ipb_chain : ipbdc_bus_array(8 downto 0); signal ipb_chain : ipbdc_bus_array(8 downto 0);
-- signal link_aggregator_status_registers : ipb_reg_v(4 - 1 downto 0) := (others => (others => '0')); -- signal link_aggregator_status_registers : ipb_reg_v(4 - 1 downto 0) := (others => (others => '0'));
signal control_registers : ipb_reg_v(1 - 1 downto 0) := (others => (others => '0')); signal control_registers : ipb_reg_v(1 - 1 downto 0) := (others => (others => '0'));
signal mprocessor_monitoring_registers : ipb_reg_v(8*N_LINKS - 1 downto 0) := (others => (others => '0')); signal mprocessor_monitoring_registers : ipb_reg_v(8*N_LINKS - 1 downto 0) := (others => (others => '0'));
signal rate_monitoring_registers : ipb_reg_v(1 - 1 downto 0) := (others => (others => '0'));
signal bx_valid_count : ipb_reg_v(1 - 1 downto 0) := (others => (others => '0'));
signal masked_links : ldata(N_LINKS - 1 downto 0) := (others => LWORD_NULL); signal masked_links : ldata(N_LINKS - 1 downto 0) := (others => LWORD_NULL);
begin begin
...@@ -96,6 +98,21 @@ begin ...@@ -96,6 +98,21 @@ begin
q => control_registers q => control_registers
); );
--==============================--
RateMonitoringInstance: entity work.ipbus_ctrlreg_v
--==============================--
generic map(
N_CTRL => 0,
N_STAT => 1
)
port map(
clk => ipb_clk,
reset => ipb_rst,
ipbus_in => ipb_to_slaves(N_SLV_RATE_MONITORING),
ipbus_out => ipb_from_slaves(N_SLV_RATE_MONITORING),
d => rate_monitoring_registers
);
--==============================-- --==============================--
channel_select: entity work.ipbus_dc_fabric_sel channel_select: entity work.ipbus_dc_fabric_sel
--==============================-- --==============================--
...@@ -182,13 +199,16 @@ begin ...@@ -182,13 +199,16 @@ begin
reset => control_registers(0)(N_LINKS + 1 - 1), reset => control_registers(0)(N_LINKS + 1 - 1),
packet_start => packet_start, packet_start => packet_start,
links_in => masked_links, links_in => masked_links,
trigger_threshold => to_integer(unsigned(control_registers(0)(N_LINKS + 5 - 1 downto N_LINKS + 1))),
--- Output Ports --- --- Output Ports ---
links_out => links_out, links_out => links_out,
readout_reset => readout_reset, readout_reset => readout_reset,
--- Debug Ports --- --- Debug Ports ---
-- status_bits => link_aggregator_status_registers(3)(15 downto 0), -- status_bits => link_aggregator_status_registers(3)(15 downto 0),
non_empty_counts => mprocessor_monitoring_registers non_empty_counts => mprocessor_monitoring_registers,
bx_valid_count_out => bx_valid_count
); );
rate_monitoring_registers(0) <= bx_valid_count(0);
end Behavorial; end Behavorial;
...@@ -25,13 +25,16 @@ entity LinkCombinerIPBus is ...@@ -25,13 +25,16 @@ entity LinkCombinerIPBus is
packet_start : in std_logic; packet_start : in std_logic;
header_in : in tCICHeaderArray(cNumberOfFEModules * cNumberOfCICs - 1 downto 0) := (others => ('0', (others => '0'), (others => '0'), (others => '0'))); header_in : in tCICHeaderArray(cNumberOfFEModules * cNumberOfCICs - 1 downto 0) := (others => ('0', (others => '0'), (others => '0'), (others => '0')));
lff : in std_logic; lff : in std_logic;
output_srst : in std_logic := '0';
--- Ouput Ports --- --- Ouput Ports ---
link_out : out lword := LWORD_NULL; link_out : out lword := LWORD_NULL;
--- IPBus Ports --- --- IPBus Ports ---
ipb_clk : in std_logic; ipb_clk : in std_logic;
ipb_rst : in std_logic; ipb_rst : in std_logic;
ipb_in : in ipb_wbus; ipb_in : in ipb_wbus;
ipb_out : out ipb_rbus ipb_out : out ipb_rbus;
--- Debug Ports ---
super_id : out std_logic_vector(31 downto 0)
); );
end LinkCombinerIPBus; end LinkCombinerIPBus;
...@@ -44,6 +47,7 @@ architecture Behavioral of LinkCombinerIPBus is ...@@ -44,6 +47,7 @@ architecture Behavioral of LinkCombinerIPBus is
signal masked_input : ldata(8 - 1 downto 0) := (others => LWORD_NULL); signal masked_input : ldata(8 - 1 downto 0) := (others => LWORD_NULL);
signal control_registers : ipb_reg_v(2 - 1 downto 0) := (others => (others => '0')); signal control_registers : ipb_reg_v(2 - 1 downto 0) := (others => (others => '0'));
signal output_reset : std_logic := '0';
begin begin
...@@ -88,6 +92,7 @@ begin ...@@ -88,6 +92,7 @@ begin
begin begin
if rising_edge(clk_p) then if rising_edge(clk_p) then
link_combiner_rd_en <= not lff and control_registers(0)(N_INPUT_LINKS + 2 - 1); link_combiner_rd_en <= not lff and control_registers(0)(N_INPUT_LINKS + 2 - 1);
output_reset <= control_registers(0)(N_INPUT_LINKS + 1 - 1) or output_srst;
end if; end if;
end process pReadEnable; end process pReadEnable;
...@@ -101,17 +106,17 @@ begin ...@@ -101,17 +106,17 @@ begin
--- Input Ports --- --- Input Ports ---
clk_p => clk_p, clk_p => clk_p,
reset => reset, reset => reset,
output_reset => control_registers(0)(N_INPUT_LINKS + 1 - 1), output_reset => output_reset,
output_enable => link_combiner_rd_en, output_enable => link_combiner_rd_en,
links_in => masked_input, links_in => masked_input,
packet_start => packet_start, packet_start => packet_start,
header_in => header_in, header_in => header_in,
header_user_bits => control_registers(1), header_user_bits => control_registers(1),
--- Output Ports --- --- Output Ports ---
link_out => link_out link_out => link_out,
--- Debug Ports --- --- Debug Ports ---
-- debug => link_combiner_debug, -- debug => link_combiner_debug,
-- debug_super_id => link_combiner_debug_super_id, debug_super_id => super_id
-- debug_fifo => link_aggregator_status_registers(2) -- debug_fifo => link_aggregator_status_registers(2)
); );
......
...@@ -27,6 +27,7 @@ entity MProcessor is ...@@ -27,6 +27,7 @@ entity MProcessor is
header_in : in tCICHeaderArray(cNumberOfFEModules * cNumberOfCICs - 1 downto 0) := (others => ('0', (others => '0'), (others => '0'), (others => '0'))); header_in : in tCICHeaderArray(cNumberOfFEModules * cNumberOfCICs - 1 downto 0) := (others => ('0', (others => '0'), (others => '0'), (others => '0')));
header_start_array : in tHeaderStartArray := (others => (others => '0')); header_start_array : in tHeaderStartArray := (others => (others => '0'));
gbe_backpressure : in std_logic := '0'; gbe_backpressure : in std_logic := '0';
srst : in std_logic := '0';
--- Output Ports --- --- Output Ports ---
link_out : out lword := LWORD_NULL; link_out : out lword := LWORD_NULL;
--- IPBus Ports --- --- IPBus Ports ---
...@@ -48,9 +49,11 @@ architecture Behavorial of MProcessor is ...@@ -48,9 +49,11 @@ architecture Behavorial of MProcessor is
signal aggregated_stubs : ldata(7 downto 0) := (others => LWORD_NULL); signal aggregated_stubs : ldata(7 downto 0) := (others => LWORD_NULL);
signal link_aggregator_input : ldata(N_LINKS - 1 downto 0) := (others => LWORD_NULL); signal link_aggregator_input : ldata(N_LINKS - 1 downto 0) := (others => LWORD_NULL);
signal status_registers : ipb_reg_v(1 - 1 downto 0) := (others => (others => '0')); signal status_registers : ipb_reg_v(2 - 1 downto 0) := (others => (others => '0'));
signal control_registers : ipb_reg_v(1 - 1 downto 0) := (others => (others => '0')); signal control_registers : ipb_reg_v(1 - 1 downto 0) := (others => (others => '0'));
signal super_id : std_logic_vector(31 downto 0) := (others => '0');
begin begin
--==============================-- --==============================--
...@@ -78,7 +81,7 @@ begin ...@@ -78,7 +81,7 @@ begin
--==============================-- --==============================--
generic map( generic map(
N_CTRL => 1, N_CTRL => 1,
N_STAT => 1 N_STAT => 2
) )
port map( port map(
clk => ipb_clk, clk => ipb_clk,
...@@ -124,13 +127,16 @@ begin ...@@ -124,13 +127,16 @@ begin
packet_start => packet_start, packet_start => packet_start,
header_in => header_in, header_in => header_in,
lff => gbe_backpressure, lff => gbe_backpressure,
output_srst => srst,
--- Output Ports --- --- Output Ports ---
link_out => link_out, link_out => link_out,
--- IPBus Ports --- --- IPBus Ports ---
ipb_clk => ipb_clk, ipb_clk => ipb_clk,
ipb_rst => ipb_rst, ipb_rst => ipb_rst,
ipb_in => ipb_to_slaves(N_SLV_LINK_COMBINER), ipb_in => ipb_to_slaves(N_SLV_LINK_COMBINER),
ipb_out => ipb_from_slaves(N_SLV_LINK_COMBINER) ipb_out => ipb_from_slaves(N_SLV_LINK_COMBINER),
--- Debug Ports ---
super_id => super_id
); );
-- --==============================-- -- --==============================--
...@@ -145,6 +151,7 @@ begin ...@@ -145,6 +151,7 @@ begin
link_aggregator_input(N_LINKS - 1 downto 0) <= links_in; link_aggregator_input(N_LINKS - 1 downto 0) <= links_in;
status_registers(0)(0) <= gbe_backpressure; status_registers(0)(0) <= gbe_backpressure;
status_registers(1) <= super_id;
packet_start <= header_start_array(to_integer(unsigned(control_registers(0)(2 downto 0))))(0); packet_start <= header_start_array(to_integer(unsigned(control_registers(0)(2 downto 0))))(0);
end Behavorial; end Behavorial;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment