summaryrefslogtreecommitdiff
path: root/src/systemc/ext/channel/sc_fifo_in.hh
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-08-27 22:37:27 -0700
committerGabe Black <gabeblack@google.com>2018-10-03 00:11:33 +0000
commite061a36291dfb99b10b6637a80ae3f4da3ac7e0b (patch)
tree883646ae9af02902e71debccb593b2dae1707638 /src/systemc/ext/channel/sc_fifo_in.hh
parent41b339367c2c858c1dc9fb98931ceb6f3efb5b57 (diff)
downloadgem5-e061a36291dfb99b10b6637a80ae3f4da3ac7e0b.tar.xz
systemc: Implement most of sc_fifo and its interfaces.
There are still some bugs since the output of the tests don't all match, but more tests pass and fewer abort. Change-Id: I37f84d65c4a8a43357c98282096e39b9401fc1dd Reviewed-on: https://gem5-review.googlesource.com/c/12275 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/ext/channel/sc_fifo_in.hh')
-rw-r--r--src/systemc/ext/channel/sc_fifo_in.hh66
1 files changed, 27 insertions, 39 deletions
diff --git a/src/systemc/ext/channel/sc_fifo_in.hh b/src/systemc/ext/channel/sc_fifo_in.hh
index 0952d77d1..541d1fcaa 100644
--- a/src/systemc/ext/channel/sc_fifo_in.hh
+++ b/src/systemc/ext/channel/sc_fifo_in.hh
@@ -30,6 +30,7 @@
#ifndef __SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_HH__
#define __SYSTEMC_EXT_CHANNEL_SC_FIFO_IN_HH__
+#include "../core/sc_event.hh"
#include "../core/sc_port.hh"
#include "sc_fifo_in_if.hh"
#include "warn_unimpl.hh"
@@ -44,72 +45,59 @@ template <class T>
class sc_fifo_in : public sc_port<sc_fifo_in_if<T>, 0>
{
public:
- sc_fifo_in() : sc_port<sc_fifo_in_if<T>, 0>() {}
- explicit sc_fifo_in(const char *name) : sc_port<sc_fifo_in_if<T>, 0>(name)
+ sc_fifo_in() : sc_port<sc_fifo_in_if<T>, 0>(),
+ _dataWrittenFinder(*this, &sc_fifo_in_if<T>::data_written_event)
+ {}
+ explicit sc_fifo_in(const char *name) :
+ sc_port<sc_fifo_in_if<T>, 0>(name),
+ _dataWrittenFinder(*this, &sc_fifo_in_if<T>::data_written_event)
{}
virtual ~sc_fifo_in() {}
// Deprecated binding constructors.
explicit sc_fifo_in(const sc_fifo_in_if<T> &interface) :
- sc_port<sc_fifo_in_if<T>, 0>(interface)
+ sc_port<sc_fifo_in_if<T>, 0>(interface),
+ _dataWrittenFinder(*this, &sc_fifo_in_if<T>::data_written_event)
{}
sc_fifo_in(const char *name, const sc_fifo_in_if<T> &interface) :
- sc_port<sc_fifo_in_if<T>, 0>(name, interface)
+ sc_port<sc_fifo_in_if<T>, 0>(name, interface),
+ _dataWrittenFinder(*this, &sc_fifo_in_if<T>::data_written_event)
{}
explicit sc_fifo_in(sc_port_b<sc_fifo_in_if<T> > &parent) :
- sc_port<sc_fifo_in_if<T>, 0>(parent)
+ sc_port<sc_fifo_in_if<T>, 0>(parent),
+ _dataWrittenFinder(*this, &sc_fifo_in_if<T>::data_written_event)
{}
sc_fifo_in(const char *name, sc_port_b<sc_fifo_in_if<T> > &parent) :
- sc_port<sc_fifo_in_if<T>, 0>(name, parent)
+ sc_port<sc_fifo_in_if<T>, 0>(name, parent),
+ _dataWrittenFinder(*this, &sc_fifo_in_if<T>::data_written_event)
{}
explicit sc_fifo_in(sc_port<sc_fifo_in_if<T>, 0> &parent) :
- sc_port<sc_fifo_in_if<T>, 0>(parent)
+ sc_port<sc_fifo_in_if<T>, 0>(parent),
+ _dataWrittenFinder(*this, &sc_fifo_in_if<T>::data_written_event)
{}
sc_fifo_in(const char *name, sc_port<sc_fifo_in_if<T>, 0> &parent) :
- sc_port<sc_fifo_in_if<T>, 0>(name, parent)
+ sc_port<sc_fifo_in_if<T>, 0>(name, parent),
+ _dataWrittenFinder(*this, &sc_fifo_in_if<T>::data_written_event)
{}
- void
- read(T &)
- {
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
- }
- T
- read()
- {
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
- return *(T *)nullptr;
- }
- bool
- nb_read(T &)
- {
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
- return false;
- }
+ void read(T &t) { (*this)->read(t); }
+ T read() { return (*this)->read(); }
+ bool nb_read(T &t) { return (*this)->nb_read(t); }
const sc_event &
data_written_event() const
{
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
- return *(const sc_event *)nullptr;
- }
- sc_event_finder &
- data_written() const
- {
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
- return *(sc_event_finder *)nullptr;
- }
- int
- num_available() const
- {
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
- return 0;
+ return (*this)->data_written_event();
}
+ sc_event_finder &data_written() const { return _dataWrittenFinder; }
+ int num_available() const { return (*this)->num_available(); }
virtual const char *kind() const { return "sc_fifo_in"; }
private:
// Disabled
sc_fifo_in(const sc_fifo_in<T> &) : sc_port<sc_fifo_in_if<T>, 0>() {}
sc_fifo_in<T> &operator = (const sc_fifo_in<T> &) { return *this; }
+
+ mutable sc_event_finder_t<sc_fifo_in_if<T> > _dataWrittenFinder;
};
} // namespace sc_core