iT邦幫忙

2026 iThome 鐵人賽

DAY 12
0
Software Development

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

Co-simulation Between RTL and Reference C-model

  • 分享至 

  • xImage
  •  

本來 cosimulation 類的打算等到最後才補
既然已經有了就先提

在開發的過程中,都會在不同的階段把 rtl 的行為跟 c-model 做比對
從最簡單的以 output memory 比對
到只在 retire 階段 inst by inst 比對
差異就是 debug 的時候要檢查的資訊有多少
跟在軟體開發的時候一樣,越小的測試範圍越容易定位問題

在這邊實作的是比較 aggressive 的 cycle by cycle 比較

流程是 SC_THREAD(run) -> run() 裡面去執行每個 test
start() 負責 init (setup and reset)
接著 check 去對每個 cycle 做 compare
包含每個 decode, retire 等等

  9     void run() {
  8         for (const auto& test : rv32im_test_catalog()) {
  7             for (unsigned mode = 0; mode < 2; ++mode) {
  6                 active_name_ = test.name + (mode == 0 ? " [normal]" : " [stalled]");
  5                 start(test.program, mode == 0 ? InstructionMemory::normal_timing() : InstructionMemory::stalled_timing());
  4                 check(test.program, &test);
  3             }
  2         }

上一篇
In Order CPU Model Stages in SystemC
下一篇
Dual Issue In Order CPU Implementation
系列文
猴子都寫得出來的 RISC-V OoO CPU 共 17 篇
圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言