rc_fifo_portals.h

Go to the documentation of this file.
00001 // vim:set et sts=4 ts=4 tw=75 sw=4 ai ci cin cino=g0,t0:
00002 /*
00003  * Copyright (C) 2007, Technical Computer Science Group,
00004  *                     University of Bonn
00005  *
00006  * This file is part of the ReChannel library.
00007  *
00008  * The ReChannel library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU General Public License as
00010  * published by the Free Software Foundation; either version 2 of the
00011  * License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be
00014  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this library; see the file COPYING. If not, write to the
00020  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
00021  * Boston, MA 02110-1301, USA.
00022  *
00023  * Authors: Andreas Raabe and Armin Felke. Implementation by Armin Felke.
00024  *          {raabe, felke}@cs.uni-bonn.de
00025  */
00038 #ifndef RC_FIFO_PORTALS_H_
00039 #define RC_FIFO_PORTALS_H_
00040 
00041 #include "ReChannel/communication/portals/rc_portal.h"
00042 #include "ReChannel/communication/accessors/rc_fifo_accessors.h"
00043 
00044 namespace ReChannel {
00045 
00049 template<class T>
00050 RC_PORTAL_TEMPLATE(sc_fifo_in<T>)
00051 {
00052     RC_PORTAL_TEMPLATE_CTOR(sc_fifo_in<T>)
00053     {
00054         RC_PORTAL_FORWARD_EVENT(data_written_event);
00055     }
00056 
00057     RC_ON_OPEN()
00058     {
00059         this->refresh_notify();
00060     }
00061 
00062     RC_ON_REFRESH_NOTIFY()
00063     {
00064         if (this->get_static_port().num_available() > 0) {
00065             this->notify_event("data_written_event");
00066         }
00067     }
00068 };
00069 
00073 template<class T>
00074 RC_PORTAL_TEMPLATE(sc_fifo_out<T>)
00075 {
00076     RC_PORTAL_TEMPLATE_CTOR(sc_fifo_out<T>)
00077     {
00078         RC_PORTAL_FORWARD_EVENT(data_read_event);
00079     }
00080 
00081     RC_ON_OPEN()
00082     {
00083         this->refresh_notify();
00084     }
00085 
00086     RC_ON_REFRESH_NOTIFY()
00087     {
00088         if (this->get_static_port().num_free() > 0) {
00089             this->notify_event("data_read_event");
00090         }
00091     }
00092 };
00093 
00094 /* named portal specializations */
00095 
00099 template<class T>
00100 class rc_fifo_in_portal
00101     : public rc_portal<sc_fifo_in<T> >
00102 {
00103     typedef rc_portal<sc_fifo_in<T> > base_type;
00104 public:
00105     typedef typename base_type::port_type     port_type;
00106     typedef typename base_type::if_type       if_type;
00107     typedef typename base_type::accessor_type accessor_type;
00108 
00109     explicit rc_fifo_in_portal(
00110         const sc_module_name& name_ =
00111             sc_gen_unique_name("rc_fifo_in_portal"))
00112         : base_type(name_)
00113     { }
00114 };
00115 
00119 template<class T>
00120 class rc_fifo_out_portal
00121     : public rc_portal<sc_fifo_out<T> >
00122 {
00123     typedef rc_portal<sc_fifo_out<T> > base_type;
00124 public:
00125     typedef typename base_type::port_type     port_type;
00126     typedef typename base_type::if_type       if_type;
00127     typedef typename base_type::accessor_type accessor_type;
00128 
00129     explicit rc_fifo_out_portal(
00130         const sc_module_name& name_ =
00131             sc_gen_unique_name("rc_fifo_out_portal"))
00132         : base_type(name_)
00133     { }
00134 };
00135 
00136 } // namespace ReChannel
00137 
00138 #endif // RC_FIFO_PORTALS_H_
00139 //
00140 // $Id: rc_fifo_portals.h,v 1.8 2007/11/23 13:24:55 felke Exp $
00141 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/communication/portals/rc_fifo_portals.h,v $
00142 //

Generated on Tue Jan 1 23:13:37 2008 for ReChannel by  doxygen 1.5.3