pinapa-sensitivity-list.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * arch-tag: Matthieu Moy  June 25, 2003 (parser/include/scp-sensitivity-list.h)
00003  *------------------------------------------------------------------------------
00004  *         Copyright (c) STMicroelectronics,Verimag
00005  * Pinapa is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2 of the License, or (at your option) any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Library General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free
00017  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00018  * MA 02111-1307, USA
00019  *------------------------------------------------------------------------------
00020  *                 System Platform Group - HPC
00021  *******************************************************************************/
00022 
00036 #include "pinapa-parser-all.h"
00037 
00038 namespace pinapa {
00039   
00040   class st_sensitivity;
00041   typedef st_sensitivity * sensitivity;
00042   
00043   class st_sensitivity_list;
00044   typedef st_sensitivity_list * sensitivity_list;
00045   
00046   class st_time_sensitivity;
00047   typedef st_time_sensitivity * time_sensitivity;
00048   
00049 }
00050 
00051 #ifndef PINAPA_SENSITIVITY_LIST_H
00052 #define PINAPA_SENSITIVITY_LIST_H
00053 
00054 #include "pinapa-systemc-light.h"
00055 
00056 namespace pinapa {
00057   
00061   class st_sensitivity {
00062   public:
00063     virtual bool is_time() const {return false;};
00064     virtual bool is_list() const {return false;};
00065   protected:
00066     st_sensitivity() {}
00067   };
00068   
00069   class st_time_sensitivity :
00070     public st_sensitivity {
00071   public:
00073     st_time_sensitivity (sc_time duration)
00074       : m_duration(duration) {}
00075     sc_time get_duration() const {return m_duration;}
00076     virtual bool is_time() const {return true;};
00077     bool is_zero_time() {return m_duration == SC_ZERO_TIME;}
00078   private:
00079     sc_time m_duration;
00080   };
00081   
00082   class st_sensitivity_list :
00083     public st_sensitivity {
00084   public:
00085     virtual bool is_list() const {return true;};
00086     class elem {
00087     public:
00088       virtual bool is_port() const {return false;}
00089       virtual bool is_event() const {return false;}
00090     };
00091     typedef vector<const elem *> list_t;
00092     
00093     const list_t & get_list() const {return m_list;}
00094     void add_elem(const elem * e) {m_list.push_back(e);}
00095 
00096   private:
00097     list_t m_list;
00098 
00099   public:
00100     class port : public elem {
00101     public:
00102       enum edge_t {POS, NEG, CHANGE};
00103 
00105       port (const sc_port_base * port, edge_t edge = CHANGE) : m_port(port), m_edge(edge) {}
00106 
00107       virtual bool is_port() const {return true;}
00108 
00109       edge_t get_edge() const {return m_edge;}
00110       void set_edge(edge_t e) {m_edge = e;}
00111 
00112       const sc_port_base * get_port() const {return m_port;}
00113     private:
00114       const sc_port_base * m_port;
00115       edge_t m_edge;
00116     };
00117 
00118     class event : public elem {
00119       virtual bool is_event() const {return true;}
00120     public:
00122       event (const sc_event * event) : m_event(event) {}
00123 
00124       const sc_event * get_event() const {return m_event;}
00125     private:
00126       const sc_event * m_event;
00127     };
00128 
00129   public:
00130     virtual ~st_sensitivity_list() {}
00131   };
00132 }
00133 
00134 #endif // PINAPA_SENSITIVITY_H
00135 
00136   
Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page