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

Update RTE to support easy emulation of instructions #673

Merged
merged 5 commits into from
Aug 18, 2023
Merged

Conversation

stnolting
Copy link
Owner

@stnolting stnolting commented Aug 18, 2023

This PR updates the NEORV32 Runtime Environment (RTE) to support easier emulation of unsupported CPU / SoC features like unimplemented instructions and even unaligned memory accesses.

The RTE now performs a full context backup of the interrupted application by storing all x integer registers to the stack. The base address of this stack frame is copied to the mscratch CSR. Dedicated "context access" function use this CSR value to provide easy access to the application context allowing reading and altering of registers:

// Prototypes
uint32_t neorv32_rte_context_get(int x); // read register x
void     neorv32_rte_context_put(int x, uint32_t data); write data to register x

// Examples
uint32_t tmp = neorv32_rte_context_get(9); // read register 'x9'
neorv32_rte_context_put(28, tmp); // write 'tmp' to register 'x28'

🚀 A demo program is added to sw/example/demo_emulate_unaligned to showcase how to emulate unaligned memory accesses.

@stnolting stnolting added SW Software-related experimental Experimental feature labels Aug 18, 2023
@stnolting stnolting self-assigned this Aug 18, 2023
@stnolting stnolting marked this pull request as ready for review August 18, 2023 13:12
@stnolting stnolting merged commit ec90994 into main Aug 18, 2023
@stnolting stnolting deleted the rte_update branch August 18, 2023 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental Experimental feature SW Software-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant