rc_prim_channel.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  */
00037 #ifndef RC_PRIM_CHANNEL_H_
00038 #define RC_PRIM_CHANNEL_H_
00039 
00040 #include "ReChannel/core/rc_reconfigurable.h"
00041 
00042 namespace ReChannel {
00043 
00047 class rc_prim_channel
00048     : public sc_prim_channel,
00049       virtual public rc_resettable
00050 {
00051 public:
00052 
00053     rc_prim_channel()
00054         : sc_prim_channel(), p_constr_done(false)
00055     {
00056         p_reconf =
00057             rc_register_resettable(*this, this->get_parent_object());
00058     }
00059 
00060     explicit rc_prim_channel(const char* name_)
00061         : sc_prim_channel(name_), p_constr_done(false)
00062     {
00063         p_reconf =
00064             rc_register_resettable(*this, this->get_parent_object());
00065     }
00066 
00067 protected:
00068 
00069     inline bool rc_has_reconfigurable() const
00070         { return (p_reconf != NULL); }
00071 
00072     inline const rc_reconfigurable* rc_get_reconfigurable() const
00073         { return p_reconf; }
00074 
00075     inline bool rc_is_constr_done() const
00076         { return p_constr_done; }
00077 
00078     inline rc_reconfigurable::state_type rc_get_state() const
00079     {
00080         return (p_reconf != NULL ?
00081             p_reconf->rc_get_state() : rc_reconfigurable::ACTIVE);
00082     }
00083 
00084     inline rc_reconfigurable::state_type rc_get_next_state() const
00085     {
00086         return (p_reconf != NULL ?
00087             p_reconf->rc_get_next_state() : rc_reconfigurable::ACTIVE);
00088     }
00089 
00090     inline bool rc_is_loaded() const
00091         { return (this->rc_get_state() != rc_reconfigurable::UNLOADED); }
00092 
00093     inline bool rc_is_active() const
00094         { return (this->rc_get_state() == rc_reconfigurable::ACTIVE); }
00095 
00096     /* next_trigger(..) redirects */
00097 
00098     inline void next_trigger()
00099         { rc_next_trigger(); }
00100 
00101     inline void next_trigger(const sc_event& e)
00102         { rc_next_trigger(e); }
00103 
00104     inline void next_trigger(sc_event_or_list& el)
00105         { rc_next_trigger(el); }
00106 
00107     inline void next_trigger(sc_event_and_list& el)
00108         { rc_next_trigger(el); }
00109 
00110     inline void next_trigger(const sc_time& t)
00111         { rc_next_trigger(t); }
00112 
00113     inline void next_trigger(double v, sc_time_unit tu)
00114         { rc_next_trigger(v, tu); }
00115 
00116     inline void next_trigger(const sc_time& t, const sc_event& e)
00117         { rc_next_trigger(t, e); }
00118 
00119     inline void next_trigger(double v, sc_time_unit tu, const sc_event& e)
00120         { rc_next_trigger(v, tu, e); }
00121 
00122     inline void next_trigger(const sc_time& t, sc_event_or_list& el)
00123         { rc_next_trigger(t, el); }
00124 
00125     inline void next_trigger(
00126         double v, sc_time_unit t, sc_event_or_list& el)
00127         { rc_next_trigger(v, t, el); }
00128 
00129     inline void next_trigger(const sc_time& t, sc_event_and_list& el)
00130         { rc_next_trigger(t, el); }
00131 
00132     inline void next_trigger(
00133         double v, sc_time_unit tu, sc_event_and_list& el)
00134         { rc_next_trigger(v, tu, el); }
00135 
00136 /* rc_wait() redirects */
00137 
00138     inline void wait()
00139         { rc_wait(); }
00140 
00141     inline void wait(int n)
00142         { rc_wait(n); }
00143 
00144     inline void wait(const sc_event& e)
00145         { rc_wait(e); }
00146 
00147     inline void wait(sc_event_or_list& el)
00148         { rc_wait(el); }
00149 
00150     inline void wait(sc_event_and_list& el)
00151         { rc_wait(el); }
00152 
00153     inline void wait(const sc_time& t)
00154         { rc_wait(t); }
00155 
00156     inline void wait(double v, sc_time_unit tu)
00157         { rc_wait(v, tu); }
00158 
00159     inline void wait(const sc_time& t, const sc_event& e)
00160         { rc_wait(t, e); }
00161 
00162     inline void wait(double v, sc_time_unit tu, const sc_event& e)
00163         { rc_wait(v, tu, e); }
00164 
00165     inline void wait(const sc_time& t, sc_event_or_list& el)
00166         { rc_wait(t, el); }
00167 
00168     inline void wait(double v, sc_time_unit t, sc_event_or_list& el)
00169         { rc_wait(v, t, el); }
00170 
00171     inline void wait(const sc_time& t, sc_event_and_list& el)
00172         { rc_wait(t, el); }
00173 
00174     inline void wait(double v, sc_time_unit tu, sc_event_and_list& el)
00175         { rc_wait(v, tu, el); }
00176 
00177     virtual void start_of_simulation()
00178     {
00179         p_constr_done = true;
00180     }
00181 
00182     RC_ON_INIT_RESETTABLE() {}
00183 
00184     RC_ON_RESET() {}
00185 
00186 private:
00187     const rc_reconfigurable* p_reconf;
00188     bool                     p_constr_done;
00189 
00190 private:
00191     // disabled
00192     rc_prim_channel(const rc_prim_channel& other);
00193     rc_prim_channel& operator=(const rc_prim_channel& other);
00194 };
00195 
00196 } // namespace ReChannel
00197 
00198 #endif //RC_PRIM_CHANNEL_H_
00199 
00200 //
00201 // $Id: rc_prim_channel.h,v 1.8 2007/12/20 20:33:51 felke Exp $
00202 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/components/rc_prim_channel.h,v $
00203 //

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