sc_inout_resolved.cc revision 13237
12SN/A/* 21762SN/A * Copyright 2018 Google, Inc. 32SN/A * 42SN/A * Redistribution and use in source and binary forms, with or without 52SN/A * modification, are permitted provided that the following conditions are 62SN/A * met: redistributions of source code must retain the above copyright 72SN/A * notice, this list of conditions and the following disclaimer; 82SN/A * redistributions in binary form must reproduce the above copyright 92SN/A * notice, this list of conditions and the following disclaimer in the 102SN/A * documentation and/or other materials provided with the distribution; 112SN/A * neither the name of the copyright holders nor the names of its 122SN/A * contributors may be used to endorse or promote products derived from 132SN/A * this software without specific prior written permission. 142SN/A * 152SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 162SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 172SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 182SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 192SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 202SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 212SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 252SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262SN/A * 272665Ssaidi@eecs.umich.edu * Authors: Gabe Black 282665Ssaidi@eecs.umich.edu */ 292665Ssaidi@eecs.umich.edu 302665Ssaidi@eecs.umich.edu#include "base/logging.hh" 312SN/A#include "systemc/ext/channel/sc_inout_resolved.hh" 322SN/A#include "systemc/ext/channel/sc_signal_resolved.hh" 332SN/A#include "systemc/ext/utils/sc_report_handler.hh" 342SN/A 352SN/Anamespace sc_core 362SN/A{ 372SN/A 383971Sgblack@eecs.umich.edusc_inout_resolved::sc_inout_resolved() : sc_inout<sc_dt::sc_logic>() {} 3956SN/A 4056SN/Asc_inout_resolved::sc_inout_resolved(const char *name) : 411158SN/A sc_inout<sc_dt::sc_logic>(name) 42146SN/A{} 431858SN/A 442680Sktlim@umich.edusc_inout_resolved::~sc_inout_resolved() {} 452378SN/A 462522SN/Avoid 472401SN/Asc_inout_resolved::end_of_elaboration() 48146SN/A{ 49360SN/A sc_inout<sc_dt::sc_logic>::end_of_elaboration(); 504434Ssaidi@eecs.umich.edu if (!dynamic_cast<sc_signal_resolved *>(get_interface())) { 51695SN/A std::string msg = csprintf("port '%s' (%s)", name(), kind()); 522093SN/A SC_REPORT_ERROR("(E117) resolved port not bound to resolved signal", 532378SN/A msg.c_str()); 542SN/A } 552715Sstever@eecs.umich.edu} 562715Sstever@eecs.umich.edu 572715Sstever@eecs.umich.edusc_inout_resolved & 582715Sstever@eecs.umich.edusc_inout_resolved::operator = (const sc_dt::sc_logic &l) 592715Sstever@eecs.umich.edu{ 602715Sstever@eecs.umich.edu (*this)->write(l); 612715Sstever@eecs.umich.edu return *this; 622715Sstever@eecs.umich.edu} 632715Sstever@eecs.umich.edu 644157Sgblack@eecs.umich.edusc_inout_resolved & 654166Sgblack@eecs.umich.edusc_inout_resolved::operator = (const sc_signal_in_if<sc_dt::sc_logic> &i) 662715Sstever@eecs.umich.edu{ 672715Sstever@eecs.umich.edu (*this)->write(i.read()); 682715Sstever@eecs.umich.edu return *this; 692715Sstever@eecs.umich.edu} 702715Sstever@eecs.umich.edu 712SN/Asc_inout_resolved & 722107SN/Asc_inout_resolved::operator = ( 732SN/A const sc_port<sc_signal_in_if<sc_dt::sc_logic>, 1> &p) 742SN/A{ 752SN/A (*this)->write(p->read()); 762SN/A return *this; 772SN/A} 782SN/A 791858SN/Asc_inout_resolved & 80360SN/Asc_inout_resolved::operator = ( 812SN/A const sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1> &p) 822SN/A{ 832SN/A (*this)->write(p->read()); 842SN/A return *this; 852SN/A} 861450SN/A 872378SN/Asc_inout_resolved & 882SN/Asc_inout_resolved::operator = (const sc_inout_resolved &p) 892SN/A{ 902SN/A (*this)->write(p->read()); 912378SN/A return *this; 922SN/A} 932SN/A 942SN/A} // namespace sc_core 952SN/A