Skip to content

[Phase 3] Slice 1: XLEN helper abstraction kickoff#21

Draft
renshi-code wants to merge 8 commits into
devfrom
phase-3/xlen-slice1
Draft

[Phase 3] Slice 1: XLEN helper abstraction kickoff#21
renshi-code wants to merge 8 commits into
devfrom
phase-3/xlen-slice1

Conversation

@renshi-code
Copy link
Copy Markdown
Member

Summary

  • kick off Phase 3 with a behavior-preserving XLEN abstraction slice
  • add shared XLEN aliases/utilities in Define.hpp (xlen_t, uxlen_t, shift/sign-extension helpers)
  • route integer shift masking and compressed immediate sign-extension through shared helpers

Validation

  • cmake --build --preset ninja-clang-release
  • ctest --test-dir build/ninja-clang-release --output-on-failure -L gate

Tracking

@renshi-code renshi-code force-pushed the phase-3/xlen-slice1 branch from 1cb642d to c4da61d Compare April 16, 2026 07:48
@renshi-code renshi-code force-pushed the phase-3/xlen-slice1 branch from f193c60 to 04425d6 Compare April 17, 2026 09:52
renshi-code and others added 5 commits April 21, 2026 14:47
- Updated function declarations and definitions across multiple files to use trailing return types for better clarity and consistency.
- Enhanced the handling of UART register decoding in MmioRouter with new functions for byte and word access.
- Improved the page walk logic in MemorySubsystem to simplify fault detection.
- Consolidated repetitive code in CPU stages (EX, MEM, WB) by using auto for type inference.
- Added logging for unhandled MMIO operations in MmioRouter.
- Cleaned up the instruction decoding logic in Module to enhance maintainability.
- Improved code readability by adding missing braces for single-line if statements across various stages (e.g., StageCommit, StageEX, StageIF).
- Standardized the use of `0u` and `0U` for unsigned integer literals for consistency.
- Changed variable declarations to use `const` where applicable to enhance code safety and clarity.
- Updated function signatures to use `const` where methods do not modify class state (e.g., `get_mstatus`, `read_csr`).
- Enhanced memory access logic in `MemorySubsystem` to ensure better handling of page faults and address translation.
- Cleaned up the handling of pending exceptions and interrupts in the commit and execution stages.
- Improved the handling of floating-point operations and memory accesses in the memory stage.
- Ensured consistent formatting and spacing throughout the code for better maintainability.
- Introduced `VirtioUtil.hpp` with utility functions for Virtio MMIO device queue operations, including byte/word conversions and memory operations.
- Refactored `Console.cpp` and `Disk.cpp` to utilize the new utility functions, removing redundant code.
- Updated `XLen.hpp` to change `PrivilegeLevel` from `Word` to `uint8_t` for better memory efficiency.
- Enhanced `build-linux-image.sh` script formatting for improved readability.
- Modified `Machine.cpp` to improve image loading error handling and ensure proper memory allocation.
- Updated various source files to replace direct array indexing with `.at()` for safer access.
- Adjusted exception handling to use `~Word(0)` instead of `~0U` for consistency across the codebase.

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
- Added Mmu.cpp for the implementation of the Memory Management Unit (MMU) supporting SV32 virtual memory translation.
- Implemented address translation, page table walking, and permission validation in the MMU.
- Introduced TileLinkBus.cpp to handle TileLink-style bus communication, including request handling and response management.
- Removed outdated commit and execution stages (StageCommit.cpp, StageEX.cpp, StageID.cpp, StageIF.cpp, StageMEM.cpp, StageWB.cpp) to streamline the pipeline architecture.
- Added trace_symbols.txt for debugging and tracing purposes.
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.

1 participant