OpenCores
URL https://opencores.org/ocsvn/neorv32/neorv32/trunk

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [docs/] [datasheet/] [soc_slink.adoc] - Blame information for rev 73

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 61 zero_gravi
<<<
2
:sectnums:
3
==== Stream Link Interface (SLINK)
4
 
5
[cols="<3,<3,<4"]
6
[frame="topbot",grid="none"]
7
|=======================
8
| Hardware source file(s): | neorv32_slink.vhd |
9
| Software driver file(s): | neorv32_slink.c |
10
|                          | neorv32_slink.h |
11
| Top entity port:         | `slink_tx_dat_o` | TX link data (8x32-bit)
12
|                          | `slink_tx_val_o` | TX link data valid (8-bit)
13
|                          | `slink_tx_rdy_i` | TX link allowed to send (8-bit)
14
|                          | `slink_rx_dat_i` | RX link data (8x32-bit)
15
|                          | `slink_rx_val_i` | RX link data valid (8-bit)
16
|                          | `slink_rx_rdy_o` | RX link ready to receive (8-bit)
17
| Configuration generics:  | _SLINK_NUM_TX_  | Number of TX links to implement (0..8)
18
|                          | _SLINK_NUM_RX_  | Number of RX links to implement (0..8)
19
|                          | _SLINK_TX_FIFO_ | FIFO depth (1..32k) of TX links, has to be a power of two
20
|                          | _SLINK_RX_FIFO_ | FIFO depth (1..32k) of RX links, has to be a power of two
21 62 zero_gravi
| CPU interrupts:          | fast IRQ channel 10 | SLINK RX IRQ (see <<_processor_interrupts>>)
22
|                          | fast IRQ channel 11 | SLINK TX IRQ (see <<_processor_interrupts>>)
23 61 zero_gravi
|=======================
24
 
25
The SLINK component provides up to 8 independent RX (receiving) and TX (sending) links for transmitting
26
stream data. The interface provides higher bandwidth (and less latency) than the external memory bus
27
interface, which makes it ideally suited to couple custom stream processing units (like CORDIC, FFTs or
28
cryptographic accelerators).
29
 
30
Each individual link provides an internal FIFO for data buffering. The FIFO depth is globally defined
31
for all TX links via the _SLINK_TX_FIFO_ generic and for all RX links via the _SLINK_RX_FIFO_ generic.
32
The FIFO depth has to be at least 1, which will implement a simple input/output register. The maximum
33
value is limited to 32768 entries. Note that the FIFO depth has to be a power of two (for optimal
34
logic mapping).
35
 
36
The actual number of implemented RX/TX links is configured by the _SLINK_NUM_RX_ and _SLINK_NUM_TX_
37
generics. The SLINK module will be synthesized only if at least one of these generics is greater than
38
zero. All unimplemented links are internally terminated and their according output signals are pulled
39
to low level.
40
 
41
[NOTE]
42
The SLINK interface does not provide any additional tag signals (for example to define a "stream destination
43
address" or to indicate the last data word of a "package"). Use a custom controller connected
44 62 zero_gravi
via the external memory bus interface or use some of the processor's GPIO ports to implement custom data
45
tag signals.
46 61 zero_gravi
 
47 65 zero_gravi
 
48 61 zero_gravi
**Theory of Operation**
49
 
50 64 zero_gravi
The SLINK provides eight data registers (`DATA[i]`) to access the links (read accesses will access the RX links, write
51
accesses will access the TX links), one control register (`CTRL`) and one status register (`STATUS`).
52 62 zero_gravi
 
53 64 zero_gravi
The SLINK is globally activated by setting the control register's enable bit _SLINK_CTRL_EN_.
54
The actual data links are accessed by reading or writing the according link data registers `DATA[0]`
55
to `DATA[7]`. For example, writing the `DATA[0]` will put the according data into the FIFO of TX link 0.
56
Accordingly, reading from `DATA[0]` will return one data word from the FIFO of RX link 0.
57 61 zero_gravi
 
58 62 zero_gravi
The configuration (done via the SLINK generics) can be checked by software by evaluating bit fields in the
59 64 zero_gravi
control register. The _SLINK_CTRL_TX_FIFO_Sx_ and _SLINK_CTRL_RX_FIFO_Sx_ indicate the TX & RX FIFO sizes.
60
The _SLINK_CTRL_TX_NUMx_ and _SLINK_CTRL_RX_NUMx_ bits represent the absolute number of implemented TX and RX links.
61 61 zero_gravi
 
62 64 zero_gravi
The status register shows the FIFO status flags of each RX and TX link. The _SLINK_CTRL_RXx_AVAIL_ flags indicate
63
that there is _at least_ one data word in the according RX link's FIFO. The _SLINK_CTRL_TXx_FREE_ flags indicate
64 62 zero_gravi
there is _at least_ one free entry in the according TX link's FIFO. The _SLINK_STATUS_RXx_HALF_ and
65
_SLINK_STATUS_RXx_HALF_ flags show if a certain FIFO's fill level has exceeded half of its capacity.
66 61 zero_gravi
 
67 62 zero_gravi
 
68 61 zero_gravi
**Blocking Link Access**
69
 
70
When directly accessing the link data registers (without checking the according FIFO status flags) the access
71 62 zero_gravi
is as _blocking_. That means the CPU access will stall until the accessed link responds. For
72 64 zero_gravi
example, when reading RX link 0 (via `DATA[0]` register) the CPU will stall, if there is not data
73 62 zero_gravi
available in the according FIFO yet. The CPU access will complete as soon as RX link 0 receives new data.
74 61 zero_gravi
 
75 64 zero_gravi
Vice versa, writing data to TX link 0 (via `DATA[0]` register) will stall the CPU access until there is
76 61 zero_gravi
at least one free entry in the link's FIFO.
77
 
78
[WARNING]
79
The NEORV32 processor ensures that _any_ CPU access to memory-mapped devices (including the SLINK module)
80
will **time out** after a certain number of cycles (see section <<_bus_interface>>).
81
Hence, blocking access to a stream link that does not complete within a certain amount of cycles will
82 68 zero_gravi
raise a _store bus access exception_ when writing to a _full_ TX link's FIFO or a _load bus access exception_
83
when reading from an _empty_ RX 's FIFO. Hence, this concept should only be used when evaluating the half-full
84
FIFO condition (for example via the SLINK interrupts) before actual accessing links.
85 61 zero_gravi
 
86 68 zero_gravi
[NOTE]
87
There is no RX FIFO overflow mechanism available yet.
88 65 zero_gravi
 
89 68 zero_gravi
 
90 61 zero_gravi
**Non-Blocking Link Access**
91
 
92 64 zero_gravi
For a non-blocking link access concept, the FIFO status flags in `STATUS` need to be checked _before_
93 61 zero_gravi
reading/writing the actual link data register. For example, a non-blocking write access to a TX link 0 has
94 62 zero_gravi
to check _SLINK_STATUS_TX0_FREE_ first. If the bit is set, the FIFO of TX link 0 can take another data word
95 64 zero_gravi
and the actual data can be written to `DATA[0]`. If the bit is cleared, the link's FIFO is full
96 62 zero_gravi
and the status flag can be polled until it there is free space in the available.
97 61 zero_gravi
 
98
This concept will not raise any exception as there is no "direct" access to the link data registers.
99 62 zero_gravi
However, non-blocking accesses require additional instructions to check the according status flags prior
100
to the actual link access, which will reduce performance for high-bandwidth data streams.
101 61 zero_gravi
 
102
 
103
**Stream Link Interface & Protocol**
104
 
105
The SLINK interface consists of three signals `dat`, `val` and `rdy` for each RX and TX link.
106
Each signal is an "array" with eight entires (one for each link). Note that an entry in `slink_*x_dat` is 32-bit
107
wide while entries in `slink_*x_val` and `slink_*x_rdy` are are just 1-bit wide.
108
 
109
The stream link protocol is based on a simple FIFO-like interface between a source (sender) and a sink (receiver).
110 62 zero_gravi
Each link provides two signals for implementing a simple FIFO-style handshake. The `slink_*x_val` signal is set by
111
the source if the according `slink_*x_dat` (also set by the source) contains valid data. The stream source has to
112
ensure that both signals remain stable until the according `slink_*x_rdy` signal is set by the stream sink to
113
indicate it can accept another data word.
114 61 zero_gravi
 
115 62 zero_gravi
In summary, a data word is transferred if both `slink_*x_val(i)` and `slink_*x_rdy(i)` are high.
116 61 zero_gravi
 
117
.Exemplary stream link transfer
118
image::stream_link_interface.png[width=560,align=center]
119
 
120
[TIP]
121 62 zero_gravi
The SLINK handshake protocol is compatible with the https://developer.arm.com/documentation/ihi0051/a/Introduction/About-the-AXI4-Stream-protocol[AXI4-Stream] base protocol.
122 61 zero_gravi
 
123 65 zero_gravi
 
124 68 zero_gravi
**SLINK Interrupts**
125 65 zero_gravi
 
126
The stream interface provides two independent interrupts that are _globally_ driven by the RX and TX link's
127
FIFO fill level status. Each RX and TX link provides an individual interrupt enable flag and an individual
128
interrupt type flag that allows to configure interrupts only for certain (or all) links and for application-
129 68 zero_gravi
specific FIFO conditions. The interrupt configuration is done using the `NEORV32_SLINK.IRQ` register.
130 65 zero_gravi
Any interrupt can only become pending if the SLINK module is enabled at all.
131
 
132 68 zero_gravi
[NOTE]
133
There is no RX FIFO overflow mechanism available yet.
134
 
135 65 zero_gravi
The current FIFO fill-level of a specific **RX link** can only raise an interrupt request if it's interrupt enable flag
136
_SLINK_IRQ_RX_EN_ is set. Vice versa, the current FIFO fill-level of a specific **TX link** can only raise an interrupt
137
request if it's interrupt enable flag _SLINK_IRQ_TX_EN_ is set.
138
 
139
The **RX link's** _SLINK_IRQ_RX_MODE_ flags define the FIFO fill-level condition for raising an RX interrupt request:
140 69 zero_gravi
* If a link's interrupt mode flag is `0` an IRQ is generated when the link's FIFO _becomes_ not empty ("RX data available").
141
* If a link's interrupt mode flag is `1` an IRQ is generated when the link's FIFO _becomes_ at least half-full ("time to get data from RX FIFO to prevent overflow").
142 65 zero_gravi
 
143
The **TX link's** _SLINK_IRQ_TX_MODE_ flags define the FIFO fill-level condition for raising an TX interrupt request:
144 69 zero_gravi
* If a link's interrupt mode flag is `0` an IRQ is generated when the link's FIFO _becomes_ not full ("space left in FIFO for new TX data").
145
* If a link's interrupt mode flag is `1` an IRQ is generated when the link's FIFO _becomes_ less than half-full ("SW can send _SLINK_TX_FIFO_/2 data words without checking any flags").
146 65 zero_gravi
 
147 73 zero_gravi
Once the SLINK's RX or TX interrupt has become pending, it has to be explicitly cleared again by writing
148
zero to the according <<_mip>> CSR bit.
149 69 zero_gravi
 
150 68 zero_gravi
[IMPORTANT]
151
The interrupt configuration register `NEORV32_SLINK.IRQ` should we written _before_ the SLINK
152
module is actually enabled.
153 65 zero_gravi
 
154
[NOTE]
155 68 zero_gravi
If _SLINK_RX_FIFO_ is 1 all _SLINK_IRQ_RX_MODE_ bits are hardwired to one.
156
If _SLINK_TX_FIFO_ is 1 all _SLINK_IRQ_TX_MODE_ bits are hardwired to one.
157 65 zero_gravi
 
158
 
159 64 zero_gravi
.SLINK register map (`struct NEORV32_SLINK`)
160 61 zero_gravi
[cols="^4,<5,^2,^2,<14"]
161
[options="header",grid="all"]
162
|=======================
163
| Address | Name [C] | Bit(s) | R/W | Function
164 64 zero_gravi
.6+<| `0xfffffec0` .6+<| `NEORV32_SLINK.CTRL` <| `31` _SLINK_CTRL_EN_ ^| r/w | SLINK global enable
165
                                              <| `30:16` _reserved_ ^| r/- <| reserved, read as zero
166
                                              <| `15:12` _SLINK_CTRL_TX_FIFO_S3_ : _SLINK_CTRL_TX_FIFO_S0_ ^| r/- <| TX links FIFO depth, log2 of_SLINK_TX_FIFO_ generic
167
                                              <| `11:8` _SLINK_CTRL_RX_FIFO_S3_ : _SLINK_CTRL_RX_FIFO_S0_  ^| r/- <| RX links FIFO depth, log2 of_SLINK_RX_FIFO_ generic
168
                                              <| `7:4` _SLINK_CTRL_TX_NUM3_ : _SLINK_CTRL_TX_NUM0_ ^| r/- <| Number of implemented TX links
169
                                              <| `3:0` _SLINK_CTRL_RX_NUM3_ : _SLINK_CTRL_RX_NUM0_ ^| r/- <| Number of implemented RX links
170 65 zero_gravi
| `0xfffffec4` | - |`31:0` | r/- | _reserved_
171
.4+<| `0xfffffec8` .4+<| `NEORV32_SLINK.IRQ` <|`31:24` _SLINK_IRQ_RX_EN_MSB_ : _SLINK_IRQ_RX_EN_LSB_     ^| r/w <| RX interrupt enable for link 7..0
172 68 zero_gravi
                                             <|`23:16` _SLINK_IRQ_RX_MODE_MSB_ : _SLINK_IRQ_RX_MODE_LSB_ ^| r/w <| RX IRQ mode for link 7..0: `0` = FIFO rises above half-full; `1` = FIFO not empty
173 65 zero_gravi
                                             <|`15:8`  _SLINK_IRQ_TX_EN_MSB_ : _SLINK_IRQ_TX_EN_LSB_     ^| r/w <| TX interrupt enable for link 7..0
174 68 zero_gravi
                                             <|`7:0`   _SLINK_IRQ_TX_MODE_MSB_ : _SLINK_IRQ_TX_MODE_LSB_ ^| r/w <| TX IRQ mode for link 7..0: `0` = FIFO falls below half-full; `1` = FIFO not full
175 65 zero_gravi
| `0xfffffeec` | - |`31:0` | r/- | _reserved_
176
.4+<| `0xfffffed0` .4+<| `NEORV32_SLINK.STATUS` <| `31:24` _SLINK_STATUS_TX7_HALF_ : _SLINK_STATUS_TX0_HALF_ ^| r/- <| TX link 7..0 FIFO fill level is >= half-full
177 64 zero_gravi
                                                <| `23:16` _SLINK_STATUS_RX7_HALF_ : _SLINK_STATUS_RX0_HALF_ ^| r/- <| RX link 7..0 FIFO fill level is >= half-full
178
                                                <| `15:8`  _SLINK_STATUS_TX7_FREE_  : _SLINK_STATUS_TX0_FREE_  ^| r/- <| At least one free TX FIFO entry available for link 7..0
179
                                                <| `7:0`   _SLINK_STATUS_RX7_AVAIL_ : _SLINK_STATUS_RX0_AVAIL_ ^| r/- <| At least one data word in RX FIFO available for link 7..0
180 65 zero_gravi
| `0xfffffed4` : `0xfffffedc` | - |`31:0` | r/- | _reserved_
181 64 zero_gravi
| `0xfffffee0` | `NEORV32_SLINK.DATA[0]` | `31:0` | r/w | Link 0 RX/TX data
182
| `0xfffffee4` | `NEORV32_SLINK.DATA[1]` | `31:0` | r/w | Link 1 RX/TX data
183
| `0xfffffee8` | `NEORV32_SLINK.DATA[2]` | `31:0` | r/w | Link 2 RX/TX data
184
| `0xfffffeec` | `NEORV32_SLINK.DATA[3]` | `31:0` | r/w | Link 3 RX/TX data
185
| `0xfffffef0` | `NEORV32_SLINK.DATA[4]` | `31:0` | r/w | Link 4 RX/TX data
186
| `0xfffffef4` | `NEORV32_SLINK.DATA[5]` | `31:0` | r/w | Link 5 RX/TX data
187
| `0xfffffef8` | `NEORV32_SLINK.DATA[6]` | `31:0` | r/w | Link 6 RX/TX data
188
| `0xfffffefc` | `NEORV32_SLINK.DATA[7]` | `31:0` | r/w | Link 7 RX/TX data
189 61 zero_gravi
|=======================

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.