PoC: create a syscall by forcing the next CPU instruction #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR implements a PoC for a syscall, trap function.
The FW can write a jump instruction (with a target address) into an ADDR_SYSCALL_INSTR API address in tk1. The device app (and FW) can write to ADDR_SYSCALL_START API address in tk1. When written to the CPU will be forced to use the jump address in ADDR_SYSCALL_INSTR as next instruction to execute.
This could, may work. One issue may be timing (as in clock cycles). The ADDR_SYSCALL_START trigger must be set at the right cycle in relation to the CPU reading the next instruction. If it's one cycle too early or too late it will probably crash.
One could also simply force the CPU to use another address (not a specific instruction). But at least during PoC hack, trying to do so made the synthesis tool Yosys to allocate a design 180% of the available resources.
Fixes # (issues)
None
Type of change
Feature PoC
Please tick any that are relevant to this PR and remove any that aren't.
Submission checklist