sc_fifo_in.hh revision 12868
17008Snate@binkert.org/*
27008Snate@binkert.org * Copyright 2018 Google, Inc.
37008Snate@binkert.org *
47008Snate@binkert.org * Redistribution and use in source and binary forms, with or without
57008Snate@binkert.org * modification, are permitted provided that the following conditions are
67008Snate@binkert.org * met: redistributions of source code must retain the above copyright
77008Snate@binkert.org * notice, this list of conditions and the following disclaimer;
87008Snate@binkert.org * redistributions in binary form must reproduce the above copyright
97008Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
107008Snate@binkert.org * documentation and/or other materials provided with the distribution;
117008Snate@binkert.org * neither the name of the copyright holders nor the names of its
127008Snate@binkert.org * contributors may be used to endorse or promote products derived from
137008Snate@binkert.org * this software without specific prior written permission.
147008Snate@binkert.org *
157008Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
167008Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
177008Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
187008Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
197008Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
207008Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
217008Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
227008Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
237008Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
247008Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
257008Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
267008Snate@binkert.org *
277008Snate@binkert.org * Authors: Gabe Black
286285Snate@binkert.org */
297039Snate@binkert.org
307039Snate@binkert.org#ifndef __SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_HH__
316285Snate@binkert.org#define __SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_HH__
326285Snate@binkert.org
337039Snate@binkert.org#include "../core/sc_port.hh"
346285Snate@binkert.org#include "sc_fifo_in_if.hh"
356285Snate@binkert.org#include "warn_unimpl.hh"
366876Ssteve.reinhardt@amd.com
377039Snate@binkert.orgnamespace sc_core
386285Snate@binkert.org{
396285Snate@binkert.org
406285Snate@binkert.orgclass sc_event;
417039Snate@binkert.orgclass sc_event_finder;
427039Snate@binkert.org
436285Snate@binkert.orgtemplate <class T>
447039Snate@binkert.orgclass sc_fifo_in : public sc_port<sc_fifo_in_if<T>, 0>
457039Snate@binkert.org{
467039Snate@binkert.org  public:
476285Snate@binkert.org    sc_fifo_in() : sc_port<sc_fifo_in_if<T>, 0>() {}
486285Snate@binkert.org    explicit sc_fifo_in(const char *name) : sc_port<sc_fifo_in_if<T>, 0>(name)
497039Snate@binkert.org    {}
507039Snate@binkert.org    virtual ~sc_fifo_in() {}
516285Snate@binkert.org
527544SBrad.Beckmann@amd.com    // Deprecated binding constructors.
537544SBrad.Beckmann@amd.com    explicit sc_fifo_in(const sc_fifo_in_if<T> &interface) :
547544SBrad.Beckmann@amd.com        sc_port<sc_fifo_in_if<T>, 0>(interface)
557544SBrad.Beckmann@amd.com    {}
567039Snate@binkert.org    sc_fifo_in(const char *name, const sc_fifo_in_if<T> &interface) :
577039Snate@binkert.org        sc_port<sc_fifo_in_if<T>, 0>(name, interface)
587039Snate@binkert.org    {}
597039Snate@binkert.org    explicit sc_fifo_in(sc_port_b<sc_fifo_in_if<T> > &parent) :
607039Snate@binkert.org        sc_port<sc_fifo_in_if<T>, 0>(parent)
617039Snate@binkert.org    {}
627039Snate@binkert.org    sc_fifo_in(const char *name, sc_port_b<sc_fifo_in_if<T> > &parent) :
637039Snate@binkert.org        sc_port<sc_fifo_in_if<T>, 0>(name, parent)
647039Snate@binkert.org    {}
657039Snate@binkert.org    explicit sc_fifo_in(sc_port<sc_fifo_in_if<T>, 0> &parent) :
667039Snate@binkert.org        sc_port<sc_fifo_in_if<T>, 0>(parent)
677039Snate@binkert.org    {}
687039Snate@binkert.org    sc_fifo_in(const char *name, sc_port<sc_fifo_in_if<T>, 0> &parent) :
697907Shestness@cs.utexas.edu        sc_port<sc_fifo_in_if<T>, 0>(name, parent)
707907Shestness@cs.utexas.edu    {}
717039Snate@binkert.org
727039Snate@binkert.org    void
737908Shestness@cs.utexas.edu    read(T &)
747908Shestness@cs.utexas.edu    {
757039Snate@binkert.org        sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
767039Snate@binkert.org    }
777039Snate@binkert.org    T
787039Snate@binkert.org    read()
796285Snate@binkert.org    {
807039Snate@binkert.org        sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
817039Snate@binkert.org        return *(T *)nullptr;
826285Snate@binkert.org    }
837039Snate@binkert.org    bool
847039Snate@binkert.org    nb_read(T &)
857039Snate@binkert.org    {
867039Snate@binkert.org        sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
877039Snate@binkert.org        return false;
887039Snate@binkert.org    }
897039Snate@binkert.org    const sc_event &
906285Snate@binkert.org    data_written_event() const
917453Snate@binkert.org    {
927453Snate@binkert.org        sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
937453Snate@binkert.org        return *(const sc_event *)nullptr;
947453Snate@binkert.org    }
957039Snate@binkert.org    sc_event_finder &
966888SBrad.Beckmann@amd.com    data_written() const
977453Snate@binkert.org    {
987039Snate@binkert.org        sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
996888SBrad.Beckmann@amd.com        return *(sc_event_finder *)nullptr;
1007915SBrad.Beckmann@amd.com    }
1017915SBrad.Beckmann@amd.com    int
1027915SBrad.Beckmann@amd.com    num_available() const
1037915SBrad.Beckmann@amd.com    {
1047039Snate@binkert.org        sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
1056888SBrad.Beckmann@amd.com        return 0;
1067039Snate@binkert.org    }
1077039Snate@binkert.org    virtual const char *kind() const { return "sc_fifo_in"; }
1087453Snate@binkert.org
1096285Snate@binkert.org  private:
1107039Snate@binkert.org    // Disabled
1116285Snate@binkert.org    sc_fifo_in(const sc_fifo_in<T> &) : sc_port<sc_fifo_in_if<T>, 0>() {}
1126285Snate@binkert.org    sc_fifo_in<T> &operator = (const sc_fifo_in<T> &) { return *this; }
1137039Snate@binkert.org};
1147039Snate@binkert.org
1156285Snate@binkert.org} // namespace sc_core
1167039Snate@binkert.org
1177039Snate@binkert.org#endif  //__SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_HH__
1187039Snate@binkert.org