sc_sensitive.cc revision 13210
1/* 2 * Copyright 2018 Google, Inc. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer; 8 * redistributions in binary form must reproduce the above copyright 9 * notice, this list of conditions and the following disclaimer in the 10 * documentation and/or other materials provided with the distribution; 11 * neither the name of the copyright holders nor the names of its 12 * contributors may be used to endorse or promote products derived from 13 * this software without specific prior written permission. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 * Authors: Gabe Black 28 */ 29 30#include "base/logging.hh" 31#include "systemc/core/process.hh" 32#include "systemc/ext/channel/sc_in.hh" 33#include "systemc/ext/channel/sc_inout.hh" 34#include "systemc/ext/channel/sc_signal_in_if.hh" 35#include "systemc/ext/core/sc_interface.hh" 36#include "systemc/ext/core/sc_sensitive.hh" 37 38namespace sc_core 39{ 40 41sc_sensitive::sc_sensitive() : currentProcess(nullptr) {} 42 43sc_sensitive & 44sc_sensitive::operator << (const sc_event &e) 45{ 46 sc_gem5::newStaticSensitivityEvent(currentProcess, &e); 47 return *this; 48} 49 50sc_sensitive & 51sc_sensitive::operator << (const sc_interface &i) 52{ 53 sc_gem5::newStaticSensitivityInterface(currentProcess, &i); 54 return *this; 55} 56 57sc_sensitive & 58sc_sensitive::operator << (const sc_port_base &b) 59{ 60 sc_gem5::newStaticSensitivityPort(currentProcess, &b); 61 return *this; 62} 63 64sc_sensitive & 65sc_sensitive::operator << (sc_event_finder &f) 66{ 67 sc_gem5::newStaticSensitivityFinder(currentProcess, &f); 68 return *this; 69} 70 71sc_sensitive & 72sc_sensitive::operator << (::sc_gem5::Process *p) 73{ 74 currentProcess = p; 75 return *this; 76} 77 78 79void 80sc_sensitive::operator () (::sc_gem5::Process *p, 81 const sc_signal_in_if<bool> &i) 82{ 83 sc_gem5::newStaticSensitivityEvent(p, &i.posedge_event()); 84} 85 86void 87sc_sensitive::operator () (::sc_gem5::Process *p, 88 const sc_signal_in_if<sc_dt::sc_logic> &i) 89{ 90 sc_gem5::newStaticSensitivityEvent(p, &i.posedge_event()); 91} 92 93void 94sc_sensitive::operator () (::sc_gem5::Process *p, const sc_in<bool> &port) 95{ 96 sc_gem5::newStaticSensitivityFinder(p, &port.pos()); 97} 98 99void 100sc_sensitive::operator () (::sc_gem5::Process *p, 101 const sc_in<sc_dt::sc_logic> &port) 102{ 103 sc_gem5::newStaticSensitivityFinder(p, &port.pos()); 104} 105 106void 107sc_sensitive::operator () (::sc_gem5::Process *p, const sc_inout<bool> &port) 108{ 109 sc_gem5::newStaticSensitivityFinder(p, &port.pos()); 110} 111 112void 113sc_sensitive::operator () (::sc_gem5::Process *p, 114 const sc_inout<sc_dt::sc_logic> &port) 115{ 116 sc_gem5::newStaticSensitivityFinder(p, &port.pos()); 117} 118 119void 120sc_sensitive::operator () (::sc_gem5::Process *p, sc_event_finder &f) 121{ 122 sc_gem5::newStaticSensitivityFinder(p, &f); 123} 124 125} // namespace sc_core 126