dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / scd_rem_fifo_out.h
diff --git a/dol/src/dol/visitor/hdsd/scd/scd_rem_fifo_out.h b/dol/src/dol/visitor/hdsd/scd/scd_rem_fifo_out.h
new file mode 100644 (file)
index 0000000..2025a1e
--- /dev/null
@@ -0,0 +1,83 @@
+/*****************************************************************************
+
+  The following code is derived, directly or inror: pointdirectly, from the SystemC
+  source code Copyright (c) 1996-2007 by all Contributors.
+  All Rights reserved.
+
+  The contents of this file are subject to the restrictions and limitations
+  set forth in the SystemC Open Source License Version 2.4 (the "License");
+  You may not use this file except in compliance with such restrictions and
+  limitations. You may obtain instructions on how to receive a copy of the
+  License at http://www.systemc.org/. Software distributed by Contributors
+  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
+  ANY KIND, either express or implied. See the License for the specific
+  language governing rights and limitations under the License.
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+  simple_fifo.cpp -- Simple SystemC 2.0 producer/consumer example.
+
+                     From "An Introduction to System Level Modeling in
+                     SystemC 2.0". By Stuart Swan, Cadence Design Systems.
+                     Available at www.systemc.org
+
+  Original Author: Stuart Swan, Cadence Design Systems, 2001-06-18
+
+ *****************************************************************************/
+
+/*****************************************************************************
+
+  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
+  changes you are making here.
+
+      Name, Affiliation, Date:  Fabian Hugelshofer, ETH Zurich, 13.11.2007
+  Description of Modification:  Used code as base for remote fifo channels.
+
+ *****************************************************************************/
+
+#ifndef SCD_REM_FIFO_OUT_H_
+#define SCD_REM_FIFO_OUT_H_
+
+#include "systemc"
+
+#include "simple_fifo.h" // for write_if
+#include "scd_rem_chan_if.h"
+
+
+/**
+ * FIFO channel with remote output. Data written to this FIFO endpoint
+ * is transmitted to another host.
+ */
+class scd_rem_fifo_out : public sc_core::sc_prim_channel, public write_if,
+    public scd_rem_chan_out_if
+{
+public:
+    /**
+     * Constructor.
+     * \param name the name of the channel (is passed to parent constructor)
+     * \param size size of the output buffer in bytes
+     */
+    scd_rem_fifo_out(sc_module_name name, int size);
+
+    virtual ~scd_rem_fifo_out();
+
+    /* write_if */
+    void write(char c);
+    int wtest(int size);
+    void reset();
+
+    /* scd_rem_chan_out_if */
+    size_t available() const;
+    const void* send() const;
+    void remove(size_t len);
+
+private:
+    int _size;
+    char* _data;
+    int _num_elements, _first;
+    sc_event _read_event;
+};
+
+#endif