sc_sensitive.cc revision 12957:e54f9890363d
112866Sgabeblack@google.com/* 212866Sgabeblack@google.com * Copyright 2018 Google, Inc. 312866Sgabeblack@google.com * 412866Sgabeblack@google.com * Redistribution and use in source and binary forms, with or without 512866Sgabeblack@google.com * modification, are permitted provided that the following conditions are 612866Sgabeblack@google.com * met: redistributions of source code must retain the above copyright 712866Sgabeblack@google.com * notice, this list of conditions and the following disclaimer; 812866Sgabeblack@google.com * redistributions in binary form must reproduce the above copyright 912866Sgabeblack@google.com * notice, this list of conditions and the following disclaimer in the 1012866Sgabeblack@google.com * documentation and/or other materials provided with the distribution; 1112866Sgabeblack@google.com * neither the name of the copyright holders nor the names of its 1212866Sgabeblack@google.com * contributors may be used to endorse or promote products derived from 1312866Sgabeblack@google.com * this software without specific prior written permission. 1412866Sgabeblack@google.com * 1512866Sgabeblack@google.com * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1612866Sgabeblack@google.com * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1712866Sgabeblack@google.com * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1812866Sgabeblack@google.com * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1912866Sgabeblack@google.com * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2012866Sgabeblack@google.com * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2112866Sgabeblack@google.com * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2212866Sgabeblack@google.com * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2312866Sgabeblack@google.com * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2412866Sgabeblack@google.com * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2512866Sgabeblack@google.com * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2612866Sgabeblack@google.com * 2712866Sgabeblack@google.com * Authors: Gabe Black 2812866Sgabeblack@google.com */ 2912866Sgabeblack@google.com 3012866Sgabeblack@google.com#include "base/logging.hh" 3112866Sgabeblack@google.com#include "systemc/core/process.hh" 3212866Sgabeblack@google.com#include "systemc/ext/core/sc_interface.hh" 3312866Sgabeblack@google.com#include "systemc/ext/core/sc_sensitive.hh" 3412866Sgabeblack@google.com 3512866Sgabeblack@google.comnamespace sc_core 3612866Sgabeblack@google.com{ 3712866Sgabeblack@google.com 3812866Sgabeblack@google.comsc_sensitive::sc_sensitive() : currentProcess(nullptr) {} 3912866Sgabeblack@google.com 4012866Sgabeblack@google.comsc_sensitive & 4112866Sgabeblack@google.comsc_sensitive::operator << (const sc_event &e) 4212866Sgabeblack@google.com{ 4312866Sgabeblack@google.com currentProcess->addStatic( 4412866Sgabeblack@google.com new sc_gem5::PendingSensitivityEvent(currentProcess, &e)); 4512866Sgabeblack@google.com return *this; 4612866Sgabeblack@google.com} 4713458Sgabeblack@google.com 4812866Sgabeblack@google.comsc_sensitive & 4912866Sgabeblack@google.comsc_sensitive::operator << (const sc_interface &i) 5012866Sgabeblack@google.com{ 5112866Sgabeblack@google.com currentProcess->addStatic( 5212866Sgabeblack@google.com new sc_gem5::PendingSensitivityInterface(currentProcess, &i)); 5312866Sgabeblack@google.com return *this; 5412866Sgabeblack@google.com} 5512866Sgabeblack@google.com 5612866Sgabeblack@google.comsc_sensitive & 5712866Sgabeblack@google.comsc_sensitive::operator << (const sc_port_base &b) 5812866Sgabeblack@google.com{ 5912866Sgabeblack@google.com currentProcess->addStatic( 6012866Sgabeblack@google.com new sc_gem5::PendingSensitivityPort(currentProcess, &b)); 6112866Sgabeblack@google.com return *this; 6213458Sgabeblack@google.com} 6313458Sgabeblack@google.com 6412866Sgabeblack@google.comsc_sensitive & 6512866Sgabeblack@google.comsc_sensitive::operator << (sc_event_finder &f) 6612922Sgabeblack@google.com{ 6712869Sgabeblack@google.com currentProcess->addStatic( 6812866Sgabeblack@google.com new sc_gem5::PendingSensitivityFinder(currentProcess, &f)); 6912869Sgabeblack@google.com return *this; 7013458Sgabeblack@google.com} 7113458Sgabeblack@google.com 7212866Sgabeblack@google.comsc_sensitive & 7312866Sgabeblack@google.comsc_sensitive::operator << (::sc_gem5::Process *p) 7412866Sgabeblack@google.com{ 7512866Sgabeblack@google.com currentProcess = p; 7612866Sgabeblack@google.com return *this; 7712866Sgabeblack@google.com} 7812866Sgabeblack@google.com 7912866Sgabeblack@google.com} // namespace sc_core 8012866Sgabeblack@google.com