source: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Interface.h @ 40

Last change on this file since 40 was 40, checked in by rosiere, 17 years ago

Interface et Signal, c'est deux classes enregistres la valeurs des signaux à chaque cycle ... étape préparatoire avan le changement de la classe Vhdl_Testbench

File size: 4.9 KB
Line 
1#ifndef morpheo_behavioural_Interface_h
2#define morpheo_behavioural_Interface_h
3
4/*
5 * $Id$
6 *
7 * [ Description ]
8 *
9 */
10
11#ifdef SYSTEMC
12#include "systemc.h"
13#endif
14
15#include <stdint.h>
16#include <iostream>
17#include <list>
18#include "Behavioural/include/Signal.h"
19#include "Behavioural/include/Direction.h"
20#include "Behavioural/include/Localisation.h"
21#ifdef VHDL
22#include "Behavioural/include/Vhdl.h"
23#endif
24#ifdef VHDL_TESTBENCH
25#include "Behavioural/include/Vhdl_Testbench.h"
26#endif
27#include "Include/ToString.h"
28#include "Include/ErrorMorpheo.h"
29#include "Include/Debug.h"
30
31using namespace std;
32
33namespace morpheo              {
34namespace behavioural          {
35
36  class Interface
37  {
38    friend class Interfaces;
39
40    // -----[ fields ]----------------------------------------------------
41  protected : const string          _name         ;
42  protected : const direction_t     _direction    ;
43  protected : const localisation_t  _localisation ;
44  protected :       string          _comment      ;
45
46  protected : list<Signal *>      * _list_signal  ;
47
48#ifdef POSITION
49  protected :       bool            _is_map       ;
50  protected :       void          * _entity_map   ; // Entity -> erreur cyclique
51  protected :       void          * _interface_map; // pour être homogène avec _entity_map
52#endif
53
54#ifdef VHDL_TESTBENCH
55  private   : list<string>        * _list_cycle   ;
56#endif
57   
58    // -----[ methods ]---------------------------------------------------
59  public    :                       Interface            (string         name        ,
60                                                          direction_t    direction   ,
61                                                          localisation_t localisation);
62
63  public    :                       Interface            (const Interface    & interface);
64  public    :                       ~Interface           ();
65
66  public    : void                  set_comment          (string comment);
67  protected : string                get_comment          (void          );
68
69  protected : string                signal_name          (string      name_interface,
70                                                          string      name_signal   ,
71                                                          direction_t direction     );
72
73  protected : string                get_signal           (void);
74  public    : Signal *              set_signal           (string          name     ,
75                                                          direction_t     direction,
76                                                          uint32_t        size     ,
77                                                          presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES);
78
79#ifdef SYSTEMC
80  public    : sc_in_clk *           set_signal_clk       (string          name     ,
81                                                          uint32_t        size     ,
82                                                          presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES)
83    {
84      log_printf(FUNC,Behavioural,"set_signal_clk","Begin");
85
86      Signal * sig = set_signal (name, IN , size, presence_port);
87      sc_in_clk * signal = new sc_in_clk (sig->_name.c_str());
88
89      log_printf(FUNC,Behavioural,"set_signal_clk","End");
90
91      return signal;
92    };
93
94  public    : template <typename T>
95              sc_in <T> *           set_signal_in       (string          name     ,
96                                                         uint32_t        size     ,
97                                                         presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES)
98    {
99      log_printf(FUNC,Behavioural,"set_signal_in","Begin");
100
101      Signal * sig = set_signal (name, IN , size, presence_port);
102      sc_in <T> * port = new sc_in <T> (sig->_name.c_str());
103#ifdef VHDL_TESTBENCH
104      sig->alloc<T> (static_cast<void *>(port));
105#endif
106
107      log_printf(FUNC,Behavioural,"set_signal_in","End");
108
109      return port;
110    };
111
112  public    : template <typename T>
113              sc_out <T> *          set_signal_out      (string          name     ,
114                                                         uint32_t        size     ,
115                                                         presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES)
116    {
117      log_printf(FUNC,Behavioural,"set_signal_out","Begin");
118
119      Signal * sig = set_signal (name, OUT , size, presence_port);
120      sc_out <T> * port = new sc_out <T> (sig->_name.c_str());
121#ifdef VHDL_TESTBENCH
122      sig->alloc<T> (static_cast<void *>(port));
123#endif
124
125      log_printf(FUNC,Behavioural,"set_signal_out","End");
126
127      return port;
128    };
129#endif
130
131#ifdef VHDL
132  public    : void                  set_port             (Vhdl * & vhdl);
133#endif
134#ifdef VHDL_TESTBENCH
135  public    : void                  set_port             (Vhdl_Testbench * & vhdl_testbench);
136#endif
137
138#ifdef POSITION
139  public    : void                  port_map             (void * entity,
140                                                          void * interface);
141#endif
142
143#ifdef VHDL_TESTBENCH
144  public    : void                  testbench_cycle      (void);
145  public    : void                  testbench            (Vhdl_Testbench * & vhdl_testbench);
146#endif
147
148  public    : XML                   toXML                (void);
149#ifdef POSITION
150  public    : XML                   toXML_mapping        (void);
151#endif
152  public    : friend ostream&       operator<<           (ostream& output_stream,
153                                                          morpheo::behavioural::Interface & x);
154
155  };
156
157}; // end namespace behavioural         
158}; // end namespace morpheo             
159
160#endif
Note: See TracBrowser for help on using the repository browser.