Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLIC handlers array #363

Merged
merged 14 commits into from
Aug 23, 2023
Merged

PLIC handlers array #363

merged 14 commits into from
Aug 23, 2023

Conversation

JuanSapriza
Copy link
Contributor

@JuanSapriza JuanSapriza commented Aug 7, 2023

Introduction

To allow for easier extension of X-HEEP (without the need of modifying the PLIC HAL), we have decided to migrate the pre-defined handlers into an array of handlers that can then be filled externally.

During the initialization of the PLIC (through the plic_Init() function the array is filled with

  • The fixed handlers of the peripherals that are connected to x-HEEP (e.g. UART, SPI)
  • a Dummy handler in any other case.

Changes

This change required several minor changes:

  • The plic_get_irq_src_type function was adapted to fill the handlers array. Now its called plic_reset_handlers_list.
  • The i2s HAL was updated to include a weak implementation of the handler, which only existed in the example before.
  • The same logic that was implemented in the PLIC was also implemented for the GPIO so:
    • When there is a GPIO interrupt, no matter the ID, the PLIC will call the GPIO handler, passing the ID.
    • The GPIO handler will call a handler stored in the position of the ID relative to the first GPIO ID
    • These functions can be assigned from the application

Tests

  • The example_dma and example_i2s where tested on FPGA and worked. These are the only two HALs that include a handler right now.
  • The example_gpio_intr was tested on FPGA flash_load and flash_exec and worked. It implements two interrupts, with two different handlers.
  • All apps were simulated in verilator and worked as expected.

⚠️ Important

  • The GPIO handler list depends on the fact that all GPIOs have consecutive IDs
  • The I2c implementation of the interrupt in i2c HAL refactor #265 need to be fixed (the substantiation of the first index moved to the I2C side)
  • The future sys_init() function that will be developed by @JoseCalero will need to include gpio_reset_all, as there is no gpio_init. If that function is not called, then gpio_reset_handlers_list needs to be called.

Future work

Some further changes might be needed

  • Many of the previous irq handlers where never overridden by the peripherals. They should be created.
  • Right now its only possible to assign new handlers to the external interrupts, but maybe its a good idea to expand this possibility to, for instance, the gpios.
  • Documentation
  • Discussion with @StefanoAlbini96

@JuanSapriza
Copy link
Contributor Author

The last changes were performed and the documentation in the first comment was updated.
@StefanoAlbini96 @JoseCalero

@JuanSapriza JuanSapriza marked this pull request as ready for review August 8, 2023 12:54
@JoseCalero
Copy link
Collaborator

i modified some minor things, but i still need to modify some other small things in here and I will merge it tomorrow

.gitignore Outdated Show resolved Hide resolved
@JoseCalero JoseCalero merged commit c1ebe34 into esl-epfl:main Aug 23, 2023
@JuanSapriza JuanSapriza deleted the pr_plic_array branch August 28, 2023 10:21
JuanSapriza added a commit to JuanSapriza/HEEPsilon that referenced this pull request Oct 24, 2023
Update code from upstream repository https://github.com/esl-
epfl/x-heep.git to revision df569a88fc7eaa447645262f0d3a76dd22c519f7

* enable mcycle in matadd examples (esl-epfl/x-heep#413) (Davide
  Schiavone)
* reduce FPGA frequencz to 15MHz to accomodate FPU (esl-
  epfl/x-heep#404) (Davide Schiavone)
* fix cv32e4  verilator waivers (esl-epfl/x-heep#402) (Davide
  Schiavone)
* fix GPIO HAL by adding selection of GPIO domain (esl-
  epfl/x-heep#385) (Davide Schiavone)
* update vendor fpu_ss (esl-epfl/x-heep#397) (Davide Schiavone)
* fix cv32e40px fpga (esl-epfl/x-heep#396) (Davide Schiavone)
* add fpu over cv-x-if in tb (esl-epfl/x-heep#392) (Davide Schiavone)
* SEGGER Embedded Studio support for X-HEEP (esl-epfl/x-heep#370)
  (jmiranda)
* Squashed commit of the following: (jmiranda)
* Always use `MCU_CFG` variable in `Makefile` (esl-epfl/x-heep#391)
  (Michele Caon)
* update cv32e40p (esl-epfl/x-heep#389) (Davide Schiavone)
* update cv32e40px (esl-epfl/x-heep#388) (Davide Schiavone)
* use jtag i/o from harness when not using jtag dpi (esl-
  epfl/x-heep#379) (Davide Schiavone)
* Fix esl-epfl/x-heep#336 (esl-epfl/x-heep#364) (JuanSapriza)
* add minimal configuration for mcu-gen (esl-epfl/x-heep#378) (Davide
  Schiavone)
* PLIC handlers array (esl-epfl/x-heep#363) (JuanSapriza)
* Update README.md (jmiranda)
* Choose linker compiler and sim/nosim in test_all.sh (esl-
  epfl/x-heep#359) (JuanSapriza)
* Modified the two target header files so that they add a define with
  a value. That is then used to modify the PRINTF logic in all apps
  (esl-epfl/x-heep#361) (JuanSapriza)
* add obi fifo stage to/from peripherals (esl-epfl/x-heep#200) (Davide
  Schiavone)
* added support for clock-gating external subsystems (esl-
  epfl/x-heep#354) (Simone Machetti)
* Improved the comments on the eXtendingHEEP readme (esl-
  epfl/x-heep#360) (JuanSapriza)
* Modified the way of realizing if an app is external or not
  (JuanSapriza)
* add script to simulate all apps (esl-epfl/x-heep#341) (JuanSapriza)
* [app] fix APPs on flash_exec (esl-epfl/x-heep#357) (Davide
  Schiavone)
* adding attributes and mux pad parameters in mcu-gen (esl-
  epfl/x-heep#349) (Davide Schiavone)
* change signal names in power manager to reflex polarity (esl-
  epfl/x-heep#352) (Simone Machetti)
* fix power gating core app (esl-epfl/x-heep#355) (Davide Schiavone)
* add cv32e40px (esl-epfl/x-heep#353) (Davide Schiavone)
* moved fpnew in its own directory (esl-epfl/x-heep#351) (Davide
  Schiavone)
* update cv32e40p divider (esl-epfl/x-heep#350) (Davide Schiavone)
* fix external pad gen (esl-epfl/x-heep#346) (Davide Schiavone)
* fix mcu-gen (esl-epfl/x-heep#345) (Davide Schiavone)
* update GPIO driver (esl-epfl/x-heep#246) (Hossein Taji)
* fix interleaved bus (esl-epfl/x-heep#340) (Daniel Vázquez)
* fix esl-epfl/x-heep#338 (esl-epfl/x-heep#339) (Davide Schiavone)
* Initialized variables to 0 inside functions. Removed printf comments
  (esl-epfl/x-heep#334) (JuanSapriza)
* made the dma_is_ready() function non-optimizable at all. (esl-
  epfl/x-heep#333) (JuanSapriza)
* fix SPI apps (esl-epfl/x-heep#327) (Davide Schiavone)
* Include x-heep.h to all apps that need it (esl-epfl/x-heep#329)
  (JuanSapriza)
* Added soc_ctrl-reg_top warning to waiver (esl-epfl/x-heep#326)
  (JuanSapriza)
* fix several applications (esl-epfl/x-heep#325) (Davide Schiavone)
* Tries to use cmake3. If that is not available, go ahead with cmake
  (esl-epfl/x-heep#323) (JuanSapriza)
* Improve the timing of cv32e40x by removing the debug triggers (esl-
  epfl/x-heep#324) (David Mallasén Quintana)
* refactoring of examples (esl-epfl/x-heep#322) (JuanSapriza)
* expose internal master ports to external devices (esl-
  epfl/x-heep#268) (Michele Caon)

Signed-off-by: Juan Sapriza <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants