iT邦幫忙

2026 iThome 鐵人賽

DAY 17
0
Software Development

猴子都寫得出來的 RISC-V OoO CPU系列 第 17 篇

Dual Issue In Order CPU Instruction Issue

  • 分享至 

  • xImage
  •  

從昨天的討論衍生出一個新問題
在 single issue 的狀況下,要怎麼展示 dual issue inorder CPU 的行為呢?
.
.
.
.
沒錯,就是把 issue queue 塞滿
例如下面這種 pattern

mul  x3, x1, x2     # long operation
add  x4, x3, x0     # waits for DIV; blocks in-order issue behind it
addi x5, x0, 1      # accumulates in the queue
addi x6, x0, 2      # accumulates in the queue

在這個情況下
我們可以看到前後端分開的好處了
當後端很忙的時候
前端還是一直塞工作進來
直到 queue 滿之後把停下來的訊號傳回 fetch 端

test case:

addi x1,x0,6
addi x2,x0,7
mul  x3,x1,x2
add  x4,x3,x0
addi x5,x0,1
addi x6,x0,2
addi x7,x0,3
addi x8,x0,4

我們從下面的結果可以看到
dual issue 真的會跟預期的一樣一次執行兩道指令
而且有比較快的執行時間 (cycle count)

/workspace/rtl/build/rtl/rtl_single_inorder_tests
5: [PASS] queued ALU work behind multiply [normal] rtl_cycles=65 systemc_cycles=65 retired=8
...
/workspace/rtl/build/rtl/rtl_dual_inorder_tests
6: [PASS] queued ALU work behind multiply [normal] rtl_cycles=63 systemc_cycles=63 retired=8
...
/workspace/rtl/build/rtl/rtl_dual_ooo_tests
7: [PASS] queued ALU work behind multiply [normal] rtl_cycles=63 systemc_cycles=63 retired=8

從下面兩張圖我們也可以很明確地看到

  • Issue queue 的行為
  • dual issue 在 alu[0/1] 和 muldiv 運算單元的行為

queue:
https://ithelp.ithome.com.tw/upload/images/20261001/2014034278i9qqNLfP.png
retire:
https://ithelp.ithome.com.tw/upload/images/20261001/201403427jVVCg1kqr.png

Hint: 裡面的 tag 訊號就是 instruction ID

git link with tag: https://github.com/hsufit/TINY5_OOO/tree/ithome2026_D17


上一篇
CPU Frontend
系列文
猴子都寫得出來的 RISC-V OoO CPU 共 17 篇
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言