dol: initial dol commit
[jump.git] / dol / src / dol / visitor / hdsd / scd / scd_rem_fifo_out.h
1 /*****************************************************************************
2
3   The following code is derived, directly or inror: pointdirectly, from the SystemC
4   source code Copyright (c) 1996-2007 by all Contributors.
5   All Rights reserved.
6
7   The contents of this file are subject to the restrictions and limitations
8   set forth in the SystemC Open Source License Version 2.4 (the "License");
9   You may not use this file except in compliance with such restrictions and
10   limitations. You may obtain instructions on how to receive a copy of the
11   License at http://www.systemc.org/. Software distributed by Contributors
12   under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13   ANY KIND, either express or implied. See the License for the specific
14   language governing rights and limitations under the License.
15
16  *****************************************************************************/
17
18 /*****************************************************************************
19
20   simple_fifo.cpp -- Simple SystemC 2.0 producer/consumer example.
21
22                      From "An Introduction to System Level Modeling in
23                      SystemC 2.0". By Stuart Swan, Cadence Design Systems.
24                      Available at www.systemc.org
25
26   Original Author: Stuart Swan, Cadence Design Systems, 2001-06-18
27
28  *****************************************************************************/
29
30 /*****************************************************************************
31
32   MODIFICATION LOG - modifiers, enter your name, affiliation, date and
33   changes you are making here.
34
35       Name, Affiliation, Date:  Fabian Hugelshofer, ETH Zurich, 13.11.2007
36   Description of Modification:  Used code as base for remote fifo channels.
37
38  *****************************************************************************/
39
40 #ifndef SCD_REM_FIFO_OUT_H_
41 #define SCD_REM_FIFO_OUT_H_
42
43 #include "systemc"
44
45 #include "simple_fifo.h" // for write_if
46 #include "scd_rem_chan_if.h"
47
48
49 /**
50  * FIFO channel with remote output. Data written to this FIFO endpoint
51  * is transmitted to another host.
52  */
53 class scd_rem_fifo_out : public sc_core::sc_prim_channel, public write_if,
54     public scd_rem_chan_out_if
55 {
56 public:
57     /**
58      * Constructor.
59      * \param name the name of the channel (is passed to parent constructor)
60      * \param size size of the output buffer in bytes
61      */
62     scd_rem_fifo_out(sc_module_name name, int size);
63
64     virtual ~scd_rem_fifo_out();
65
66     /* write_if */
67     void write(char c);
68     int wtest(int size);
69     void reset();
70
71     /* scd_rem_chan_out_if */
72     size_t available() const;
73     const void* send() const;
74     void remove(size_t len);
75
76 private:
77     int _size;
78     char* _data;
79     int _num_elements, _first;
80     sc_event _read_event;
81 };
82
83 #endif