source: sources/src/sc_module_ext.h @ 27

Last change on this file since 27 was 27, checked in by buchmann, 15 years ago

SystemCASS now uses autoconf/automake to build the API. Regression tests still
use the old Makefiles.
(thanks to Nicolas Pouillon)

The library directory no longer is "lib-arch-system". The directory now is "lib-linux". Everyone needs to pay attention about SYSTEMCASS environment variable.

Changes:

  • system header includes
  • Add includes to config.h (generated by autoconf/automake)
  • test:
    • linux preprocessor macro instead of _WIN32
    • CONFIG_DEBUG instead of DEBUG

Removes:

  • Makefile
  • guess_endianness.cc
  • guess_os.sh
  • assert.h (we now use standard assert.h)
  • Options.def
File size: 8.8 KB
Line 
1/*------------------------------------------------------------\
2|                                                             |
3| Tool    :                  systemcass                       |
4|                                                             |
5| File    :                   sc_module_ext.h                 |
6|                                                             |
7| Author  :                 Buchmann Richard                  |
8|                           Taktak Sami                       |
9|                                                             |
10| Date    :                   09_07_2004                      |
11|                                                             |
12\------------------------------------------------------------*/
13
14/*
15 * This file is part of the Disydent Project
16 * Copyright (C) Laboratoire LIP6 - Département ASIM
17 * Universite Pierre et Marie Curie
18 *
19 * Home page          : http://www-asim.lip6.fr/disydent
20 * E-mail             : mailto:richard.buchmann@lip6.fr
21 *
22 * This library is free software; you  can redistribute it and/or modify it
23 * under the terms  of the GNU Library General Public  License as published
24 * by the Free Software Foundation; either version 2 of the License, or (at
25 * your option) any later version.
26 *
27 * Disydent is distributed  in the hope  that it  will be
28 * useful, but WITHOUT  ANY WARRANTY; without even the  implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
30 * Public License for more details.
31 *
32 * You should have received a copy  of the GNU General Public License along
33 * with the GNU C Library; see the  file COPYING. If not, write to the Free
34 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
35 */
36
37#ifndef __SC_MODULE_EXT_H__
38#define __SC_MODULE_EXT_H__
39
40#include "sc_fwd.h"
41#include "internal_ext.h"
42#include "sc_object.h"
43#include "sc_sensitive.h"
44#include "serialization_ext.h"
45
46namespace sc_core {
47
48class method_process_t;
49class sc_module;
50class sc_module_name;
51class sc_port_base;
52class sc_signal_base;
53
54typedef void (sc_module::*SC_ENTRY_FUNC)();
55//typedef void (*SC_ENTRY_FUNC)(sc_module*);
56
57extern method_process_t* create_method_process (const char*, SC_ENTRY_FUNC, sc_module&);
58
59// ----------------------------------------------------------------------------
60//  CLASS : sc_module
61//
62//  Module class.
63// ----------------------------------------------------------------------------
64typedef sc_signal_base sc_bind_proxy;
65extern sc_bind_proxy SC_BIND_PROXY_NIL;
66
67struct sc_module : public sc_object
68{
69  //////////////////////
70  // SYSTEMCASS SPECIFIC
71private : void init ();
72public :
73//  friend std::ostream& operator << (std::ostream &o, const sc_module &m);
74 
75  //////////////////////
76  // LRM (?)
77protected:
78  sc_module();
79  sc_module( const char* nm );
80//  sc_module( const sc_string& nm);
81  sc_module( const sc_module_name &nm);
82
83public:
84  ~sc_module() {};
85
86        /////////
87        //// LRM
88protected:  void dont_initialize ();
89public:  void operator () ( /* const */ sc_bind_proxy& p001,
90               /* const */ sc_bind_proxy& p002 = SC_BIND_PROXY_NIL,
91               /* const */ sc_bind_proxy& p003 = SC_BIND_PROXY_NIL,
92               /* const */ sc_bind_proxy& p004 = SC_BIND_PROXY_NIL,
93               /* const */ sc_bind_proxy& p005 = SC_BIND_PROXY_NIL,
94               /* const */ sc_bind_proxy& p006 = SC_BIND_PROXY_NIL,
95               /* const */ sc_bind_proxy& p007 = SC_BIND_PROXY_NIL,
96               /* const */ sc_bind_proxy& p008 = SC_BIND_PROXY_NIL,
97               /* const */ sc_bind_proxy& p009 = SC_BIND_PROXY_NIL,
98               /* const */ sc_bind_proxy& p010 = SC_BIND_PROXY_NIL,
99               /* const */ sc_bind_proxy& p011 = SC_BIND_PROXY_NIL,
100               /* const */ sc_bind_proxy& p012 = SC_BIND_PROXY_NIL,
101               /* const */ sc_bind_proxy& p013 = SC_BIND_PROXY_NIL,
102               /* const */ sc_bind_proxy& p014 = SC_BIND_PROXY_NIL,
103               /* const */ sc_bind_proxy& p015 = SC_BIND_PROXY_NIL,
104               /* const */ sc_bind_proxy& p016 = SC_BIND_PROXY_NIL,
105               /* const */ sc_bind_proxy& p017 = SC_BIND_PROXY_NIL,
106               /* const */ sc_bind_proxy& p018 = SC_BIND_PROXY_NIL,
107               /* const */ sc_bind_proxy& p019 = SC_BIND_PROXY_NIL,
108               /* const */ sc_bind_proxy& p020 = SC_BIND_PROXY_NIL,
109               /* const */ sc_bind_proxy& p021 = SC_BIND_PROXY_NIL,
110               /* const */ sc_bind_proxy& p022 = SC_BIND_PROXY_NIL,
111               /* const */ sc_bind_proxy& p023 = SC_BIND_PROXY_NIL,
112               /* const */ sc_bind_proxy& p024 = SC_BIND_PROXY_NIL,
113               /* const */ sc_bind_proxy& p025 = SC_BIND_PROXY_NIL,
114               /* const */ sc_bind_proxy& p026 = SC_BIND_PROXY_NIL,
115               /* const */ sc_bind_proxy& p027 = SC_BIND_PROXY_NIL,
116               /* const */ sc_bind_proxy& p028 = SC_BIND_PROXY_NIL,
117               /* const */ sc_bind_proxy& p029 = SC_BIND_PROXY_NIL,
118               /* const */ sc_bind_proxy& p030 = SC_BIND_PROXY_NIL,
119               /* const */ sc_bind_proxy& p031 = SC_BIND_PROXY_NIL,
120               /* const */ sc_bind_proxy& p032 = SC_BIND_PROXY_NIL,
121               /* const */ sc_bind_proxy& p033 = SC_BIND_PROXY_NIL,
122               /* const */ sc_bind_proxy& p034 = SC_BIND_PROXY_NIL,
123               /* const */ sc_bind_proxy& p035 = SC_BIND_PROXY_NIL,
124               /* const */ sc_bind_proxy& p036 = SC_BIND_PROXY_NIL,
125               /* const */ sc_bind_proxy& p037 = SC_BIND_PROXY_NIL,
126               /* const */ sc_bind_proxy& p038 = SC_BIND_PROXY_NIL,
127               /* const */ sc_bind_proxy& p039 = SC_BIND_PROXY_NIL,
128               /* const */ sc_bind_proxy& p040 = SC_BIND_PROXY_NIL,
129               /* const */ sc_bind_proxy& p041 = SC_BIND_PROXY_NIL,
130               /* const */ sc_bind_proxy& p042 = SC_BIND_PROXY_NIL,
131               /* const */ sc_bind_proxy& p043 = SC_BIND_PROXY_NIL,
132               /* const */ sc_bind_proxy& p044 = SC_BIND_PROXY_NIL,
133               /* const */ sc_bind_proxy& p045 = SC_BIND_PROXY_NIL,
134               /* const */ sc_bind_proxy& p046 = SC_BIND_PROXY_NIL,
135               /* const */ sc_bind_proxy& p047 = SC_BIND_PROXY_NIL,
136               /* const */ sc_bind_proxy& p048 = SC_BIND_PROXY_NIL,
137               /* const */ sc_bind_proxy& p049 = SC_BIND_PROXY_NIL,
138               /* const */ sc_bind_proxy& p050 = SC_BIND_PROXY_NIL,
139               /* const */ sc_bind_proxy& p051 = SC_BIND_PROXY_NIL,
140               /* const */ sc_bind_proxy& p052 = SC_BIND_PROXY_NIL,
141               /* const */ sc_bind_proxy& p053 = SC_BIND_PROXY_NIL,
142               /* const */ sc_bind_proxy& p054 = SC_BIND_PROXY_NIL,
143               /* const */ sc_bind_proxy& p055 = SC_BIND_PROXY_NIL,
144               /* const */ sc_bind_proxy& p056 = SC_BIND_PROXY_NIL,
145               /* const */ sc_bind_proxy& p057 = SC_BIND_PROXY_NIL,
146               /* const */ sc_bind_proxy& p058 = SC_BIND_PROXY_NIL,
147               /* const */ sc_bind_proxy& p059 = SC_BIND_PROXY_NIL,
148               /* const */ sc_bind_proxy& p060 = SC_BIND_PROXY_NIL,
149               /* const */ sc_bind_proxy& p061 = SC_BIND_PROXY_NIL,
150               /* const */ sc_bind_proxy& p062 = SC_BIND_PROXY_NIL,
151               /* const */ sc_bind_proxy& p063 = SC_BIND_PROXY_NIL,
152               /* const */ sc_bind_proxy& p064 = SC_BIND_PROXY_NIL );
153       
154        /////////
155  // These are protected so that user derived classes can refer to them.
156  sc_sensitive     sensitive;
157  sc_sensitive_pos sensitive_pos;
158  sc_sensitive_neg sensitive_neg; 
159};
160
161#define SC_MODULE(user_module_name) \
162       struct user_module_name : sc_module
163
164// the SC_HAS_PROCESS macro call must be followed by a ;
165#define SC_HAS_PROCESS(user_module_name)                         \
166   typedef user_module_name SC_CURRENT_USER_MODULE
167
168#define SC_CTOR(user_module_name)                                \
169   SC_HAS_PROCESS(user_module_name);                             \
170   user_module_name(sc_module_name)
171
172/* Converting `void (module_tag::*)()' to `void (sc_module::*)()' is OK as
173   long as the dynamic type is correct.  C++ Standard 5.4 "Explicit type
174   conversion", clause 7: a pointer to member of derived class type may be
175   explicitly converted to a pointer to member of an unambiguous non-virtual
176   base class type. */
177#define SC_MAKE_FUNC_PTR(module_tag, func) \
178    (/*static_cast<*/(sc_core::SC_ENTRY_FUNC)/*>*/ (&module_tag::func))
179
180extern void declare_method_process(const char*,SC_ENTRY_FUNC,sc_module&);
181
182#define DECLARE_METHOD_PROCESS(handle, name, module_tag, func) \
183  declare_method_process(name, \
184                        SC_MAKE_FUNC_PTR( module_tag, func ), \
185                        *this)
186
187#define SC_METHOD(func)     \
188  {                         \
189  DECLARE_METHOD_PROCESS(func ## _handle, #func, SC_CURRENT_USER_MODULE,func);\
190  }
191
192#define SC_MAKE_SAVE_PTR(module_tag, func) \
193    (/*static_cast<*/(sc_core::save_fct_t1)/*>*/ (&module_tag::func))
194
195extern void declare_save_handler(const char*,save_fct_t1,sc_module&);
196//extern void declare_save_handler(const char*,save_fct_t2,sc_module&);
197#define DECLARE_SAVE_HANDLER(handle, name, module_tag, func) \
198  declare_save_handler (name, \
199                        SC_MAKE_SAVE_PTR( module_tag, func ), \
200                        *this)
201
202#define SAVE_HANDLER(func)  \
203  {                         \
204  DECLARE_SAVE_HANDLER(func ## _handle, #func, SC_CURRENT_USER_MODULE,func);\
205  }
206} // end of namespace sc_core
207
208#endif /* __SC_MODULE_EXT_H__ */
209
Note: See TracBrowser for help on using the repository browser.