Line 18... |
Line 18... |
|=======================
|
|=======================
|
|
|
**Theory of Operation**
|
**Theory of Operation**
|
|
|
The custom functions subsystem is meant for implementing custom and application-specific logic.
|
The custom functions subsystem is meant for implementing custom and application-specific logic.
|
The CFS provides up to 32x 32-bit memory-mapped
|
The CFS provides up to 32x 32-bit memory-mapped read/write
|
registers (`REG`, see register map below) that can be accessed by the CPU via normal load/store operations.
|
registers (`REG`, see register map below) that can be accessed by the CPU via normal load/store operations.
|
The actual functionality of these register has to be defined by the hardware designer. Furthermore, the CFS
|
The actual functionality of these register has to be defined by the hardware designer. Furthermore, the CFS
|
provides two IO conduits to implement custom module- or chip-external interfaces.
|
provides two IO conduits to implement custom on-chip or off-chip interfaces.
|
|
|
In contrast to connecting custom hardware accelerators via external memory interfaces (like SPI or the processor's
|
In contrast to connecting custom hardware accelerators via external memory interfaces (like SPI or the processor's
|
external bus interface), the CFS provide a convenient, low-latency and tightly-coupled extension and
|
external bus interface), the CFS provide a convenient, low-latency and tightly-coupled extension and
|
customization option.
|
customization option.
|
|
|
Line 45... |
Line 45... |
|
|
|
|
**CFS Software Access**
|
**CFS Software Access**
|
|
|
The CFS memory-mapped registers can be accessed by software using the provided C-language aliases (see
|
The CFS memory-mapped registers can be accessed by software using the provided C-language aliases (see
|
register map table below). Note that all interface registers provide 32-bit access data of type `uint32_t`.
|
register map table below). Note that all interface registers are declared as 32-bit words of type `uint32_t`.
|
|
|
|
.CFS Software Access Example
|
[source,c]
|
[source,c]
|
----
|
----
|
// C-code CFS usage example
|
// C-code CFS usage example
|
NEORV32_CFS.REG[0] = (uint32_t)some_data_array(i); // write to CFS register 0
|
NEORV32_CFS.REG[0] = (uint32_t)some_data_array(i); // write to CFS register 0
|
uint32_t temp = NEORV32_CFS.REG[20]; // read from CFS register 20
|
int temp = (int)NEORV32_CFS.REG[20]; // read from CFS register 20
|
----
|
----
|
|
|
[TIP]
|
[TIP]
|
A very simple example program that uses the _default_ CFS hardware module can be found in `sw/example/cfs_demo`.
|
A very simple example program that uses the _default_ CFS hardware module can be found in `sw/example/cfs_demo`.
|
|
|
|
|
**CFS Interrupt**
|
**CFS Interrupt**
|
|
|
The CFS provides a single high-level-triggered interrupt request signal mapped to the CPU's fast interrupt channel 1.
|
The CFS provides a single high-level-triggered interrupt request signal mapped to the CPU's fast interrupt channel 1.
|
Once triggered, the interrupt becomes pending (if enabled in the `mis` CSR) and has to be explicitly cleared again by setting
|
Once triggered, the interrupt becomes pending (if enabled in the `mis` CSR) and has to be explicitly cleared again by
|
the according `mip` CSR bit. See section <<_processor_interrupts>> for more information.
|
writing zero to the according <<_mip>> CSR bit. See section <<_processor_interrupts>> for more information.
|
|
|
|
|
**CFS Configuration Generic**
|
**CFS Configuration Generic**
|
|
|
By default, the CFS provides a single 32-bit `std_(u)logic_vector` configuration generic _IO_CFS_CONFIG_
|
By default, the CFS provides a single 32-bit `std_(u)logic_vector` configuration generic _IO_CFS_CONFIG_
|