• 中国计算机学会会刊
  • 中国科技核心期刊
  • 中文核心期刊

计算机工程与科学 ›› 2025, Vol. 47 ›› Issue (5): 787-796.

• 高性能计算 • 上一篇    下一篇

用于低间隔加速部件控制的多线程无中断RISC-V处理器

张伟伟,陈虎   

  1. (华南理工大学软件学院,广东 广州 510006)

  • 收稿日期:2024-10-01 修回日期:2024-11-01 出版日期:2025-05-25 发布日期:2025-05-27

A multi-threaded interrupt-free RISC-V processor for low-latency acceleration component control

ZHANG Weiwei,CHEN Hu   

  1. (School of Software Engineering,South China University of Technology,Guangzhou 510006,China)
  • Received:2024-10-01 Revised:2024-11-01 Online:2025-05-25 Published:2025-05-27

摘要: 为满足控制低间隔加速部件的需求,提出了一种多线程无中断的RV32I微处理器(MIRV)结构和相关软件系统。MIRV采用六级流水线单发射顺序执行结构,结合数据重定向技术解决了线程内指令间的大部分数据冲突问题。硬件支持4个线程的寄存器组和程序计数器,采用粗粒度线程调度机制,能够在线程内数据冲突和控制冲突无法解决时实现零时间开销的线程切换。还提出了硬件与软件统一的信号机制,利用特定CSR寄存器实现线程对外部加速部件信号的等待和快速唤醒,通过软件信号处理实现多线程同步与互斥。MIRV综合后包含1 811个LUT,主频为210 MHz。与PicoRV32和DarkRISCV相比,MIRV主频较高且拥有较为优秀的性能。在MK7160FA开发板上使用C语言实现了基于生产者-消费者模型的流水灯控制测试案例,在该实验中,从硬件定时器发出信号到软件产生外部LED的控制信号仅需要10个时钟周期,验证了MIRV对外部硬件事件信号的低延迟响应能力。MIRV具备较低的硬件资源占用量、优异的性能和高级语言编程能力,可作为多种低间隔加速部件的控制器。

关键词: 低间隔, 多线程, 无中断支持, RISC-V, 微控制器

Abstract: To meet the demand for controlling low-latency acceleration components, this paper proposes a multi-threaded interrupt-free RV32I microprocessor (MIRV) architecture and its associated software system. MIRV adopts a six-stage pipeline, single-issue in-order execution structure, utilizing data forwarding techniques to resolve most intra-thread data hazards. The hardware supports four-thread register files and program counters, employing a coarse-grained thread scheduling mechanism that enables zero-overhead thread switching when intra-thread data or control hazards cannot be resolved. Additionally, this paper introduces a hardware-software unified signaling mechanism, leveraging dedicated CSR (Control and Status Register) registers to facilitate thread suspension and rapid wake-up for signals from external acceleration components. Software-based signal handling is implemented to achieve multi-thread synchronization and mutual exclusion. After synthesis, MIRV occupies 1 811 LUTs and achieves a 210 MHz clock frequency. Compared to PicoRV32 and DarkRISCV, MIRV demonstrates higher ope- rating frequency and superior performance. We implemented a producer-consumer-based LED chaser control test case in C on the MK7160FA development board. In this experiment, the latency from hardware timer signal generation to software-driven external LED control signals was only 10 clock cycles, validating MIRV’s low-latency response capability to external hardware events. With low hardware resource consumption, high performance, and high-level language programmability, MIRV is well-suited as a controller for various low-latency acceleration components.

Key words: low-latency, multi-threading, interrupt-free support, RISC-V, microcontroller