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

Multithreaded execution on Spike #15

Open
sberkun opened this issue Jun 8, 2022 · 0 comments
Open

Multithreaded execution on Spike #15

sberkun opened this issue Jun 8, 2022 · 0 comments

Comments

@sberkun
Copy link
Collaborator

sberkun commented Jun 8, 2022

Currently, single-threaded execution on spike works with https://github.com/lf-lang/lingua-franca/tree/baremetal_spike_support and https://github.com/lf-lang/reactor-c/tree/baremetal_spike_support. However, there is no existing support for multi-threaded execution.

Spike can simulate multiple threads with -p flag (i.e. spike --isa=rv32i -p4 demo.riscv), so it would be great if we could take advantage of that.

This will most likely involve modification of the files in the core/spike/common folder, particularly crt.S. Right now, crt.S contains the following lines:

  # get core id
  csrr a0, mhartid
  # for now, assume only 1 core
  li a1, 1
1:bgeu a0, a1, 1b

  # give each core 128KB of stack + TLS
#define STKSHIFT 17
  add sp, a0, 1
  sll sp, sp, STKSHIFT
  add sp, sp, tp
  sll a2, a0, STKSHIFT
  add tp, tp, a2

  j _init

Supporting multiple threads will involve removing the assumption of only 1 core, and then figuring out what to do with the other cores.

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

No branches or pull requests

1 participant