【1】仿真器是怎么实现cpu的访存的(gem5代码阅读)

博客围绕gem5展开,介绍了可选用的CPU和存储系统模型,作者选用TimingSimple CPU模型模拟CPU访存机制。模拟了cpu+memory系统,作者想探究gem5如何模拟CPU到内存的访问,并查看了simulate.cc的代码。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

gem5中可以用的cpu模型和存储系统模型有很多种,我选择的cpu模型是TimingSimple CPU模型,它主要是模拟cpu的访存机制,cpu发出访存指令,cpu暂停直到接收到存储系统的响应
我模拟的一个系统是cpu+memory的系统,下图为系统配置图
在这里插入图片描述
所以我想gem5是怎么模拟cpu到memory的访问的,我先看了simulate.cc的代码
`//! Mutex for handling async events.
std::mutex asyncEventMutex;

//! Global barrier for synchronizing threads entering/exiting the
//! simulation loop.
Barrier *threadBarrier;

//! forward declaration
Event *doSimLoop(EventQueue *);

/**

  • The main function for all subordinate threads (i.e., all threads
  • other than the main thread). These threads start by waiting on
  • threadBarrier. Once all threads have arrived at threadBarrier,
  • they enter the simulation loop concurrently. When they exit the
  • loop, they return to waiting on threadBarrier. This process is
  • repeated until the simulation terminates.
    */
    static void
    thread_loop(EventQueue *queue)
    {
    while (true) {
    threadBarrier->wait();
    doSimLoop(queue);
    }
    }`
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值