Sequencer.cc (7546:84e8f914b3b8) Sequencer.cc (7550:7d97cec15818)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

36#include "mem/ruby/common/SubBlock.hh"
37#include "mem/ruby/libruby.hh"
38#include "mem/ruby/profiler/Profiler.hh"
39#include "mem/ruby/recorder/Tracer.hh"
40#include "mem/ruby/slicc_interface/AbstractController.hh"
41#include "mem/ruby/system/CacheMemory.hh"
42#include "mem/ruby/system/Sequencer.hh"
43#include "mem/ruby/system/System.hh"
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

36#include "mem/ruby/common/SubBlock.hh"
37#include "mem/ruby/libruby.hh"
38#include "mem/ruby/profiler/Profiler.hh"
39#include "mem/ruby/recorder/Tracer.hh"
40#include "mem/ruby/slicc_interface/AbstractController.hh"
41#include "mem/ruby/system/CacheMemory.hh"
42#include "mem/ruby/system/Sequencer.hh"
43#include "mem/ruby/system/System.hh"
44#include "mem/packet.hh"
44#include "params/RubySequencer.hh"
45
46using namespace std;
47
48Sequencer *
49RubySequencerParams::create()
50{
51 return new Sequencer(this);

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

298 } else {
299 m_readRequestTable.erase(line_addr);
300 }
301
302 markRemoved();
303}
304
305void
45#include "params/RubySequencer.hh"
46
47using namespace std;
48
49Sequencer *
50RubySequencerParams::create()
51{
52 return new Sequencer(this);

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

299 } else {
300 m_readRequestTable.erase(line_addr);
301 }
302
303 markRemoved();
304}
305
306void
307Sequencer::handleLlscWrites(const Address& address, SequencerRequest* request)
308{
309 if (request->ruby_request.type == RubyRequestType_Locked_Write) {
310 if (!m_dataCache_ptr->isLocked(address, m_version)) {
311 //
312 // For failed SC requests, indicate the failure to the cpu by
313 // setting the extra data to zero.
314 //
315 request->ruby_request.pkt->req->setExtraData(0);
316 } else {
317 //
318 // For successful SC requests, indicate the success to the cpu by
319 // setting the extra data to one.
320 //
321 request->ruby_request.pkt->req->setExtraData(1);
322 }
323 m_dataCache_ptr->clearLocked(address);
324 } else if (request->ruby_request.type == RubyRequestType_Locked_Read) {
325 //
326 // Note: To fully follow Alpha LLSC semantics, should the LL clear any
327 // previously locked cache lines?
328 //
329 m_dataCache_ptr->setLocked(address, m_version);
330 } else if (m_dataCache_ptr->isLocked(address, m_version)) {
331 //
332 // Normal writes should clear the locked address
333 //
334 m_dataCache_ptr->clearLocked(address);
335 }
336}
337
338void
306Sequencer::writeCallback(const Address& address, DataBlock& data)
307{
308 writeCallback(address, GenericMachineType_NULL, data);
309}
310
311void
312Sequencer::writeCallback(const Address& address,
313 GenericMachineType mach,

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

324 markRemoved();
325
326 assert((request->ruby_request.type == RubyRequestType_ST) ||
327 (request->ruby_request.type == RubyRequestType_RMW_Read) ||
328 (request->ruby_request.type == RubyRequestType_RMW_Write) ||
329 (request->ruby_request.type == RubyRequestType_Locked_Read) ||
330 (request->ruby_request.type == RubyRequestType_Locked_Write));
331
339Sequencer::writeCallback(const Address& address, DataBlock& data)
340{
341 writeCallback(address, GenericMachineType_NULL, data);
342}
343
344void
345Sequencer::writeCallback(const Address& address,
346 GenericMachineType mach,

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

357 markRemoved();
358
359 assert((request->ruby_request.type == RubyRequestType_ST) ||
360 (request->ruby_request.type == RubyRequestType_RMW_Read) ||
361 (request->ruby_request.type == RubyRequestType_RMW_Write) ||
362 (request->ruby_request.type == RubyRequestType_Locked_Read) ||
363 (request->ruby_request.type == RubyRequestType_Locked_Write));
364
332 if (request->ruby_request.type == RubyRequestType_Locked_Read) {
333 m_dataCache_ptr->setLocked(address, m_version);
334 } else if (request->ruby_request.type == RubyRequestType_RMW_Read) {
365 //
366 // For Alpha, properly handle LL, SC, and write requests with respect to
367 // locked cache blocks.
368 //
369 handleLlscWrites(address, request);
370
371 if (request->ruby_request.type == RubyRequestType_RMW_Read) {
335 m_controller->blockOnQueue(address, m_mandatory_q_ptr);
336 } else if (request->ruby_request.type == RubyRequestType_RMW_Write) {
337 m_controller->unblock(address);
338 }
339
340 hitCallback(request, mach, data);
341}
342

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

499 new SequencerRequest(request, g_eventQueue_ptr->getTime());
500 bool found = insertRequest(srequest);
501 if (found) {
502 panic("Sequencer::makeRequest should never be called if the "
503 "request is already outstanding\n");
504 return RequestStatus_NULL;
505 }
506
372 m_controller->blockOnQueue(address, m_mandatory_q_ptr);
373 } else if (request->ruby_request.type == RubyRequestType_RMW_Write) {
374 m_controller->unblock(address);
375 }
376
377 hitCallback(request, mach, data);
378}
379

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

536 new SequencerRequest(request, g_eventQueue_ptr->getTime());
537 bool found = insertRequest(srequest);
538 if (found) {
539 panic("Sequencer::makeRequest should never be called if the "
540 "request is already outstanding\n");
541 return RequestStatus_NULL;
542 }
543
507 if (request.type == RubyRequestType_Locked_Write) {
508 // NOTE: it is OK to check the locked flag here as the
509 // mandatory queue will be checked first ensuring that nothing
510 // comes between checking the flag and servicing the store.
511
512 Address line_addr = line_address(Address(request.paddr));
513 if (!m_dataCache_ptr->isLocked(line_addr, m_version)) {
514 removeRequest(srequest);
515 if (Debug::getProtocolTrace()) {
516 g_system_ptr->getProfiler()->
517 profileTransition("Seq", m_version,
518 Address(request.paddr),
519 "", "SC Fail", "",
520 RubyRequestType_to_string(request.type));
521 }
522 return RequestStatus_LlscFailed;
523 } else {
524 m_dataCache_ptr->clearLocked(line_addr);
525 }
526 }
527 issueRequest(request);
528
529 // TODO: issue hardware prefetches here
530 return RequestStatus_Issued;
531}
532
533void
534Sequencer::issueRequest(const RubyRequest& request)

--- 125 unchanged lines hidden ---
544 issueRequest(request);
545
546 // TODO: issue hardware prefetches here
547 return RequestStatus_Issued;
548}
549
550void
551Sequencer::issueRequest(const RubyRequest& request)

--- 125 unchanged lines hidden ---