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
RevLine 
[42]1#ifndef morpheo_behavioural_Component_h
2#define morpheo_behavioural_Component_h
[31]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>
[42]14#include <map>
15#ifdef VHDL
16#include "Behavioural/include/Vhdl.h"
17#endif
18//#include "Behavioural/include/Description.h"
[31]19#include "Behavioural/include/Entity.h"
[44]20#include "Common/include/ToString.h"
21#include "Common/include/Debug.h"
[57]22#include "Behavioural/include/Usage.h"
[31]23
24namespace morpheo              {
25namespace behavioural          {
26
[78]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
[57]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  {
[78]69//public : Component * _component;
70  public : Entity    * _entity   ;
71  public : Tinstance_t _instance ;
[57]72  } Tcomponent_t;   
73 
[42]74  class Component
[31]75  {
76    // -----[ fields ]----------------------------------------------------
[78]77  private   : const Tusage_t             _usage;
78  private   : Entity                   * _entity        ;
[75]79  private   : std::list<Tcomponent_t*> * _list_component;
[57]80
[31]81    // -----[ methods ]---------------------------------------------------
[57]82  public    :                       Component         (Tusage_t usage=USE_ALL);
[42]83  public    :                       Component         (const Component & component);
84  public    :                       ~Component        ();
[31]85
[71]86  public    : Entity *              set_entity        (std::string        name   
87                                                       ,std::string        type 
[42]88#ifdef POSITION
89                                                       ,schema_t      schema
90#endif
91                                                       );
[78]92  private   : std::string           get_entity        (void);
[31]93
[42]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
[57]101                                                       ,Tinstance_t instance=INSTANCE_ALL
[42]102                                                       );
[31]103
[78]104  private   : std::string           get_component     (void);
[31]105
[71]106  private   : Entity *              find_entity       (std::string name);
107//private   : Interface *           find_interface    (std::string   name  ,
[62]108//                                                     Entity * entity);
[31]109
[42]110#ifdef VHDL
111  public    : void                  vhdl_instance     (Vhdl * & vhdl);
112#endif
113
[62]114
115  private   : Signal *              signal_internal   (Entity * entity_productor,
116                                                       Signal * signal_productor);
117
[71]118  public    : void                  port_map          (std::string component_src ,
119                                                       std::string port_src      ,
120                                                       std::string component_dest,
121                                                       std::string port_dest    );
[42]122
[78]123  public    : bool                  test_map          (bool recursive=true);
124  private   : bool                  test_map          (uint32_t depth, bool recursive);
[62]125
[42]126#ifdef POSITION
[71]127  public    : void                  interface_map     (std::string component_src ,
128                                                       std::string port_dest,
129                                                       std::string component_dest,
130                                                       std::string port_dest     );
[42]131
132  public    : XML                   toXML             (void);
133
[31]134  public    : void                  generate_file     (void);
[42]135#endif   
[78]136  public    : friend std::ostream&  operator<<        (std::ostream& output_stream,
137                                                       morpheo::behavioural::Component & x);
[31]138  };
139
140}; // end namespace behavioural         
141}; // end namespace morpheo             
142
143#endif
Note: See TracBrowser for help on using the repository browser.