X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fhdsd%2Fscd%2Fscd_rem_fifo_in.h;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fhdsd%2Fscd%2Fscd_rem_fifo_in.h;h=f95f548f73153ac5889a34379869cebf733d1273;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/hdsd/scd/scd_rem_fifo_in.h b/dol/src/dol/visitor/hdsd/scd/scd_rem_fifo_in.h new file mode 100644 index 0000000..f95f548 --- /dev/null +++ b/dol/src/dol/visitor/hdsd/scd/scd_rem_fifo_in.h @@ -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_IN_H_ +#define SCD_REM_FIFO_IN_H_ + +#include "systemc" + +#include "simple_fifo.h" // for read_if +#include "scd_rem_chan_if.h" + + +/** + * FIFO channel with remote input. Data read from this FIFO originates + * from another host. + */ +class scd_rem_fifo_in : public sc_core::sc_prim_channel, public read_if, + public scd_rem_chan_in_if +{ +public: + /** + * Constructor. + * \param name the name of the channel (is passed to parent constructor) + * \param size size of the input buffer in bytes + */ + scd_rem_fifo_in(sc_module_name name, int size); + + virtual ~scd_rem_fifo_in(); + + /* read_if */ + void read(char &c); + int rtest(int size); + void reset(); + int num_available(); + + /* scd_rem_chan_out_if */ + size_t free() const; + void receive(const void* buf, size_t len); + +private: + int _size; + char* _data; + int _num_elements, _first; + sc_event _write_event; +}; + +#endif