示例#1
0
void Check::performCallback(NodeID proc, SubBlock& data)
{
    Address address = data.getAddress();
    //  assert(getAddress() == address);  // This isn't exactly right since we now have multi-byte checks
    assert(getAddress().getLineAddress() == address.getLineAddress());

    DEBUG_MSG(TESTER_COMP, MedPrio, "Callback");
    DEBUG_EXPR(TESTER_COMP, MedPrio, *this);

    if (m_status == TesterStatus_Action_Pending) {
        DEBUG_MSG(TESTER_COMP, MedPrio, "Action callback");
        // Perform store
        data.setByte(0, m_value+m_store_count); // We store one byte at a time
        m_store_count++;

        if (m_store_count == CHECK_SIZE) {
            m_status = TesterStatus_Ready;
        } else {
            m_status = TesterStatus_Idle;
        }
    } else if (m_status == TesterStatus_Check_Pending) {
        DEBUG_MSG(TESTER_COMP, MedPrio, "Check callback");
        // Perform load/check
        for(int byte_number=0; byte_number<CHECK_SIZE; byte_number++) {
            if (uint8(m_value+byte_number) != data.getByte(byte_number) && (DATA_BLOCK == true)) {
                WARN_EXPR(proc);
                WARN_EXPR(address);
                WARN_EXPR(data);
                WARN_EXPR(byte_number);
                WARN_EXPR((int)m_value+byte_number);
                WARN_EXPR((int)data.getByte(byte_number));
                WARN_EXPR(*this);
                WARN_EXPR(g_eventQueue_ptr->getTime());
                ERROR_MSG("Action/check failure");
            }
        }
        DEBUG_MSG(TESTER_COMP, HighPrio, "Action/check success:");
        DEBUG_EXPR(TESTER_COMP, HighPrio, *this);
        DEBUG_EXPR(TESTER_COMP, MedPrio, data);

        m_status = TesterStatus_Idle;
        pickValue();

    } else {
        WARN_EXPR(*this);
        WARN_EXPR(proc);
        WARN_EXPR(data);
        WARN_EXPR(m_status);
        WARN_EXPR(g_eventQueue_ptr->getTime());
        ERROR_MSG("Unexpected TesterStatus");
    }

    DEBUG_EXPR(TESTER_COMP, MedPrio, proc);
    DEBUG_EXPR(TESTER_COMP, MedPrio, data);
    DEBUG_EXPR(TESTER_COMP, MedPrio, getAddress().getLineAddress());
    DEBUG_MSG(TESTER_COMP, MedPrio, "Callback done");
    DEBUG_EXPR(TESTER_COMP, MedPrio, *this);
}
示例#2
0
void Tester::hitCallback(NodeID proc, SubBlock& data, CacheRequestType type, int thread)
{
  // Mark that we made progress
  m_last_progress_vector[proc] = g_eventQueue_ptr->getTime();
  g_callback_counter++;

  // This tells us our store has 'completed' or for a load gives us
  // back the data to make the check
  DEBUG_EXPR(TESTER_COMP, MedPrio, proc);
  DEBUG_EXPR(TESTER_COMP, MedPrio, data);
  Check* check_ptr = m_checkTable.getCheck(data.getAddress());
  assert(check_ptr != NULL);
  check_ptr->performCallback(proc, data);

}
void RequestGenerator::performCallback(NodeID proc, SubBlock& data)
{
  Address address = data.getAddress();
  assert(proc == m_node);
  assert(address == m_address);  

  DEBUG_EXPR(TESTER_COMP, LowPrio, proc);
  DEBUG_EXPR(TESTER_COMP, LowPrio, m_status);
  DEBUG_EXPR(TESTER_COMP, LowPrio, address);
  DEBUG_EXPR(TESTER_COMP, LowPrio, data);

  if (m_status == RequestGeneratorStatus_Test_Pending) { 
    //    m_driver.recordTestLatency(g_eventQueue_ptr->getTime() - m_last_transition);
    if (data.readByte() == LockStatus_Locked) {
      // Locked - keep spinning
      m_status = RequestGeneratorStatus_Thinking;
      m_last_transition = g_eventQueue_ptr->getTime();
      g_eventQueue_ptr->scheduleEvent(this, waitTime());
    } else {
      // Unlocked - try the swap
      m_driver.recordTestLatency(g_eventQueue_ptr->getTime() - m_last_transition);
      m_status = RequestGeneratorStatus_Before_Swap;
      m_last_transition = g_eventQueue_ptr->getTime();
      g_eventQueue_ptr->scheduleEvent(this, waitTime());
    }
  } else if (m_status == RequestGeneratorStatus_Swap_Pending) {
    m_driver.recordSwapLatency(g_eventQueue_ptr->getTime() - m_last_transition);
    if (data.readByte() == LockStatus_Locked) {
      // We failed to aquire the lock
      m_status = RequestGeneratorStatus_Thinking;
      m_last_transition = g_eventQueue_ptr->getTime();
      g_eventQueue_ptr->scheduleEvent(this, waitTime());
    } else {
      // We acquired the lock
      data.writeByte(LockStatus_Locked);
      m_status = RequestGeneratorStatus_Holding;
      m_last_transition = g_eventQueue_ptr->getTime();
      DEBUG_MSG(TESTER_COMP, HighPrio, "Acquired");
      DEBUG_EXPR(TESTER_COMP, HighPrio, proc);
      DEBUG_EXPR(TESTER_COMP, HighPrio, g_eventQueue_ptr->getTime());
      g_eventQueue_ptr->scheduleEvent(this, holdTime());
    }
  } else if (m_status == RequestGeneratorStatus_Release_Pending) {
    m_driver.recordReleaseLatency(g_eventQueue_ptr->getTime() - m_last_transition);
    // We're releasing the lock
    data.writeByte(LockStatus_Unlocked);

    m_counter++;
    if (m_counter < g_param_ptr->TESTER_LENGTH()) {
      m_status = RequestGeneratorStatus_Thinking;
      m_last_transition = g_eventQueue_ptr->getTime();
      pickAddress();
      g_eventQueue_ptr->scheduleEvent(this, thinkTime());
    } else {
      m_driver.reportDone();
      m_status = RequestGeneratorStatus_Done;
      m_last_transition = g_eventQueue_ptr->getTime();
    } 
  } else {
    WARN_EXPR(m_status);
    ERROR_MSG("Invalid status");
  }
}
/******************************************************************
 * void hitCallback(int cpuNumber)
 * Called by Sequencer when the data is ready in the cache
 ******************************************************************/
void PyriteDriver::hitCallback(NodeID proc, SubBlock& data)
{
  physical_address_t paddr = data.getAddress().getAddress();
  m_mem_interface[proc]->fillRequest(paddr);
}