rc_reset_channel_if.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_RESET_CHANNEL_IF_H_
00039 #define RC_RESET_CHANNEL_IF_H_
00040 
00041 #include "ReChannel/core/rc_common_header.h"
00042 #include "ReChannel/core/rc_process.h"
00043 
00044 namespace ReChannel {
00045 
00046 namespace internals {
00047 class process_support;
00048 } // namespace internals
00049 
00070 class rc_reset_channel_if
00071     : virtual public sc_interface
00072 {
00077     friend class internals::process_support;
00078 
00079 protected:
00088     virtual void register_process_control(
00089         rc_process_control& pctrl, bool active_level) const = 0;
00090 
00099     virtual void unregister_process_control(
00100         rc_process_control& pctrl) const = 0;
00101 
00106     virtual bool get_current_level() const = 0;
00107 
00118     virtual const sc_signal<bool>* get_underlying_reset_signal() const = 0;
00119 };
00120 
00121 namespace internals {
00122 
00128 class reset_signal
00129     : public sc_signal<bool>,
00130       virtual public rc_reset_channel_if
00131 {
00132 private:
00133     typedef sc_signal<bool> base_type;
00134     typedef std::set<rc_process_control*> pctrl_set;
00135 
00136 public:
00137     reset_signal(const char* name_=sc_gen_unique_name("signal"))
00138         : base_type(name_)
00139     {}
00140 
00141     virtual void register_process_control(
00142         rc_process_control& pctrl, bool active_level) const;
00143 
00144     virtual void unregister_process_control(
00145         rc_process_control& pctrl) const;
00146 
00147     operator const bool&() const
00148         { return this->read(); }
00149 
00150     reset_signal& operator= (const bool& value)
00151         { this->write(value); return *this; }
00152 
00153     reset_signal& operator= (const reset_signal& buffer_)
00154         { this->write(buffer_); return *this; }
00155 
00156 protected:
00157     virtual bool get_current_level() const
00158         { return this->read(); }
00159 
00160     virtual const sc_signal<bool>* get_underlying_reset_signal() const
00161         { return this; }
00162 
00163     virtual void update();
00164 
00165 private:
00166     mutable pctrl_set p_pctrl_set[2];
00167 };
00168 
00174 class reset_buffer
00175     : public sc_buffer<bool>,
00176       virtual public rc_reset_channel_if
00177 {
00178 private:
00179     typedef sc_buffer<bool> base_type;
00180     typedef std::set<rc_process_control*> pctrl_set;
00181 
00182 public:
00183     reset_buffer(const char* name_=sc_gen_unique_name("buffer"))
00184         : base_type(name_)
00185     {}
00186 
00187     virtual void register_process_control(
00188         rc_process_control& pctrl, bool active_level) const;
00189 
00190     virtual void unregister_process_control(
00191         rc_process_control& pctrl) const;
00192 
00193     operator const bool&() const
00194         { return this->read(); }
00195 
00196     reset_buffer& operator= (const bool& value)
00197         { this->write(value); return *this; }
00198 
00199     reset_buffer& operator= (const reset_buffer& buffer_)
00200         { this->write(buffer_); return *this; }
00201 
00202 protected:
00203     virtual bool get_current_level() const
00204         { return this->read(); }
00205 
00206     virtual const sc_signal<bool>* get_underlying_reset_signal() const
00207         { return this; }
00208 
00209     virtual void update();
00210 
00211 private:
00212     mutable pctrl_set p_pctrl_set[2];
00213 };
00214 
00215 } // namespace internals
00216 
00217 } // namespace ReChannel
00218 
00219 #endif // RC_RESET_CHANNEL_IF_H_
00220 
00221 //
00222 // $Id: rc_reset_channel_if.h,v 1.5 2007/10/09 21:47:01 felke Exp $
00223 // $Source: /var/cvs/projekte/ReChannel-v2/src/ReChannel/core/rc_reset_channel_if.h,v $
00224 //

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