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

Last change on this file since 71 was 71, checked in by rosiere, 16 years ago

Modification of Statisctics
Add a new systemC component : Load_Store_Queue (tested with one benchmark and one configuration). Store don't supported the Data Buss Error (Load is supported)

File size: 7.6 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#include "Common/include/ChangeCase.h"
25#include "Common/include/ToString.h"
26#include "Common/include/ErrorMorpheo.h"
27#include "Common/include/Debug.h"
28#include "Behavioural/include/Usage.h"
29
30namespace morpheo              {
31namespace behavioural          {
32
33  class Interface
34  {
35    // -----[ fields ]----------------------------------------------------
36  protected : const std::string          _name         ;
37#ifdef POSITION
38  protected : const direction_t     _direction    ;
39  protected : const localisation_t  _localisation ;
40#endif
41  protected : const Tusage_t        _usage;
42
43#ifdef POSITION
44  protected :       std::string          _comment      ;
45#endif
46
47  protected : list<Signal *>      * _list_signal  ;
48
49#ifdef POSITION
50  protected :       bool            _is_map       ;
51  protected :       void          * _entity_map   ; // Entity -> erreur cyclique
52  protected :       void          * _interface_map; // pour être homogène avec _entity_map
53#endif
54
55#ifdef VHDL_TESTBENCH
56  private   : uint32_t              _nb_cycle     ;
57#endif
58   
59    // -----[ methods ]---------------------------------------------------
60  public    :                       Interface            (std::string         name       
61#ifdef POSITION
62                                                          ,direction_t    direction   
63                                                          ,localisation_t localisation
64#endif
65                                                          ,Tusage_t       usage=USE_ALL
66                                                          );
67
68  public    :                       Interface            (const Interface    & interface);
69  public    :                       ~Interface           ();
70
71  public    : std::string                get_name             ();
72
73#ifdef POSITION
74  public    : void                  set_comment          (std::string comment);
75  protected : std::string                get_comment          (void          );
76#endif
77
78  protected : std::string                signal_name          (std::string      name_interface,
79                                                          std::string      name_signal   ,
80                                                          direction_t direction     );
81
82  public    : Signal *              find_signal          (std::string name);
83  public    : bool                  find_signal          (Signal * signal);
84
85  protected : std::string                get_signal           (void);
86  public    : Signal *              set_signal           (std::string          name     ,
87                                                          direction_t     direction,
88                                                          uint32_t        size     ,
89                                                          presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES);
90  public    : list<Signal *>      * get_signal_list      (void);
91
92#ifdef SYSTEMC
93  public    : sc_in_clk *           set_signal_clk       (std::string          name     ,
94                                                          uint32_t        size     ,
95                                                          presence_port_t presence_port=CLOCK_VHDL_YES)
96    {
97      log_printf(FUNC,Behavioural,"set_signal_clk","Begin");
98
99      if ((presence_port != CLOCK_VHDL_YES) and
100          (presence_port != CLOCK_VHDL_NO ))
101        throw ErrorMorpheo ("Signal \""+name+"\" is a clock, bad presence_port.");
102
103      Signal    * sig  = set_signal (name, IN , size, presence_port);
104      sc_in_clk * port;
105
106      if (_usage & USE_SYSTEMC)
107        {
108          port = new sc_in_clk (sig->_name.c_str());
109          sig->alloc<bool> (static_cast<void *>(port));
110        }
111      else
112        {
113          port = NULL;
114        }
115
116      log_printf(FUNC,Behavioural,"set_signal_clk","End");
117
118      return port;
119    };
120
121  public    : template <typename T>
122              sc_in <T> *           set_signal_in       (std::string          name     ,
123                                                         uint32_t        size     ,
124                                                         presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES)
125    {
126      log_printf(FUNC,Behavioural,"set_signal_in","Begin");
127
128      if ((presence_port == CLOCK_VHDL_YES) or
129          (presence_port == CLOCK_VHDL_NO ))
130        throw ErrorMorpheo ("Signal \""+name+"\" is not a clock, bad presence_port.");
131
132      Signal    * sig  = set_signal (name, IN , size, presence_port);
133      sc_in <T> * port;
134
135      if (_usage & USE_SYSTEMC)
136        {
137          port = new sc_in <T> (sig->_name.c_str());
138          sig->alloc<T> (static_cast<void *>(port));
139        }
140      else
141        {
142          port = NULL;
143        }
144
145      log_printf(FUNC,Behavioural,"set_signal_in","End");
146
147      return port;
148    };
149
150  public    : template <typename T>
151              sc_out <T> *          set_signal_out      (std::string          name     ,
152                                                         uint32_t        size     ,
153                                                         presence_port_t presence_port=PORT_VHDL_YES_TESTBENCH_YES)
154    {
155      log_printf(FUNC,Behavioural,"set_signal_out","Begin");
156
157      if ((presence_port == CLOCK_VHDL_YES) or
158          (presence_port == CLOCK_VHDL_NO ))
159        throw ErrorMorpheo ("Signal \""+name+"\" is not a clock, bad presence_port.");
160
161      Signal * sig = set_signal (name, OUT , size, presence_port);
162      sc_out <T> * port;
163
164      if (_usage & USE_SYSTEMC)
165        {
166          port = new sc_out <T> (sig->_name.c_str());
167          sig->alloc<T> (static_cast<void *>(port));
168        }
169      else
170        {
171          port = NULL;
172        }
173
174      log_printf(FUNC,Behavioural,"set_signal_out","End");
175
176      return port;
177    };
178
179  public    : template <typename T>
180              sc_signal <T> *       set_signal_internal (std::string   name,
181                                                         uint32_t size)
182    {
183      log_printf(FUNC,Behavioural,"set_signal_internal","Begin");
184
185      Signal * sig = set_signal (name, INTERNAL , size, PORT_VHDL_NO_TESTBENCH_NO);
186      sc_signal <T> * port;
187
188      if (_usage & USE_SYSTEMC)
189        {
190          port = new sc_signal <T> (sig->_name.c_str());
191          sig->alloc<T> (static_cast<void *>(port));
192        }
193      else
194        {
195          port = NULL;
196        }
197
198      log_printf(FUNC,Behavioural,"set_signal_internal","End");
199
200      return port;
201    };
202
203#endif
204
205#ifdef VHDL
206  public    : void                  set_port             (Vhdl * & vhdl);
207#  ifdef VHDL_TESTBENCH
208  public    : void                  set_signal           (Vhdl * & vhdl);
209  public    : void                  get_signal           (list<std::string> * & list_signal);
210#  endif
211#endif
212#ifdef VHDL_TESTBENCH
213  public    : uint32_t              get_cycle            (void);
214  public    : Signal *              get_clock            (void);
215  public    : Signal *              get_reset            (void);
216
217  public    : void                  testbench            (void);
218  public    : void                  testbench_cycle      (void);
219  public    : void                  testbench_body       (Vhdl           * & vhdl          ,
220                                                          std::string             counter_name  ,
221                                                          std::string             reset_name    );
222  public    : std::string                testbench_test       (Vhdl           * & vhdl        ,
223                                                          std::string             counter_name,
224                                                          std::string             reset_name);
225  public    : std::string                testbench_test_ok    (Vhdl           * & vhdl        );
226  protected : std::string                testbench_test_name   (Vhdl           * & vhdl);
227  protected : std::string                testbench_test_ok_name(Vhdl           * & vhdl);
228  protected : std::string                testbench_test_transaction_name(Vhdl           * & vhdl);
229#endif
230
231  public    : bool                  test_map             (bool top_level);
232
233#ifdef POSITION
234  public    : void                  interface_map        (void * entity,
235                                                          void * interface);
236  public    : XML                   toXML                (void);
237  public    : XML                   toXML_mapping        (void);
238#endif
239  public    : friend ostream&       operator<<           (ostream& output_stream,
240                                                          morpheo::behavioural::Interface & x);
241
242  };
243
244}; // end namespace behavioural         
245}; // end namespace morpheo             
246
247#endif
Note: See TracBrowser for help on using the repository browser.