source: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Component.h @ 81

Last change on this file since 81 was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1#ifndef morpheo_behavioural_Component_h
2#define morpheo_behavioural_Component_h
3
4/*
5 * $Id: Component.h 81 2008-04-15 18:40:01Z rosiere $
6 *
7 * [ Description ]
8 *
9 */
10
11#include <stdint.h>
12#include <iostream>
13#include <list>
14#include <map>
15#ifdef VHDL
16#include "Behavioural/include/Vhdl.h"
17#endif
18//#include "Behavioural/include/Description.h"
19#include "Behavioural/include/Entity.h"
20#include "Common/include/ToString.h"
21#include "Common/include/Debug.h"
22#include "Behavioural/include/Usage.h"
23
24namespace morpheo              {
25namespace behavioural          {
26
27#ifdef DEBUG
28# define PORT_MAP(x,a,b,c,d)                                            \
29  do                                                                    \
30    {                                                                   \
31      try                                                               \
32        {                                                               \
33          x->port_map(a,b,c,d);                                         \
34        }                                                               \
35      catch (morpheo::ErrorMorpheo & error)                             \
36        {                                                               \
37          throw (ErrorMorpheo ("In file "+toString(__FILE__)+", at line "+toString(__LINE__)+"\n"+error.what ())); \
38        }                                                               \
39    }                                                                   \
40  while (0)
41#else
42# define PORT_MAP(x,a,b,c,d)                                            \
43  do                                                                    \
44    {                                                                   \
45      x->port_map(a,b,c,d);                                             \
46    }                                                                   \
47  while (0)
48#endif
49
50#define COMPONENT_MAP(x,a,b,c,d)                                        \
51  do                                                                    \
52    {                                                                   \
53      PORT_MAP(x,a,b,c,d);                                              \
54      PORT_MAP(x,c,d,a,b);                                              \
55    }                                                                   \
56  while (0)
57 
58
59  typedef uint8_t Tinstance_t;
60
61#define INSTANCE_NONE         0x0
62#define INSTANCE_LIBRARY      0x1
63#define INSTANCE_COMPONENT    0x2
64#define INSTANCE_POSITION     0x4
65#define INSTANCE_ALL          0x7
66
67  typedef struct
68  {
69//public : Component * _component;
70  public : Entity    * _entity   ;
71  public : Tinstance_t _instance ;
72  } Tcomponent_t;   
73 
74  class Component
75  {
76    // -----[ fields ]----------------------------------------------------
77  private   : const Tusage_t             _usage;
78  private   : Entity                   * _entity        ;
79  private   : std::list<Tcomponent_t*> * _list_component;
80
81    // -----[ methods ]---------------------------------------------------
82  public    :                       Component         (Tusage_t usage=USE_ALL);
83  public    :                       Component         (const Component & component);
84  public    :                       ~Component        ();
85
86  public    : Entity *              set_entity        (std::string        name   
87                                                       ,std::string        type 
88#ifdef POSITION
89                                                       ,schema_t      schema
90#endif
91                                                       );
92  private   : std::string           get_entity        (void);
93
94  public    : void                  set_component     (Component * component
95#ifdef POSITION
96                                                       ,uint32_t   pos_x 
97                                                       ,uint32_t   pos_y 
98                                                       ,uint32_t   size_x
99                                                       ,uint32_t   size_y
100#endif
101                                                       ,Tinstance_t instance=INSTANCE_ALL
102                                                       );
103
104  private   : std::string           get_component     (void);
105
106  private   : Entity *              find_entity       (std::string name);
107//private   : Interface *           find_interface    (std::string   name  ,
108//                                                     Entity * entity);
109
110#ifdef VHDL
111  public    : void                  vhdl_instance     (Vhdl * & vhdl);
112#endif
113
114
115  private   : Signal *              signal_internal   (Entity * entity_productor,
116                                                       Signal * signal_productor);
117
118  public    : void                  port_map          (std::string component_src ,
119                                                       std::string port_src      ,
120                                                       std::string component_dest,
121                                                       std::string port_dest    );
122
123  public    : bool                  test_map          (bool recursive=true);
124  private   : bool                  test_map          (uint32_t depth, bool recursive);
125
126#ifdef POSITION
127  public    : void                  interface_map     (std::string component_src ,
128                                                       std::string port_dest,
129                                                       std::string component_dest,
130                                                       std::string port_dest     );
131
132  public    : XML                   toXML             (void);
133
134  public    : void                  generate_file     (void);
135#endif   
136  public    : friend std::ostream&  operator<<        (std::ostream& output_stream,
137                                                       morpheo::behavioural::Component & x);
138  };
139
140}; // end namespace behavioural         
141}; // end namespace morpheo             
142
143#endif
Note: See TracBrowser for help on using the repository browser.