Hi Dr. Bruce,

Thanks a lot for the reply.

Setting the variable this way works, but only if I set it before the simulation 
starts completely. I looked at the source code and it seems 
max_insts_any_thread is only used to schedule an exit event in the 
BaseCPU::init() function. I’m guessing this is only called once at the very 
beginning. Is there a way to set the max instruction count when the simulation 
has exited (e.g., due to an m5 exit instruction) so that it runs for n 
instructions after this point?

Best regards,
Hossam

From: Bobby Bruce <bbr...@ucdavis.edu>
Sent: Thursday, September 15, 2022 2:43 PM
To: The gem5 Users mailing list <gem5-users@gem5.org>
Subject: [gem5-users] Re: Set max number of instructions to simulate using 
Board+Simulator API

Hey Hossam,

A better API for setting max number of instructions via the Simulator module 
will be coming in v22.1, but in the meantime you can do something like:

```
processor.get_cores()[0].get_simobject().max_insts_any_thread = <max insts>
```

With the above, the simulation will exit when any thread on the first core 
reaches the max number of threads.

--
Dr. Bobby R. Bruce
Room 3050,
Kemper Hall, UC Davis
Davis,
CA, 95616

web: https://www.bobbybruce.net


On Thu, Sep 15, 2022 at 9:31 AM Hossam ElAtali 
<hossam.elat...@uwaterloo.ca<mailto:hossam.elat...@uwaterloo.ca>> wrote:
>
> Hi everyone,
>
>
>
> I know how to set the max number of instructions using the fs.py scripts. 
> Setting “maxinsts” causes the cpus’ max_insts_any_thread variable to be set. 
> However, I’m currently using the board and Simulator style of creating the 
> run scripts so these variables aren’t exposed in the processor object I give 
> to the board. I’ve been going around the code base and trying out different 
> ways to set max_insts_any_thread but I always end up with “ … has no 
> parameter max_insts_any_thread”. Any ideas? Thank you.
>
>
>
> Best regards,
>
> Hossam
>
>
>
> _______________________________________________
> gem5-users mailing list -- gem5-users@gem5.org<mailto:gem5-users@gem5.org>
> To unsubscribe send an email to 
> gem5-users-le...@gem5.org<mailto:gem5-users-le...@gem5.org>
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to