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

Ideas about implementing multiple harts #16

Open
Columbus240 opened this issue May 30, 2019 · 1 comment
Open

Ideas about implementing multiple harts #16

Columbus240 opened this issue May 30, 2019 · 1 comment

Comments

@Columbus240
Copy link
Contributor

To specify the behaviour of a risc-v processor with multiple harts, the follwing problems need to be solved.

  • The harts aren’t always in the same state. This requires a restructuring of Spec.RiscvMachine.
  • The harts may support different ISA extensions. (Interpretation of the spec, because the spec doesn’t specify otherwise and misa contains the capabilities of the associated hart.)
  • Deal with the “parallel” execution of the harts. Because Coq has different tools to express requirements than Haskell, I believe it is possible to define a “sane” or “precise” notion of parallel execution in Coq.

I believe, before the first two problems can be tackled, CSRs need to be implemented.

Concerning parallel execution: For Platform.Run to work on a machine with multiple harts, it requires a structure defining the execution order of the harts. This structure consists of a sequence (in the mathematical sense, an infinite list) of hartids and a proof, that for each hartid of the machine, there is a subsequence (in the above sequence) consisting only of the given hartid (a constant sequence).
The Platform.Run would then apply run on the hart with id equal to the first element of the sequence and remove the first element from the sequence.

An implementation of the riscv-v ISA that behaves as if the harts were always run in the same order can be modeled with the above, by packaging the instance of Spec.RiscvMachine with the structure containing the hart ordering.
Proofs about the behaviour of risc-v programs can thus be made either with arbitrary hart ordering or with an arbitrarily restricted hart ordering.

Was my idea about parallel execution understandable and is it reasonable?

@andres-erbsen
Copy link
Contributor

this makes sense overall. I think it should be possible to have run nondeterministically pick a hart without materializing the oracle sequence, though -- bedrock2 uses a similar semantic style, and there the exec.interact rule picks a non-deterministic return values for external calls without any oracle.

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

2 participants