gem5-users@gem5.org

The gem5 Users mailing list

View all threads

stopping simulation via ThreadContext::halt()

DB
David Bears
Wed, Jul 26, 2023 4:36 PM

Hello,

I am trying to create a fault which will stop the simulation. I tried
calling ThreadContext::halt from within FaultBase::invoke (or rather a
subclass of FaultBase). This successfully stops simulation of the CPU,
but then it endlessly simulates memory refreshes.

So how should I properly shut down the simulated system so that the
gem5.opt process finishes? Do I have to do something in addition to
calling ThreadContext::halt? Is ThreadContext::halt the wrong tool for
the job? Or perhaps do I have something else set up wrong?

For context, I implemented most of the NIOS II ISA in gem5, and I am
running an executable which is designed to run on bare metal. There is a
particular 'magic' instruction which signals that the executable is
finished, and I want to stop the simulation sometime after committing
such an instruction.

Thanks is advance,
David

Hello, I am trying to create a fault which will stop the simulation. I tried calling ThreadContext::halt from within FaultBase::invoke (or rather a subclass of FaultBase). This successfully stops simulation of the CPU, but then it endlessly simulates memory refreshes. So how should I properly shut down the simulated system so that the gem5.opt process finishes? Do I have to do something in addition to calling ThreadContext::halt? Is ThreadContext::halt the wrong tool for the job? Or perhaps do I have something else set up wrong? For context, I implemented most of the NIOS II ISA in gem5, and I am running an executable which is designed to run on bare metal. There is a particular 'magic' instruction which signals that the executable is finished, and I want to stop the simulation sometime after committing such an instruction. Thanks is advance, David
JL
Jason Lowe-Power
Thu, Jul 27, 2023 3:07 PM

Hi David,

I think you want to call the function exitSimLoopNow or exitSimLoop.
You can call this function from an instruction implementation, (e.g.,
halt), I believe.

See https://github.com/search?q=repo%3Agem5%2Fgem5+exitSimLoop+&type=code

Cheers,
Jason

On Wed, Jul 26, 2023 at 9:39 AM David Bears via gem5-users <
gem5-users@gem5.org> wrote:

Hello,

I am trying to create a fault which will stop the simulation. I tried
calling ThreadContext::halt from within FaultBase::invoke (or rather a
subclass of FaultBase). This successfully stops simulation of the CPU,
but then it endlessly simulates memory refreshes.

So how should I properly shut down the simulated system so that the
gem5.opt process finishes? Do I have to do something in addition to
calling ThreadContext::halt? Is ThreadContext::halt the wrong tool for
the job? Or perhaps do I have something else set up wrong?

For context, I implemented most of the NIOS II ISA in gem5, and I am
running an executable which is designed to run on bare metal. There is a
particular 'magic' instruction which signals that the executable is
finished, and I want to stop the simulation sometime after committing
such an instruction.

Thanks is advance,
David


gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-leave@gem5.org

Hi David, I think you want to call the function `exitSimLoopNow` or `exitSimLoop`. You can call this function from an instruction implementation, (e.g., halt), I believe. See https://github.com/search?q=repo%3Agem5%2Fgem5+exitSimLoop+&type=code Cheers, Jason On Wed, Jul 26, 2023 at 9:39 AM David Bears via gem5-users < gem5-users@gem5.org> wrote: > Hello, > > I am trying to create a fault which will stop the simulation. I tried > calling ThreadContext::halt from within FaultBase::invoke (or rather a > subclass of FaultBase). This successfully stops simulation of the CPU, > but then it endlessly simulates memory refreshes. > > So how should I properly shut down the simulated system so that the > gem5.opt process finishes? Do I have to do something in addition to > calling ThreadContext::halt? Is ThreadContext::halt the wrong tool for > the job? Or perhaps do I have something else set up wrong? > > For context, I implemented most of the NIOS II ISA in gem5, and I am > running an executable which is designed to run on bare metal. There is a > particular 'magic' instruction which signals that the executable is > finished, and I want to stop the simulation sometime after committing > such an instruction. > > Thanks is advance, > David > > _______________________________________________ > gem5-users mailing list -- gem5-users@gem5.org > To unsubscribe send an email to gem5-users-leave@gem5.org >