從昨天的討論衍生出一個新問題
在 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
從下面兩張圖我們也可以很明確地看到
queue:
retire:
Hint: 裡面的 tag 訊號就是 instruction ID
git link with tag: https://github.com/hsufit/TINY5_OOO/tree/ithome2026_D17