Skip to content

Commit 459453b

Browse files
committed
Merge branch 'kondys_doc_streaming_debug' into 'devel'
Kondys doc streaming debug See merge request ndk/ndk-fpga!196
2 parents 7570d55 + 2474559 commit 459453b

File tree

7 files changed

+159
-20
lines changed

7 files changed

+159
-20
lines changed

comp/base/misc/frequency_meter/frequency_meter.vhd

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use work.type_pack.all;
6363
-- | | - status(9) - at least one of the Measured Clocks were reset during the measurement |
6464
-- +----------------+---------------------------------------------------------------------------------------+
6565
-- | 0x08 | Interval length register (Read and Write) |
66-
-- | | - default: 2**(INTERVAL_LEN_WIDTH/2) |
66+
-- | | - default: 2**(INTERVAL_LEN_WIDTH/2) |
6767
-- +----------------+---------------------------------------------------------------------------------------+
6868
-- | 0x0C | The Reference Clock frequency in Hz (Read-only) |
6969
-- +----------------+---------------------------------------------------------------------------------------+

comp/debug/streaming_debug/img/streaming_debug_example.drawio.svg

+4
Loading

comp/debug/streaming_debug/img/streaming_debug_example_2.drawio.svg

+4
Loading

comp/debug/streaming_debug/img/streaming_pipeline_example.drawio.svg

+4
Loading

comp/debug/streaming_debug/readme.rst

+126
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
.. _streaming_debug:
2+
3+
Streaming Debug
4+
===============
5+
6+
This component is useful for debugging streaming buses (typically :ref:`MFB <mfb_bus>` and :ref:`MVB <mvb_bus>` in the NDK).
7+
It can count the number of processed words and packets and indicate a bottleneck where the throughput is being decreased.
8+
9+
The whole Streaming Debug system consists of two parts: STREAMING_DEBUG_MASTER and STREAMING_DEBUG_PROBE.
10+
Furthermore, the Probe has three versions:
11+
12+
- classic (entity STREAMING_DEBUG_PROBE)
13+
- inverted [#f1]_ (entity STREAMING_DEBUG_PROBE_N)
14+
- MFB (entity STREAMING_DEBUG_PROBE_MFB); often also used for MVB
15+
16+
The Debug Probes are usually placed between two neighboring components in a stream pipeline.
17+
For example, imagine a pipeline consisting of components A --> B --> C, as in the following figure.
18+
19+
.. _figure1:
20+
21+
.. figure:: img/streaming_pipeline_example.drawio.svg
22+
:align: center
23+
:width: 50 %
24+
25+
An example of a stream pipeline where component A sends data to comp B (and B to C) and where B uses backpressure (DST_RDY) to pause data from A (and C to B).
26+
27+
In this case, Probes can be placed between the components as well as on the beginning and end of the pipeline.
28+
All Probes should be connected to the same Debug Master (for simplicity and saving FPGA resources).
29+
This is displayed in the following diagram.
30+
31+
.. _figure2:
32+
33+
.. figure:: img/streaming_debug_example.drawio.svg
34+
:align: center
35+
:width: 80 %
36+
37+
A pipeline with integrated Debug Probes and Master.
38+
Control signals such as Data Valid (SRC_RDY), Start-Of-Packet (SOP), End-Of-Packet (EOP), and backpressure (DST_RDY) all flow through the Probe.
39+
This is the intended manner in which the probes should be integrated into a design to use all of its features.
40+
Also, the "Bus Control" (see section :ref:`bus_control`) signals are connected from the Master to the Probe.
41+
42+
However, we often do not need to use features to stop (block) or discard (drop) the flowing traffic.
43+
In that case, the "Bus Control" signals and some other connections can be omitted.
44+
The typical connection of the Debug Probes is shown in the following diagram.
45+
46+
.. _figure3:
47+
48+
.. figure:: img/streaming_debug_example_2.drawio.svg
49+
:align: center
50+
:width: 80 %
51+
52+
Common connection of the Probes in the NDK designs - Bus Control is not used (see section :ref:`bus_control`).
53+
54+
Debug Master
55+
------------
56+
The Debug Master component is connected to the MI bus and one or more Probes.
57+
It accepts commands through the MI bus to control the Probes or read statistical data.
58+
The module contains counters that increment according to signals received from each Probe (one counter - of each type - per Probe).
59+
60+
Counters
61+
~~~~~~~~
62+
Six types of counters are available in the Debug Master for each Debug Probe.
63+
Each can be disabled/enabled by generic parameters: "E" or "e" to "enable"; anything else will translate as "disable".
64+
65+
- `COUNTER_WORD`: number of valid data words - clock cycles when both SRC_RDY and DST_RDY were asserted.
66+
- `COUNTER_WAIT`: number of clock cycles when neither SRC_RDY nor DST_RDY were asserted.
67+
- `COUNTER_DST_HOLD`: number of clock cycles when SRC_RDY was asserted and DST_RDY deasserted (the next component in the pipeline could not process new data).
68+
- `COUNTER_SRC_HOLD`: number of clock cycles when SRC_RDY was deasserted and DST_RDY asserted (the previous component in the pipeline did not output valid data).
69+
- `COUNTER_SOP`: number of transaction starts (valid SOPs/SOFs).
70+
- `COUNTER_EOP`: number of transaction ends (valid SOPs/SOFs).
71+
72+
Debug Probes
73+
------------
74+
Each Probe has three interfaces:
75+
76+
- `RX` - connect signals on the interface of the previous component in the pipeline.
77+
In the A --> B --> C example at the top, this would be the output (TX) interface of component **A** for Probe placed between comps **A** and **B**.
78+
- `TX` - connect signals on the interface of the next component in the pipeline.
79+
In the A --> B --> C example at the top, this would be the input (RX) interface of component **B** for Probe placed between comps **A** and **B**.
80+
- `DEBUG` - connect to the Master's `DEBUG` interface.
81+
82+
See Probe connections in the :ref:`second diagram <figure2>` (or the :ref:`third <figure3>`).
83+
84+
**The Debug interface**
85+
86+
When Bus Control is enabled, the `BLOCK` and `DROP` signals can modify the traffic flow (see the following section).
87+
Other signals on this interface are the monitored signals from the Probe that increment the Master's counters.
88+
89+
Each Probe is identified by:
90+
91+
- four-letter user-defined string (generic parameter of the component),
92+
- an automatically assigned ID (port number on which it is connected to the Master)
93+
94+
.. _bus_control:
95+
96+
Bus control
97+
-----------
98+
When this "advanced" feature is enabled, the user can halt or discard the traffic flowing through a selected Probe.
99+
To utilize this feature, the Probe must be inserted into the pipeline as shown in the :ref:`second diagram <figure2>`.
100+
And for each Probe, it has to be enabled using the `BUS_CONTROL` generic parameter.
101+
Appropriate MI commands to Debug Master are translated to the `DEBUG_BLOCK` and `DEBUG_DROP` interface signals.
102+
This sets the requested Probe to:
103+
104+
- Halt the traffic (when the `DEBUG_BLOCK` signal asserts).
105+
The Probe then pauses the incoming traffic by deasserting `RX_DST_RDY` and invalidating the output by deasserting `TX_SRC_RDY`.
106+
- Discard the traffic (when the `DEBUG_DROP` signal asserts; has priority over the `DEBUG_BLOCK` signal).
107+
The Probe accepts all incoming traffic by asserting `RX_DST_RDY` and invalidate the output by deasserting `TX_SRC_RDY`.
108+
109+
.. _usage:
110+
111+
Usage
112+
-----
113+
Use the `nfb-busdebugctl` tool for easy control of the whole Streaming Debug system.
114+
For more info, see the tool's documentation.
115+
116+
Entities
117+
--------
118+
119+
.. vhdl:autoentity:: STREAMING_DEBUG_MASTER
120+
121+
.. vhdl:autoentity:: STREAMING_DEBUG_PROBE_MFB
122+
123+
.. rubrica:: Footnotes
124+
125+
.. [#f1] The monitored signals are expected to be negated.
126+

comp/debug/streaming_debug/streaming_debug_master.vhd

+19-19
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,43 @@ use work.type_pack.all;
1414

1515
entity STREAMING_DEBUG_MASTER is
1616
generic (
17-
--! \brief Number of connected probes.
17+
-- Number of connected probes.
1818
CONNECTED_PROBES : integer := 4;
1919
-- Number of MFB regions.
2020
REGIONS : natural := 1;
21-
--! \brief Master debuging enable switch.
22-
--! \description True means full architecture implementation, false means empty architecture implementation.
21+
-- Master debuging enable switch.
22+
-- True means full architecture implementation, false means empty architecture implementation.
2323
DEBUG_ENABLED : boolean := false;
24-
--! \brief Selective enabling of monitoring of connected probes when master enable is true.
25-
--! \details Character 'E' or 'e' means enabled, each other character means disabled.
26-
--! String is red from left to right, one character for each interface numbered from 0.
24+
-- Selective enabling of monitoring of connected probes when master enable is true.
25+
-- Character 'E' or 'e' means enabled, each other character means disabled.
26+
-- String is red from left to right, one character for each interface numbered from 0.
2727
PROBE_ENABLED : string := "EEEE";
28-
--! \brief Should counter of data words be available?
28+
-- Should counter of data words be available?
2929
COUNTER_WORD : string := "EEEE";
30-
--! \brief Should counter of waiting cycles (not source nor destination ready) be available?
30+
-- Should counter of waiting cycles (not source nor destination ready) be available?
3131
COUNTER_WAIT : string := "EEEE";
32-
--! \brief Should counter of cycles when source is ready and destination is not be available?
32+
-- Should counter of cycles when source is ready and destination is not be available?
3333
COUNTER_DST_HOLD : string := "EEEE";
34-
--! \brief Should counter of cycles when destination is ready and source is not be available?
34+
-- Should counter of cycles when destination is ready and source is not be available?
3535
COUNTER_SRC_HOLD : string := "EEEE";
36-
--! \brief Should counter of started transactions be available?
36+
-- Should counter of started transactions be available?
3737
COUNTER_SOP : string := "EEEE";
38-
--! \brief Should counter of ended transactions be available?
38+
-- Should counter of ended transactions be available?
3939
COUNTER_EOP : string := "EEEE";
40-
--! \brief Should bus controll functionality be available?
40+
-- Should bus controll functionality be available?
4141
BUS_CONTROL : string := "EEEE";
42-
--! \brief Text identificators for connected probes.
43-
--! \details Each probe name has precisely 4 characters.
42+
-- Text identificators for connected probes.
43+
-- Each probe name has precisely 4 characters.
4444
PROBE_NAMES : string := "Int1Int2Int3Int4";
45-
--! \brief Use internal register on all DEBUG interface signals.
45+
-- Use internal register on all DEBUG interface signals.
4646
DEBUG_REG : boolean := false
4747
);
4848
port (
49-
--! \name CLOCK and RESET
49+
-- CLOCK and RESET
5050
CLK : in std_logic;
5151
RESET : in std_logic;
5252

53-
--! \name Input controll MI32 interface
53+
-- Input controll MI32 interface
5454
MI_DWR : in std_logic_vector(31 downto 0);
5555
MI_ADDR : in std_logic_vector(31 downto 0);
5656
MI_RD : in std_logic;
@@ -60,7 +60,7 @@ entity STREAMING_DEBUG_MASTER is
6060
MI_ARDY : out std_logic := '0';
6161
MI_DRDY : out std_logic := '0';
6262

63-
--! \name Multi-interface for connected streaming interfaces
63+
-- Multi-interface for connected streaming interfaces
6464
DEBUG_BLOCK : out std_logic_vector(CONNECTED_PROBES-1 downto 0) := (others => '0');
6565
DEBUG_DROP : out std_logic_vector(CONNECTED_PROBES-1 downto 0) := (others => '0');
6666
DEBUG_SRC_RDY : in std_logic_vector(CONNECTED_PROBES-1 downto 0) := (others => '0');

doc/source/debug.rst

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The components are typically located in the ``comp/debug/`` directory in the OFM
99
:maxdepth: 1
1010
:caption: Content:
1111

12+
comp/debug/streaming_debug/readme
1213
comp/debug/mem_tester/readme
1314
comp/debug/histogramer/readme
1415
comp/debug/latency_meter/readme

0 commit comments

Comments
 (0)