Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions core-v-mcu.core
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ filesets:
- tb/uartdpi/uartdpi.sv
- tb/qspi_model/GD25Q128B.v
file_type: systemVerilogSource
event-generator-test-rtl:
files:
- rtl/vendor/pulp_platform_common_cells/src/deprecated/generic_fifo.sv
- rtl/core-v-mcu/soc/soc_event_queue.sv
- rtl/core-v-mcu/soc/soc_event_arbiter.sv
- rtl/core-v-mcu/soc/soc_event_generator.sv
- tb/soc_event_generator_tb.sv
file_type: systemVerilogSource
nexys-rtl:
files:
- emulation/core-v-mcu-nexys/rtl/core_v_mcu_nexys.v
Expand Down Expand Up @@ -301,6 +309,23 @@ targets:
- -Wno-fatal
- --timing

event-generator-test:
default_tool: verilator
filesets:
- event-generator-test-rtl
parameters:
- PULP_FPGA_EMUL=true
toplevel: [soc_event_generator_tb]
tools:
icarus:
iverilog_options:
- -g2012
verilator:
mode: binary
verilator_options:
- -Wno-fatal
- --timing

nexys-a7-100t:
<<: *default_target
default_tool: vivado
Expand Down
44 changes: 28 additions & 16 deletions docs/doc-src/ip-blocks/apb_event_cntrl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,25 @@ APB event controller routes events to the following ouput channels:

- **FC Channel (Fabric Controller / Core Complex):**

FC Channel is responsible to communicate events to the Fabric Controller.
The APB event controller use following approach to notify events to the Fabric Controller:

- Pin based high priority event notification: Routes high-priority events to the Fabric Controller through fc_events_o pin. This feature is not implemented in the current version hence out of scope for this manual.
- FIFO based event notification: Events are accumulated in FIFO and event_fifo_valid_o signal is raised to notify events to Fabric Controller.

Whenever a valid event is present for FC channel, it is pushed onto the FC FIFO. The FC FIFO is a 4-entry queue that holds events until they are read by the Fabric Controller.
When an event is available is the FC FIFO, the APB event controller raises event_fifo_valid_o signal to the Fabric Controller. In response to the signal, Fabric Controller can read the event ID through the FIFO CSR.
Once the event is read, the Fabric Controller can acknowledge it by asserting ``core_irq_ack_i = 1`` and setting ``core_irq_ack_id_i = 11``.
The event is then popped from the FC FIFO and next event is placed on the FIFO CSR.
The event_fifo_valid_o signal is deasserted once the FC FIFO is empty.
FC Channel is responsible for communicating events to the Fabric Controller.
The APB event controller has the following event notification paths:

Comment thread
MikeOpenHWGroup marked this conversation as resolved.
- Pin-based high-priority event notification: ``fc_events_o[1:0]`` directly mirrors
``per_events_i[8:7]``. In CORE-V-MCU, this output is connected to the otherwise
unused ``s_fc_hp_events`` signal, so the direct notification path is not implemented.
- FIFO-based event notification: Unmasked events are accumulated in the FC FIFO,
and ``event_fifo_valid_o`` raises CPU interrupt 11. This path includes events 7 and 8.

Whenever a valid event is present for the FC channel, it is pushed onto the FC FIFO.
The FC FIFO is a 4-entry queue that holds events until the CPU acknowledges interrupt 11.
When an event is available in the FC FIFO, the APB event controller asserts
``event_fifo_valid_o``, which drives CPU interrupt 11.
When the CPU accepts interrupt 11, it acknowledges the interrupt by asserting
``core_irq_ack_i`` with ``core_irq_ack_id_i`` set to 11.
The event controller then copies the event ID at the head of the FIFO into the FIFO CSR
and pops that entry.
Software can read the captured event ID from the FIFO CSR in the interrupt service routine.
The ``event_fifo_valid_o`` signal is deasserted once the FC FIFO is empty.

- **CL Channel (Cluster / eFPGA):**

Expand Down Expand Up @@ -381,10 +389,10 @@ Push Operation

Pop Operation
^^^^^^^^^^^^^
- The FIFO valid signal ``event_fifo_valid_o`` is asserted when there is at least one event in the FIFO, indicating that the Fabric Controller can read the event.
- The events in the FIFO are exposed to the Fabric Controller through the FIFO CSR.
- The Fabric Controller must first acknowledge the interrupt by asserting ``core_irq_ack_i = 1`` and setting ``core_irq_ack_id_i = 11``. This signals readiness to process the interrupt.
- Once the acknowledgment is received, the event on the top of the FIFO is placed on the FIFO CSR and popped from the FIFO.
- The FIFO valid signal ``event_fifo_valid_o`` is asserted when there is at least one event in the FIFO, raising CPU interrupt 11.
- The CPU acknowledges the interrupt by asserting ``core_irq_ack_i = 1`` and setting ``core_irq_ack_id_i = 11``.
- Once the acknowledgment is received, the event at the head of the FIFO is copied to the FIFO CSR and popped from the FIFO.
- Software reads the captured event ID from the FIFO CSR in the interrupt service routine.
- If the FIFO was previously full, deassertion of ``grant_o`` prevents new events from being written. After the event is acknowledged and popped, space becomes available, and ``grant_o`` is asserted again.
- The ``event_fifo_valid_o`` signal is deasserted when the FIFO becomes empty, indicating there are no more events to read.

Expand Down Expand Up @@ -1104,7 +1112,11 @@ Peripheral Event Interface

Fabric Controller Event Interface
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- fc_events_o[1:0]: Fabric control event output, directly connected to per_events_i[8:7] (Not connected in current implementation).
- fc_events_o[1:0]: Direct event output that mirrors ``per_events_i[8:7]``
without applying the FC masks or adding an event ID to the FIFO. It is connected
to the unused ``s_fc_hp_events`` signal and does not drive a CPU interrupt in
CORE-V-MCU. Events 7 and 8 remain available through the FIFO-based IRQ 11 path
when their FC mask bits are cleared.
- core_irq_ack_id_i[4:0]: Core interrupt acknowledge ID input; provided by the Fabric Controller
- core_irq_ack_i: Core interrupt acknowledge input; provided by the Fabric Controller
- event_fifo_valid_o: Event FIFO valid output, indicating the presence of an event in the FIFO; connected to Fabric Controller
Expand Down
12 changes: 12 additions & 0 deletions tb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ three execution modes:
- Execute preloaded programs on flash
- Load no program and wait for OpenOCD to connect

## APB event controller regression

The self-checking `soc_event_generator_tb` regression verifies the FC mask,
FIFO event ID, CPU interrupt 11 acknowledgment, and simultaneous-event behavior
for events 7 and 8. Run it from the repository root with:

```
fusesoc --cores-root . run --target=event-generator-test --setup --build --run openhwgroup.org:systems:core-v-mcu
```

The simulation prints `TEST_PASS` and exits successfully when all checks pass.

## JTAG TAPs and Flash
When running tests or developing programs, we normally use the first mode to do
that. No special configuration is required to do that, just follow the PULP-SDK
Expand Down
Loading
Loading