iew_impl.hh (9427:ddf45c1d54d4) iew_impl.hh (9444:ab47fe7f03f0)
1/*
1/*
2 * Copyright (c) 2010-2011 ARM Limited
2 * Copyright (c) 2010-2012 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 38 unchanged lines hidden (view full) ---

49#include "arch/utility.hh"
50#include "config/the_isa.hh"
51#include "cpu/checker/cpu.hh"
52#include "cpu/o3/fu_pool.hh"
53#include "cpu/o3/iew.hh"
54#include "cpu/timebuf.hh"
55#include "debug/Activity.hh"
56#include "debug/Decode.hh"
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 38 unchanged lines hidden (view full) ---

49#include "arch/utility.hh"
50#include "config/the_isa.hh"
51#include "cpu/checker/cpu.hh"
52#include "cpu/o3/fu_pool.hh"
53#include "cpu/o3/iew.hh"
54#include "cpu/timebuf.hh"
55#include "debug/Activity.hh"
56#include "debug/Decode.hh"
57#include "debug/Drain.hh"
57#include "debug/IEW.hh"
58#include "params/DerivO3CPU.hh"
59
60using namespace std;
61
62template<class Impl>
63DefaultIEW<Impl>::DefaultIEW(O3CPU *_cpu, DerivO3CPUParams *params)
64 : issueToExecQueue(params->backComSize, params->forwardComSize),
65 cpu(_cpu),
66 instQueue(_cpu, this, params),
67 ldstQueue(_cpu, this, params),
68 fuPool(params->fuPool),
69 commitToIEWDelay(params->commitToIEWDelay),
70 renameToIEWDelay(params->renameToIEWDelay),
71 issueToExecuteDelay(params->issueToExecuteDelay),
72 dispatchWidth(params->dispatchWidth),
73 issueWidth(params->issueWidth),
74 wbOutstanding(0),
75 wbWidth(params->wbWidth),
58#include "debug/IEW.hh"
59#include "params/DerivO3CPU.hh"
60
61using namespace std;
62
63template<class Impl>
64DefaultIEW<Impl>::DefaultIEW(O3CPU *_cpu, DerivO3CPUParams *params)
65 : issueToExecQueue(params->backComSize, params->forwardComSize),
66 cpu(_cpu),
67 instQueue(_cpu, this, params),
68 ldstQueue(_cpu, this, params),
69 fuPool(params->fuPool),
70 commitToIEWDelay(params->commitToIEWDelay),
71 renameToIEWDelay(params->renameToIEWDelay),
72 issueToExecuteDelay(params->issueToExecuteDelay),
73 dispatchWidth(params->dispatchWidth),
74 issueWidth(params->issueWidth),
75 wbOutstanding(0),
76 wbWidth(params->wbWidth),
76 numThreads(params->numThreads),
77 switchedOut(false)
77 numThreads(params->numThreads)
78{
79 _status = Active;
80 exeStatus = Running;
81 wbStatus = Idle;
82
83 // Setup wire to read instructions coming from issue.
84 fromIssue = issueToExecQueue.getWire(-issueToExecuteDelay);
85

--- 269 unchanged lines hidden (view full) ---

355void
356DefaultIEW<Impl>::setScoreboard(Scoreboard *sb_ptr)
357{
358 scoreboard = sb_ptr;
359}
360
361template <class Impl>
362bool
78{
79 _status = Active;
80 exeStatus = Running;
81 wbStatus = Idle;
82
83 // Setup wire to read instructions coming from issue.
84 fromIssue = issueToExecQueue.getWire(-issueToExecuteDelay);
85

--- 269 unchanged lines hidden (view full) ---

355void
356DefaultIEW<Impl>::setScoreboard(Scoreboard *sb_ptr)
357{
358 scoreboard = sb_ptr;
359}
360
361template <class Impl>
362bool
363DefaultIEW<Impl>::drain()
363DefaultIEW<Impl>::isDrained() const
364{
364{
365 // IEW is ready to drain at any time.
366 cpu->signalDrained();
367 return true;
368}
365 bool drained(ldstQueue.isDrained());
369
366
370template <class Impl>
371void
372DefaultIEW<Impl>::resume()
373{
367 for (ThreadID tid = 0; tid < numThreads; tid++) {
368 if (!insts[tid].empty()) {
369 DPRINTF(Drain, "%i: Insts not empty.\n", tid);
370 drained = false;
371 }
372 if (!skidBuffer[tid].empty()) {
373 DPRINTF(Drain, "%i: Skid buffer not empty.\n", tid);
374 drained = false;
375 }
376 }
377
378 return drained;
374}
375
376template <class Impl>
377void
379}
380
381template <class Impl>
382void
378DefaultIEW<Impl>::switchOut()
383DefaultIEW<Impl>::drainSanityCheck() const
379{
384{
380 // Clear any state.
381 switchedOut = true;
382 assert(insts[0].empty());
383 assert(skidBuffer[0].empty());
385 assert(isDrained());
384
386
385 instQueue.switchOut();
386 ldstQueue.switchOut();
387 fuPool->switchOut();
388
389 for (ThreadID tid = 0; tid < numThreads; tid++) {
390 while (!insts[tid].empty())
391 insts[tid].pop();
392 while (!skidBuffer[tid].empty())
393 skidBuffer[tid].pop();
394 }
387 instQueue.drainSanityCheck();
388 ldstQueue.drainSanityCheck();
389 fuPool->drainSanityCheck();
395}
396
397template <class Impl>
398void
399DefaultIEW<Impl>::takeOverFrom()
400{
401 // Reset all state.
402 _status = Active;
403 exeStatus = Running;
404 wbStatus = Idle;
390}
391
392template <class Impl>
393void
394DefaultIEW<Impl>::takeOverFrom()
395{
396 // Reset all state.
397 _status = Active;
398 exeStatus = Running;
399 wbStatus = Idle;
405 switchedOut = false;
406
407 instQueue.takeOverFrom();
408 ldstQueue.takeOverFrom();
400
401 instQueue.takeOverFrom();
402 ldstQueue.takeOverFrom();
409 fuPool->takeOver();
403 fuPool->takeOverFrom();
410
411 startupStage();
412 cpu->activityThisCycle();
413
414 for (ThreadID tid = 0; tid < numThreads; tid++) {
415 dispatchStatus[tid] = Running;
416 stalls[tid].commit = false;
417 fetchRedirect[tid] = false;

--- 1253 unchanged lines hidden ---
404
405 startupStage();
406 cpu->activityThisCycle();
407
408 for (ThreadID tid = 0; tid < numThreads; tid++) {
409 dispatchStatus[tid] = Running;
410 stalls[tid].commit = false;
411 fetchRedirect[tid] = false;

--- 1253 unchanged lines hidden ---