-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'xnevrk03_data_logger_stats' into 'devel'
Upgrade statistics processing for data_logger, refactor histogramer, add memory comp wraps See merge request ndk/ndk-fpga!90
- Loading branch information
Showing
46 changed files
with
3,684 additions
and
776 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Modules.tcl: Components include script | ||
# Copyright (C) 2024 CESNET | ||
# Author(s): Lukas Nevrkla <[email protected]> | ||
# | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
# Packages | ||
lappend PACKAGES "$OFM_PATH/comp/base/pkg/math_pack.vhd" | ||
lappend PACKAGES "$OFM_PATH/comp/base/pkg/type_pack.vhd" | ||
|
||
lappend MOD "$ENTITY_BASE/mem_clear.vhd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
-- mem_clear.vhd: Unit for clearing BRAM memories | ||
-- Copyright (C) 2024 CESNET z. s. p. o. | ||
-- Author(s): Lukas Nevrkla <[email protected]> | ||
-- | ||
-- SPDX-License-Identifier: BSD-3-Clause | ||
|
||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
use ieee.numeric_std.all; | ||
|
||
use work.math_pack.all; | ||
use work.type_pack.all; | ||
|
||
entity MEM_CLEAR is | ||
generic ( | ||
DATA_WIDTH : integer := 32; | ||
ITEMS : integer := 512; | ||
-- Will disable memory clearing during RST | ||
CLEAR_EN : boolean := true | ||
); | ||
port ( | ||
CLK : in std_logic; | ||
RST : in std_logic; | ||
|
||
-- All addresses were generated | ||
CLEAR_DONE : out std_logic; | ||
-- Clear address given by CLEAR_ADDR | ||
CLEAR_WR : out std_logic; | ||
CLEAR_ADDR : out std_logic_vector(log2(ITEMS) - 1 downto 0) | ||
); | ||
end entity; | ||
|
||
architecture FULL of MEM_CLEAR is | ||
|
||
type FSM_STATES_T is ( | ||
CLEAR, | ||
RUNNING | ||
); | ||
|
||
-- State machine -- | ||
|
||
signal curr_state : FSM_STATES_T; | ||
signal next_state : FSM_STATES_T; | ||
|
||
signal addr_i : std_logic_vector(log2(ITEMS)-1 downto 0); | ||
signal addr_r : std_logic_vector(log2(ITEMS)-1 downto 0); | ||
signal rst_r : std_logic; | ||
|
||
begin | ||
|
||
CLEAR_ADDR <= addr_i; | ||
|
||
reg_p : process (CLK) | ||
begin | ||
if (rising_edge(CLK)) then | ||
addr_r <= addr_i; | ||
rst_r <= RST; | ||
end if; | ||
end process; | ||
|
||
------------------- | ||
-- STATE MACHINE -- | ||
------------------- | ||
|
||
state_reg_p : process (CLK) | ||
begin | ||
if (rising_edge(CLK)) then | ||
if (RST = '1') then | ||
if (CLEAR_EN = true) then | ||
curr_state <= CLEAR; | ||
else | ||
curr_state <= RUNNING; | ||
end if; | ||
else | ||
curr_state <= next_state; | ||
end if; | ||
end if; | ||
end process; | ||
|
||
-- Output logic | ||
process (all) | ||
begin | ||
CLEAR_DONE <= '0'; | ||
CLEAR_WR <= '0'; | ||
next_state <= curr_state; | ||
|
||
case curr_state is | ||
when CLEAR => | ||
if (RST = '0') then | ||
CLEAR_wR <= '1'; | ||
|
||
if (rst_r = '1') then | ||
addr_i <= (others => '0'); | ||
else | ||
addr_i <= std_logic_vector(unsigned(addr_r) + 1); | ||
end if; | ||
|
||
if (unsigned(addr_i) = (ITEMS - 1)) then | ||
next_state <= RUNNING; | ||
end if; | ||
end if; | ||
|
||
when RUNNING => | ||
CLEAR_DONE <= '1'; | ||
end case; | ||
end process; | ||
|
||
end architecture; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.. _mem_clear: | ||
|
||
Memory clear | ||
------------ | ||
|
||
Simple component that will generate addresses for memory clearing when RST is asserted. | ||
|
||
Component port and generics description | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
.. vhdl:autoentity:: MEM_CLEAR | ||
:noautogenerics: | ||
|
||
|
||
Instance template | ||
^^^^^^^^^^^^^^^^^ | ||
|
||
.. code-block:: | ||
data_clear_i : entity work.MEM_CLEAR | ||
generic map ( | ||
DATA_WIDTH => BOX_WIDTH, | ||
ITEMS => BOX_CNT, | ||
CLEAR_EN => CLEAR_BY_RST | ||
) | ||
port map ( | ||
CLK => CLK, | ||
RST => RST, | ||
CLEAR_DONE => RST_DONE, | ||
CLEAR_WR => wr_clear, | ||
CLEAR_ADDR => wr_addr_clear | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
from data_logger import data_logger | ||
|
||
__all__ = ["data_logger"] | ||
Oops, something went wrong.