iT邦幫忙

2026 iThome 鐵人賽

DAY 11
0
Software Development

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

In Order CPU Model Stages in SystemC

  • 分享至 

  • xImage
  •  

從上層拆解每個 stage 的實作內容
基本上就是先從 controls 取得狀態,再由這個狀態去更新這個 tick 的行為
cycle 之間做哪些事情就是從 controls 做判斷
跟 rtl 由 control 驅動每個 pipeline 的行為很類似

riscv_emulator/src/rv32im_cpu.cpp:

429 void Rv32imCpu::tick() {
  1     if (reset.read()) *pipeline_ = Pipeline{};
  2     else {
  3         const auto controls = pipeline_->controls(false);
  4         pipeline_->advance(controls, imem_req_ready.read(), imem_rsp_valid.read(),
  5                            imem_rsp_data.read().to_uint(), imem_rsp_status.read().to_uint());
  6     }
  7     state_changed_.notify(sc_core::SC_ZERO_TIME);
  8 }

把兩邊的實座看過,發現 rtl 端的測試連每個 cycle 的比較都有
真棒


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

尚未有邦友留言

立即登入留言