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 RV32 and RV64 architectures #127

Merged
merged 51 commits into from
Jan 18, 2024

Conversation

wysiwyng
Copy link
Contributor

@wysiwyng wysiwyng commented Feb 14, 2023

This adds updates to the RV32 and RV64 architecture models, namely:

  • CoreDSL 2 generated trap entry and supporting ETISS fixes
  • CoreDSL 2 generated semihosting capabilities and supporting ETISS core additions
  • A new RV64IMACFD + Zicsr + Zifencei compatible model that passes all U-Mode and almost all S- and M-Mode instruction tests
  • Generated architecture model code makes better use of ETISS' CodeParts feature, allowing plugins to better insert their own JIT-Code

Interrupt support of these architecture models is currently untested and probably not implemented correctly. Adding interrupt support would be a matter of extending the trap entry function in CoreDSL to handle incoming interrupts, as well as extending ETISS to generate a corresponding call to said trap entry function.

RV64M needs 128 bit arithmetic, this is not supported per se in ETISS, see also #107. This patch uses the GCC __[u]int128_t types for limited support until a better solution is found. Because of this, RV64M only works when using GCC or LLVM as JIT engine, as TCC has no 128-bit arithmetic support.

@wysiwyng wysiwyng marked this pull request as draft March 2, 2023 09:39
@wysiwyng
Copy link
Contributor Author

wysiwyng commented Mar 2, 2023

Converted to draft until interrupt support is ready

@wysiwyng
Copy link
Contributor Author

wysiwyng commented Oct 4, 2023

New updates:

  • Interrupt handling:
    • Fully functional
    • Fully CoreDSL-generated
    • Added InterruptEnable class to query a global interrupt enable flag in ETISS' InterruptHandler plugin
  • CMake:
    • Added code to link architecture plugins against JIT libraries to use functions from those in non-JIT code
  • RV32/64 Architecture plugins:
    • fixed various remaining issues, M/SSTATUS CSRs, floating point instructions
    • riscv-tests related to MMU, CSR and breakpoints fail, all others pass
  • General:
    • Prepare various bits for new MMU integration

@wysiwyng wysiwyng marked this pull request as ready for review October 4, 2023 07:41
ArchImpl/RV32IMACFD/RV32IMACFDArchSpecificImp.cpp Outdated Show resolved Hide resolved
cp.code() = std::string("//EBREAK\n");

// -----------------------------------------------------------------------------
{ // block
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Docu purposes:
Since ebreak now no longer returns etiss::RETURNCODE::CPUFINISHED, what is the proper way to leave the simulation loop besides activating "loop-to-self" flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simulation exit is possible by loop-to-self with enabled detection or by semihosting, see https://github.com/tum-ei-eda/etiss_riscv_examples/

*((RV64IMACFD*)parent_.structure_)->X[gprid_] = (etiss_uint64) val;
}
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing Fields for:

  • CSRs
  • FPU Registers
  • (Vector Registers)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be added later once these can be generated properly by M2-ISA-R

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the needed Fields manually (JoGei@12db114) to test VirtualStruct with this architecture update.

ArchImpl/RV64IMACFD/RV64IMACFDArchSpecificImp.cpp Outdated Show resolved Hide resolved
src/jitlibs/semihost/CMakeLists.txt Outdated Show resolved Hide resolved
src/jitlibs/semihost/CMakeLists.txt Outdated Show resolved Hide resolved
ArchImpl/RV32IMACFD/RV32IMACFDFuncs.c Show resolved Hide resolved
@JoGei
Copy link
Member

JoGei commented Nov 23, 2023

Tested the interrupt handling for edge-triggered peripheral interrupts in the etiss-sc project with your PR branch.
Looks good and works with the fixes mentioned in the review comments above.

@wysiwyng wysiwyng merged commit 11eff82 into tum-ei-eda:master Jan 18, 2024
7 of 9 checks passed
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.

3 participants