gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Adding a delay of certain ticks in gem5

JS
John Smith
Thu, Jul 6, 2023 3:12 PM

Greetings,
If I want to, for example, add a delay of 100 ticks before a line of code
executes in the function handleTimingReqMiss() in cache.cc, how do I go
about doing that?

--
Regards,
John Smith

Greetings, If I want to, for example, add a delay of 100 ticks before a line of code executes in the function handleTimingReqMiss() in cache.cc, how do I go about doing that? -- Regards, John Smith
JS
John Smith
Thu, Jul 6, 2023 4:48 PM

I've looked into the schedule() function which is used to schedule events.
But can this function be used to simulate delays?

On Thu, Jul 6, 2023 at 11:12 AM John Smith johnsmith20013500@gmail.com
wrote:

Greetings,
If I want to, for example, add a delay of 100 ticks before a line of code
executes in the function handleTimingReqMiss() in cache.cc, how do I go
about doing that?

--
Regards,
John Smith

I've looked into the schedule() function which is used to schedule events. But can this function be used to simulate delays? On Thu, Jul 6, 2023 at 11:12 AM John Smith <johnsmith20013500@gmail.com> wrote: > Greetings, > If I want to, for example, add a delay of 100 ticks before a line of code > executes in the function handleTimingReqMiss() in cache.cc, how do I go > about doing that? > > -- > Regards, > John Smith >
EM
Eliot Moss
Thu, Jul 6, 2023 4:49 PM

On 7/6/2023 11:12 AM, John Smith via gem5-users wrote:

Greetings,
If I want to, for example, add a delay of 100 ticks before a line of code executes in the function
handleTimingReqMiss() in cache.cc, how do I go about doing that?

Generally speaking, you'll have to schedule an event and then do the
rest of the work in the event handler - something like that.  You can't
just suspend code in the middle.  You'll probably need to break things
into two functions to accomplish this.

EM

On 7/6/2023 11:12 AM, John Smith via gem5-users wrote: > Greetings, > If I want to, for example, add a delay of 100 ticks before a line of code executes in the function > handleTimingReqMiss() in cache.cc, how do I go about doing that? Generally speaking, you'll have to schedule an event and then do the rest of the work in the event handler - something like that. You can't just suspend code in the middle. You'll probably need to break things into two functions to accomplish this. EM
EM
Eliot Moss
Thu, Jul 6, 2023 4:56 PM

On 7/6/2023 12:48 PM, John Smith via gem5-users wrote:

I've looked into the schedule() function which is used to schedule events. But can this function be
used to simulate delays?

Not by itself.  You schedule an event at something like curTick() + 100.
When the event happens, a function gets called.  So, the last step you
do before your wait is to schedule the event.  The event handler is a
new function that does the rest of the steps.  And any state you'll need
will need to be available, etc.

I guess my point is that it's doable, but non-trivial.  You can't just
pause the gem5 code and pick it up again - it's an event driven system.

EM

On 7/6/2023 12:48 PM, John Smith via gem5-users wrote: > I've looked into the schedule() function which is used to schedule events. But can this function be > used to simulate delays? Not by itself. You schedule an event at something like curTick() + 100. When the event happens, a function gets called. So, the last step you do before your wait is to schedule the event. The event handler is a new function that does the rest of the steps. And any state you'll need will need to be available, etc. I guess my point is that it's doable, but non-trivial. You can't just pause the gem5 code and pick it up again - it's an event driven system. EM
JL
Jason Lowe-Power
Thu, Jul 6, 2023 4:56 PM

Hi John,

The following may be helpful:

https://gem5bootcamp.github.io/gem5-bootcamp-env/modules/developing%20gem5%20models/events/
https://www.youtube.com/watch?v=OcXA1D4b1RA&t=3868s

Cheers,
Jason

On Thu, Jul 6, 2023 at 9:53 AM Eliot Moss via gem5-users <
gem5-users@gem5.org> wrote:

On 7/6/2023 11:12 AM, John Smith via gem5-users wrote:

Greetings,
If I want to, for example, add a delay of 100 ticks before a line of

code executes in the function

handleTimingReqMiss() in cache.cc, how do I go about doing that?

Generally speaking, you'll have to schedule an event and then do the
rest of the work in the event handler - something like that.  You can't
just suspend code in the middle.  You'll probably need to break things
into two functions to accomplish this.

EM


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

Hi John, The following may be helpful: https://gem5bootcamp.github.io/gem5-bootcamp-env/modules/developing%20gem5%20models/events/ https://www.youtube.com/watch?v=OcXA1D4b1RA&t=3868s Cheers, Jason On Thu, Jul 6, 2023 at 9:53 AM Eliot Moss via gem5-users < gem5-users@gem5.org> wrote: > On 7/6/2023 11:12 AM, John Smith via gem5-users wrote: > > Greetings, > > If I want to, for example, add a delay of 100 ticks before a line of > code executes in the function > > handleTimingReqMiss() in cache.cc, how do I go about doing that? > > Generally speaking, you'll have to schedule an event and then do the > rest of the work in the event handler - something like that. You can't > just suspend code in the middle. You'll probably need to break things > into two functions to accomplish this. > > EM > _______________________________________________ > gem5-users mailing list -- gem5-users@gem5.org > To unsubscribe send an email to gem5-users-leave@gem5.org >
JS
John Smith
Thu, Jul 6, 2023 6:53 PM

Okay, I understood. Thanks.

On Thu, Jul 6, 2023 at 12:57 PM Jason Lowe-Power jason@lowepower.com
wrote:

Hi John,

The following may be helpful:

https://gem5bootcamp.github.io/gem5-bootcamp-env/modules/developing%20gem5%20models/events/
https://www.youtube.com/watch?v=OcXA1D4b1RA&t=3868s

Cheers,
Jason

On Thu, Jul 6, 2023 at 9:53 AM Eliot Moss via gem5-users <
gem5-users@gem5.org> wrote:

On 7/6/2023 11:12 AM, John Smith via gem5-users wrote:

Greetings,
If I want to, for example, add a delay of 100 ticks before a line of

code executes in the function

handleTimingReqMiss() in cache.cc, how do I go about doing that?

Generally speaking, you'll have to schedule an event and then do the
rest of the work in the event handler - something like that.  You can't
just suspend code in the middle.  You'll probably need to break things
into two functions to accomplish this.

EM


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

Okay, I understood. Thanks. On Thu, Jul 6, 2023 at 12:57 PM Jason Lowe-Power <jason@lowepower.com> wrote: > Hi John, > > The following may be helpful: > > > https://gem5bootcamp.github.io/gem5-bootcamp-env/modules/developing%20gem5%20models/events/ > https://www.youtube.com/watch?v=OcXA1D4b1RA&t=3868s > > Cheers, > Jason > > On Thu, Jul 6, 2023 at 9:53 AM Eliot Moss via gem5-users < > gem5-users@gem5.org> wrote: > >> On 7/6/2023 11:12 AM, John Smith via gem5-users wrote: >> > Greetings, >> > If I want to, for example, add a delay of 100 ticks before a line of >> code executes in the function >> > handleTimingReqMiss() in cache.cc, how do I go about doing that? >> >> Generally speaking, you'll have to schedule an event and then do the >> rest of the work in the event handler - something like that. You can't >> just suspend code in the middle. You'll probably need to break things >> into two functions to accomplish this. >> >> EM >> _______________________________________________ >> gem5-users mailing list -- gem5-users@gem5.org >> To unsubscribe send an email to gem5-users-leave@gem5.org >> >