pinapa-module-decoration.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * arch-tag: Matthieu Moy  September 16, 2003 (parser/include/scp-module-decoration.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 
00030 #include "pinapa-parser-all.h"
00031 
00032 #ifndef PINAPA_MODULE_DECORATION_H
00033 #define PINAPA_MODULE_DECORATION_H
00034 
00035 #include "pinapa-systemc-light.h"
00036 
00037 #include "pinapa-tree.h"
00038 #include "pinapa-basic-slave-process.h"
00039 #include "pinapa-tac-slave-process.h"
00040 #include "pinapa-extend-slave-process.h"
00041 #include "pinapa-decoration-base.h"
00042 
00043 #include <map>
00044 #include <set>
00045 #include <vector>
00046 
00047 #include "pinapa-hash.h"
00048 
00049 namespace pinapa {
00053   class st_module_deco_t {
00054   public:
00055     st_module_deco_t() : m_class_context(NULL),
00056                          m_tac_read_func(NULL), m_tac_read_byte_enable_func(NULL),
00057                          m_tac_read_block_func(NULL),
00058                          m_tac_write_func(NULL), m_tac_write_byte_enable_func(NULL),
00059                          m_tac_write_block_func(NULL)
00060                          {}
00061                          
00062     // Thierry Grellier
00063     // add association towards module class definition
00068 public:
00069     tree get_class_context() const             { return m_class_context; }
00070     void set_class_context(tree class_context) { m_class_context = class_context; }
00071 protected:
00072     tree m_class_context;
00073 
00079   public:
00080     tree get_basic_write_func() const
00081     {
00082       return get_slave_func("basic_slave_base","write");
00083     }
00084     void set_basic_write_func(tree w)
00085     {
00086       set_slave_func("basic_slave_base", "write", w);
00087     }
00088     inline tree get_basic_read_func() const 
00089     {
00090       return get_slave_func("basic_slave_base","read");
00091     }
00092     inline void set_basic_read_func(tree r) 
00093     {
00094       set_slave_func("basic_slave_base", "read", r);
00095     }
00096     inline basic_slave_method_handle get_basic_write_handle() const 
00097     {
00098       return dynamic_cast<basic_slave_method_handle>(get_slave_method_handle("basic_slave_base",
00099                                                                              "write"
00100                                                                              )
00101                                                      );
00102     }
00103     inline void set_basic_write_handle(basic_slave_method_handle  w) 
00104     {
00105       set_slave_method_handle("basic_slave_base","write",w);
00106     }
00107     inline basic_slave_method_handle get_basic_read_handle() const 
00108     {
00109       return dynamic_cast<basic_slave_method_handle>(get_slave_method_handle("basic_slave_base",
00110                                                                              "read"
00111                                                                              )
00112                                                      );
00113     }
00114     inline void set_basic_read_handle(basic_slave_method_handle  r) 
00115     {
00116       set_slave_method_handle("basic_slave_base","read",r);
00117     }
00118 
00124   public:
00125     tree get_tac_write_func() const {return m_tac_write_func;}
00126     void set_tac_write_func(tree w) {m_tac_write_func = w;}
00127   
00128     tree get_tac_write_byte_enable_func() const {return m_tac_write_byte_enable_func;}
00129     void set_tac_write_byte_enable_func(tree w) {m_tac_write_byte_enable_func = w;}
00130   
00131     tree get_tac_write_block_func() const {return m_tac_write_block_func;}
00132     void set_tac_write_block_func(tree w) {m_tac_write_block_func = w;}
00133 
00134     tree get_tac_read_func() const {return m_tac_read_func;}
00135     void set_tac_read_func(tree r) {m_tac_read_func = r;}
00136   
00137     tree get_tac_read_byte_enable_func() const {return m_tac_read_byte_enable_func;}
00138     void set_tac_read_byte_enable_func(tree r) {m_tac_read_byte_enable_func = r;}
00139   
00140     tree get_tac_read_block_func() const {return m_tac_read_block_func;}
00141     void set_tac_read_block_func(tree r) {m_tac_read_block_func = r;}
00142 
00143     tac_slave_method_handle get_tac_write_handle() const {return m_tac_write_handle;}
00144     void set_tac_write_handle(tac_slave_method_handle  w) {m_tac_write_handle = w;}
00145   
00146     tac_slave_method_handle get_tac_write_byte_enable_handle() const {return m_tac_write_byte_enable_handle;}
00147     void set_tac_write_byte_enable_handle(tac_slave_method_handle  w) {m_tac_write_byte_enable_handle = w;}
00148 
00149     tac_slave_method_handle get_tac_write_block_handle() const {return m_tac_write_block_handle;}
00150     void set_tac_write_block_handle(tac_slave_method_handle  w) {m_tac_write_block_handle = w;}
00151   
00152     tac_slave_method_handle get_tac_read_handle() const {return m_tac_read_handle;}
00153     void set_tac_read_handle(tac_slave_method_handle  r) {m_tac_read_handle = r;}
00154   
00155     tac_slave_method_handle get_tac_read_byte_enable_handle() const {return m_tac_read_byte_enable_handle;}
00156     void set_tac_read_byte_enable_handle(tac_slave_method_handle  r) {m_tac_read_byte_enable_handle = r;}
00157 
00158     tac_slave_method_handle get_tac_read_block_handle() const {return m_tac_read_block_handle;}
00159     void set_tac_read_block_handle(tac_slave_method_handle  r) {m_tac_read_block_handle = r;}
00160   
00161   private:
00162     tree m_tac_read_func;
00163     tree m_tac_read_byte_enable_func;
00164     tree m_tac_read_block_func;
00165   
00166     tree m_tac_write_func;
00167     tree m_tac_write_byte_enable_func;
00168     tree m_tac_write_block_func;
00169 
00170     tac_slave_method_handle m_tac_read_handle;
00171     tac_slave_method_handle m_tac_read_byte_enable_handle;
00172     tac_slave_method_handle m_tac_read_block_handle;
00173   
00174     tac_slave_method_handle m_tac_write_handle;
00175     tac_slave_method_handle m_tac_write_byte_enable_handle;
00176     tac_slave_method_handle m_tac_write_block_handle;
00177 
00183   public:
00185     vector<string> get_slave_funcs(string slavebase) const;
00186 
00188     tree get_slave_func(string slavebase, string fn) const
00189     {
00190       map<string,tree>::const_iterator i = m_slave_func_trees.find(slavebase_index(slavebase,fn));
00191       return (i != m_slave_func_trees.end()) ? i->second : NULL_TREE;
00192     }
00193 
00195     void set_slave_func(string slavebase, string fn, tree w)
00196     {
00197       m_slave_bases.insert(slavebase);
00198       m_slave_funcs[slavebase].insert(fn);
00199       m_slave_func_trees[slavebase_index(slavebase,fn)] = w;
00200     }
00201 
00203     slave_method_handle get_slave_method_handle(string slavebase, string fn) const
00204     {
00205       map<string,slave_method_handle>::const_iterator i = m_slave_handles.find(slavebase_index(slavebase,fn));
00206       return (i != m_slave_handles.end()) ? i->second : 0;
00207     }
00208 
00210     void set_slave_method_handle(string slavebase, string fn, slave_method_handle w)
00211     {
00212       m_slave_handles[slavebase_index(slavebase,fn)] = w;
00213     }
00214 
00216     static inline string slavebase_index(string slavebase, string fn) {
00217       if (slavebase.size()) {
00218         return string(slavebase + string("::") + fn);
00219       }
00220       else {
00221         return fn;
00222       }
00223     }
00224 
00225   private:
00226     set<string>                     m_slave_bases;
00227     map<string,set<string> >        m_slave_funcs;
00228     map<string,tree>                m_slave_func_trees;
00229     map<string,slave_method_handle> m_slave_handles;
00231   };
00232 
00233   typedef st_deco_first<st_module_deco_t,
00234                         sc_module> st_module_deco;
00235 
00236   typedef st_module_deco * module_deco;
00237 
00238 }
00239 
00240 #endif // PINAPA_MODULE_DECORATION_H
00241 
Generated by
Matthieu Moy <Matthieu.Moy@st.com>
Back to Pinapa Home Page