Analyzing RV32/RV64 Trade-offs for FreeRTOS Latency on 8-Stage RISC-V Soft Processors
Hyunwoo Kang, Geonwoo Yu, Jongwon Kim, Seungwoo You, Minchan Gil
Abstract
Although many commercial RISC-V platforms provide real-time operating system support, practical examples that explain how to enable a preemptive RTOS on a custom bare-metal RISC-V soft processor remain limited, leaving the interaction between processor microarchitecture, interrupt handling, and RTOS context switching difficult to understand from simple hardware implementation examples. This paper presents the design and evaluation of FreeRTOS on custom 8-stage RV32/RV64 RISC-V soft processors with machine-mode CSRs, a CLINT timer, trap and exception control logic, and the required context-switch path. Using this platform, we compare RV32 and RV64 under the same microarchitectural organization and firmware structure using two Rhealstone-derived latency microbenchmarks, task switching and task preemption, measured with the mcycle counter. RV64 requires 36.6% and 17.7% more cycles for task switching and preemption, respectively. Instruction-level analysis attributes this overhead to the doubled RV64 trap frame, wider pointer-based kernel data structures, and 64-bit scheduler priority handling. The RTL, firmware, and benchmark code are released as open source.
Create a lesson
Related papers
Zero-Instruction Sensor Reads: Register-Mapped Peripherals and Hardware PWM on a Five-Stage Soft Processor
Shared title terminology · Nathanael Ren
SEAM-V: A Hybrid-Decoupled RISC-V Vector Processor with Backend-Visible Packet Semantics and Source-Lifetime-Aware Scheduling
Shared title terminology · Weiying Wang, Zhiwei Zhang
Stratum: A Hardware-Software Co-Design Framework for SNN Inference on RISC-V
Shared title terminology · Wajahat Riaz, Muhammad Adeel Pasha, Shahid Masud et al.
ETHEREAL: A 25.6-μs/inf. Low-latency Event-driven Graph-neural-network Processor for High-resolution Vision at the Edge
Shared title terminology · Adrian Kneip, Martin Lefebvre, Daniel Gehrig et al.
CTTE: An Open Dual-Protocol RISC-V Trace Encoder for N-Trace and E-Trace
Shared title terminology · Alexander Weiss, Albert Schulz
FPGA Lifecycle Management for RISC-V Systems
Shared title terminology · Tianhai Liu, James J. Hunt