std::make_shared<UnimpFault>("Squashed Inst"),
currState->req, currState->tc, currState->mode);
- // delete the current request
- delete currState;
+ // delete the current request if there are no inflight packets.
+ // if there is something in flight, delete when the packets are
+ // received and inflight is zero.
+ if (currState->numInflight() == 0) {
+ delete currState;
+ } else {
+ currState->squash();
+ }
// check the next translation request, if it exists
if (currStates.size())
assert(inflight);
assert(state == Waiting);
inflight--;
+ if (squashed) {
+ // if were were squashed, return true once inflight is zero and
+ // this WalkerState will be freed there.
+ return (inflight == 0);
+ }
if (pkt->isRead()) {
// should not have a pending read it we also had one outstanding
assert(!read);
}
}
+unsigned
+Walker::WalkerState::numInflight() const
+{
+ return inflight;
+}
+
bool
Walker::WalkerState::isRetrying()
{
return started;
}
+void
+Walker::WalkerState::squash()
+{
+ squashed = true;
+}
+
void
Walker::WalkerState::retry()
{
bool timing;
bool retrying;
bool started;
+ bool squashed;
public:
WalkerState(Walker * _walker, BaseTLB::Translation *_translation,
const RequestPtr &_req, bool _isFunctional = false) :
nextState(Ready), inflight(0),
translation(_translation),
functional(_isFunctional), timing(false),
- retrying(false), started(false)
+ retrying(false), started(false), squashed(false)
{
}
void initState(ThreadContext * _tc, BaseTLB::Mode _mode,
Fault startWalk();
Fault startFunctional(Addr &addr, unsigned &logBytes);
bool recvPacket(PacketPtr pkt);
+ unsigned numInflight() const;
bool isRetrying();
bool wasStarted();
bool isTiming();
void retry();
+ void squash();
std::string name() const {return walker->name();}
private: