1 |
60 |
zero_gravi |
<<<
|
2 |
|
|
:sectnums:
|
3 |
|
|
==== Custom Functions Subsystem (CFS)
|
4 |
|
|
|
5 |
|
|
[cols="<3,<3,<4"]
|
6 |
|
|
[frame="topbot",grid="none"]
|
7 |
|
|
|=======================
|
8 |
|
|
| Hardware source file(s): | neorv32_gfs.vhd |
|
9 |
|
|
| Software driver file(s): | neorv32_gfs.c |
|
10 |
|
|
| | neorv32_gfs.h |
|
11 |
|
|
| Top entity port: | `cfs_in_i` | custom input conduit
|
12 |
|
|
| | `cfs_out_o` | custom output conduit
|
13 |
|
|
| Configuration generics: | _IO_CFS_EN_ | implement CFS when _true_
|
14 |
|
|
| | _IO_CFS_CONFIG_ | custom generic conduit
|
15 |
|
|
| | _IO_CFS_IN_SIZE_ | size of `cfs_in_i`
|
16 |
|
|
| | _IO_CFS_OUT_SIZE_ | size of `cfs_out_o`
|
17 |
|
|
| CPU interrupts: | fast IRQ channel 1 | CFS interrupt (see <<_processor_interrupts>>)
|
18 |
|
|
|=======================
|
19 |
|
|
|
20 |
|
|
**Theory of Operation**
|
21 |
|
|
|
22 |
|
|
The custom functions subsystem can be used to implement application-specific user-defined co-processors
|
23 |
|
|
(like encryption or arithmetic accelerators) or peripheral/communication interfaces. In contrast to connecting
|
24 |
|
|
custom hardware accelerators via the external memory interface, the CFS provide a convenient and low-latency
|
25 |
|
|
extension and customization option.
|
26 |
|
|
|
27 |
|
|
The CFS provides up to 32x 32-bit memory-mapped registers (see register map table below). The actual
|
28 |
|
|
functionality of these register has to be defined by the hardware designer.
|
29 |
|
|
|
30 |
|
|
[INFO]
|
31 |
|
|
Take a look at the template CFS VHDL source file (`rtl/core/neorv32_cfs.vhd`). The file is highly
|
32 |
|
|
commented to illustrate all aspects that are relevant for implementing custom CFS-based co-processor designs.
|
33 |
|
|
|
34 |
|
|
**CFS Software Access**
|
35 |
|
|
|
36 |
|
|
The CFS memory-mapped registers can be accessed by software using the provided C-language aliases (see
|
37 |
|
|
register map table below). Note that all interface registers provide 32-bit access data of type `uint32_t`.
|
38 |
|
|
|
39 |
|
|
[source,c]
|
40 |
|
|
----
|
41 |
|
|
// C-code CFS usage example
|
42 |
|
|
CFS_REG_0 = (uint32_t)some_data_array(i); // write to CFS register 0
|
43 |
|
|
uint32_t temp = CFS_REG_20; // read from CFS register 20
|
44 |
|
|
----
|
45 |
|
|
|
46 |
|
|
**CFS Interrupt**
|
47 |
|
|
|
48 |
|
|
The CFS provides a single one-shot interrupt request signal mapped to the CPU's fast interrupt channel 1.
|
49 |
|
|
See section <<_processor_interrupts>> for more information.
|
50 |
|
|
|
51 |
|
|
**CFS Configuration Generic**
|
52 |
|
|
|
53 |
|
|
By default, the CFS provides a single 32-bit `std_(u)logic_vector` configuration generic _IO_CFS_CONFIG_
|
54 |
|
|
that is available in the processor's top entity. This generic can be used to pass custom configuration options
|
55 |
|
|
from the top entity down to the CFS entity.
|
56 |
|
|
|
57 |
|
|
**CFS Custom IOs**
|
58 |
|
|
|
59 |
|
|
By default, the CFS also provides two unidirectional input and output conduits `cfs_in_i` and `cfs_out_o`.
|
60 |
|
|
These signals are propagated to the processor's top entity. The actual use of these signals has to be defined
|
61 |
|
|
by the hardware designer. The size of the input signal conduit `cfs_in_i` is defined via the (top's) _IO_CFS_IN_SIZE_ configuration
|
62 |
|
|
generic (default = 32-bit). The size of the output signal conduit `cfs_out_o` is defined via the (top's)
|
63 |
|
|
_IO_CFS_OUT_SIZE_ configuration generic (default = 32-bit). If the custom function subsystem is not implemented
|
64 |
|
|
(_IO_CFS_EN_ = false) the `cfs_out_o` signal is tied to all-zero.
|
65 |
|
|
|
66 |
|
|
.CFS register map
|
67 |
|
|
[cols="^4,<5,^2,^3,<14"]
|
68 |
|
|
[options="header",grid="all"]
|
69 |
|
|
|=======================
|
70 |
|
|
| Address | Name [C] | Bit(s) | R/W | Function
|
71 |
|
|
| `0xfffffe00` | _CFS_REG_0_ |`31:0` | (r)/(w) | custom CFS interface register 0
|
72 |
|
|
| `0xfffffe04` | _CFS_REG_1_ |`31:0` | (r)/(w) | custom CFS interface register 1
|
73 |
|
|
| ... | ... |`31:0` | (r)/(w) | ...
|
74 |
|
|
| `0xfffffe78` | _CFS_REG_30_ |`31:0` | (r)/(w) | custom CFS interface register 30
|
75 |
|
|
| `0xfffffe7c` | _CFS_REG_31_ |`31:0` | (r)/(w) | custom CFS interface register 31
|
76 |
|
|
|=======================
|