sc_in_rv.hh revision 13214:a37fa0c75211
15647Sgblack@eecs.umich.edu/*
29544Sandreas.hansson@arm.com * Copyright 2018 Google, Inc.
38922Swilliam.wang@arm.com *
48922Swilliam.wang@arm.com * Redistribution and use in source and binary forms, with or without
58922Swilliam.wang@arm.com * modification, are permitted provided that the following conditions are
68922Swilliam.wang@arm.com * met: redistributions of source code must retain the above copyright
78922Swilliam.wang@arm.com * notice, this list of conditions and the following disclaimer;
88922Swilliam.wang@arm.com * redistributions in binary form must reproduce the above copyright
98922Swilliam.wang@arm.com * notice, this list of conditions and the following disclaimer in the
108922Swilliam.wang@arm.com * documentation and/or other materials provided with the distribution;
118922Swilliam.wang@arm.com * neither the name of the copyright holders nor the names of its
128922Swilliam.wang@arm.com * contributors may be used to endorse or promote products derived from
138922Swilliam.wang@arm.com * this software without specific prior written permission.
145647Sgblack@eecs.umich.edu *
155647Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
165647Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
177087Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
187087Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
197087Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
207087Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
217087Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
227087Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
237087Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
247087Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
255647Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
267087Snate@binkert.org *
277087Snate@binkert.org * Authors: Gabe Black
287087Snate@binkert.org */
297087Snate@binkert.org
307087Snate@binkert.org#ifndef __SYSTEMC_EXT_CHANNEL_SC_IN_RV_HH__
317087Snate@binkert.org#define __SYSTEMC_EXT_CHANNEL_SC_IN_RV_HH__
327087Snate@binkert.org
337087Snate@binkert.org#include <sstream>
345647Sgblack@eecs.umich.edu
357087Snate@binkert.org#include "sc_in.hh"
365647Sgblack@eecs.umich.edu#include "sc_signal_rv.hh"
375647Sgblack@eecs.umich.edu
385647Sgblack@eecs.umich.edunamespace sc_dt
395647Sgblack@eecs.umich.edu{
405647Sgblack@eecs.umich.edu
415647Sgblack@eecs.umich.edutemplate <int W>
425647Sgblack@eecs.umich.educlass sc_lv;
435647Sgblack@eecs.umich.edu
445647Sgblack@eecs.umich.edu} // namespace sc_dt
455647Sgblack@eecs.umich.edu
465647Sgblack@eecs.umich.edunamespace sc_core
475647Sgblack@eecs.umich.edu{
485647Sgblack@eecs.umich.edu
495647Sgblack@eecs.umich.edutemplate <int W>
505647Sgblack@eecs.umich.educlass sc_in_rv : public sc_in<sc_dt::sc_lv<W>>
515647Sgblack@eecs.umich.edu{
5210474Sandreas.hansson@arm.com  public:
5310474Sandreas.hansson@arm.com    sc_in_rv() : sc_in<sc_dt::sc_lv<W>>() {}
548229Snate@binkert.org    explicit sc_in_rv(const char *name) : sc_in<sc_dt::sc_lv<W>>(name) {}
555647Sgblack@eecs.umich.edu    virtual ~sc_in_rv() {};
565654Sgblack@eecs.umich.edu
575647Sgblack@eecs.umich.edu    virtual void
588232Snate@binkert.org    end_of_elaboration()
596137Sgblack@eecs.umich.edu    {
606137Sgblack@eecs.umich.edu        sc_in<sc_dt::sc_lv<W> >::end_of_elaboration();
616137Sgblack@eecs.umich.edu        if (!dynamic_cast<sc_signal_rv<W> *>(this->get_interface())) {
625654Sgblack@eecs.umich.edu            std::ostringstream ss;
636046Sgblack@eecs.umich.edu            ss << "port '" << this->name() << "' (" << this->kind() << ")";
648781Sgblack@eecs.umich.edu            SC_REPORT_ERROR(
655647Sgblack@eecs.umich.edu                    "(E117) resolved port not bound to resolved signal",
665648Sgblack@eecs.umich.edu                    ss.str().c_str());
675648Sgblack@eecs.umich.edu        }
685647Sgblack@eecs.umich.edu    }
695647Sgblack@eecs.umich.edu
705647Sgblack@eecs.umich.edu    virtual const char *kind() const { return "sc_in_rv"; }
715647Sgblack@eecs.umich.edu
725647Sgblack@eecs.umich.edu  private:
735647Sgblack@eecs.umich.edu    // Disabled
745647Sgblack@eecs.umich.edu    sc_in_rv(const sc_in_rv<W> &) : sc_in<sc_dt::sc_lv<W>>() {}
755647Sgblack@eecs.umich.edu    sc_in_rv<W> &operator = (const sc_in_rv<W> &) { *this; }
765647Sgblack@eecs.umich.edu};
775648Sgblack@eecs.umich.edu
785647Sgblack@eecs.umich.edu} // namespace sc_core
795648Sgblack@eecs.umich.edu
805648Sgblack@eecs.umich.edu#endif  //__SYSTEMC_EXT_CHANNEL_SC_IN_RV_HH__
815648Sgblack@eecs.umich.edu