diff options
author | Gabe Black <gabeblack@google.com> | 2019-10-13 22:54:11 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2019-10-25 22:42:31 +0000 |
commit | fd030fd9f5893e1ce198bf760ab4a7f2704d921b (patch) | |
tree | 066536de5ae0448f78e101d0aecb7745c422ae9b /src/cpu/thread_context.cc | |
parent | c73c19effd8f7f9b6e2ec470f04b8f1f43ce7354 (diff) | |
download | gem5-fd030fd9f5893e1ce198bf760ab4a7f2704d921b.tar.xz |
cpu: Delegate comInstEventQueue methods to the ThreadContexts.
These then just use the comInstEventQueue array from the CPU, but soon
they will actually be self contained and allow the thread context to
use whatever mechanism it wants.
Also, now that the thread contexts need to exist before instruction
count based events can be scheduled, setting up max instruction based
events needs to happen in init after the CPU subclasses have had a
chance to set up the threadContexts vector.
Change-Id: I34bb401633d277a60be74e30d5a478a149b972ea
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22108
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/cpu/thread_context.cc')
-rw-r--r-- | src/cpu/thread_context.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/cpu/thread_context.cc b/src/cpu/thread_context.cc index dea39015f..1250a3e4c 100644 --- a/src/cpu/thread_context.cc +++ b/src/cpu/thread_context.cc @@ -55,6 +55,41 @@ #include "params/BaseCPU.hh" #include "sim/full_system.hh" +Tick +ThreadContext::nextInstEventCount() +{ + auto *queue = getCpuPtr()->comInstEventQueue[threadId()]; + return queue->empty() ? MaxTick : queue->nextTick(); +} + +void +ThreadContext::serviceInstCountEvents(Tick count) +{ + auto *queue = getCpuPtr()->comInstEventQueue[threadId()]; + queue->serviceEvents(count); +} + +void +ThreadContext::scheduleInstCountEvent(Event *event, Tick count) +{ + auto *queue = getCpuPtr()->comInstEventQueue[threadId()]; + return queue->schedule(event, count); +} + +void +ThreadContext::descheduleInstCountEvent(Event *event) +{ + auto *queue = getCpuPtr()->comInstEventQueue[threadId()]; + queue->deschedule(event); +} + +Tick +ThreadContext::getCurrentInstCount() +{ + auto *queue = getCpuPtr()->comInstEventQueue[threadId()]; + return queue->getCurTick(); +} + void ThreadContext::compare(ThreadContext *one, ThreadContext *two) { |