source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Signal.cpp

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

1) Add modelsim simulation systemC
2) Modelsim cosimulation systemC / VHDL is not finish !!!! (cf execute_queue and write_unit)
3) Add multi architecture
5) Add template for comparator, multiplier and divider
6) Change Message
Warning) Various test macro have change, many selftest can't compile

  • Property svn:keywords set to Id
File size: 4.4 KB
Line 
1/*
2 * $Id: Signal.cpp 113 2009-04-14 18:39:12Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/include/Signal.h"
9
10namespace morpheo              {
11namespace behavioural          {
12
13  Signal::Signal  (std::string     name         ,
14                   direction_t     direction    ,
15                   uint32_t        size         ,
16                   presence_port_t presence_port):
17    _name          (name         ),
18    _direction     (direction    ),
19    _presence_port ((direction==INTERNAL)?PORT_VHDL_NO_TESTBENCH_NO:presence_port)
20  {
21    log_printf(FUNC,Behavioural,"Signal","Begin");
22
23    _is_allocate              = false;
24    _is_map_as_component_src  = false;
25    _is_map_as_component_dest = false;
26    _is_map_as_toplevel_dest  = false;
27    _connect_from_signal      = NULL;
28    _connect_to_signal        = NULL;
29    _sc_signal                = NULL;
30    _sc_signal_map            = NULL;
31    _type_info                = UNKNOW;
32#ifdef VHDL_TESTBENCH
33    _list_value          = new std::list<std::string>;
34#endif
35    set_size(size);
36   
37    if (_size == 0)
38      throw ERRORMORPHEO(FUNCTION,"Size of signal '"+_name+"' is nul");
39
40    log_printf(FUNC,Behavioural,"Signal","End");
41  };
42
43  Signal::Signal  (const Signal & signal):
44    _name          (signal._name         ),
45    _direction     (signal._direction    ),
46    _presence_port (signal._presence_port)
47  {
48    log_printf(FUNC,Behavioural,"Signal (copy)","Begin");
49    _size                     = signal._size;
50    _is_allocate              = signal._is_allocate;
51    _is_map_as_component_src  = signal._is_map_as_component_src ;
52    _is_map_as_component_dest = signal._is_map_as_component_dest;
53    _is_map_as_toplevel_dest  = signal._is_map_as_component_dest;
54    _connect_from_signal      = signal._connect_from_signal;
55    _connect_to_signal        = signal._connect_to_signal;
56    _sc_signal                = signal._sc_signal    ;
57    _sc_signal_map            = signal._sc_signal_map;
58    _type_info                = signal._type_info ;
59#ifdef VHDL_TESTBENCH
60    _list_value               = signal._list_value;
61#endif
62    log_printf(FUNC,Behavioural,"Signal (copy)","End");
63  };
64
65  Signal::~Signal ()
66  {
67    log_printf(FUNC,Behavioural,"~Signal","Begin");
68
69//     if (_is_allocate == true)
70//       switch (_direction)
71//      {
72//      case IN :
73//        {
74//          switch (_type_info)
75//            {
76//            case BOOL     : {delete (static_cast<sc_in  <bool    > *>(_sc_signal)); break;}
77//            case UINT8_T  : {delete (static_cast<sc_in  <uint8_t > *>(_sc_signal)); break;}
78//            case UINT16_T : {delete (static_cast<sc_in  <uint16_t> *>(_sc_signal)); break;}
79//            case UINT32_T : {delete (static_cast<sc_in  <uint32_t> *>(_sc_signal)); break;}
80//            case UINT64_T : {delete (static_cast<sc_in  <uint64_t> *>(_sc_signal)); break;}
81//            default       : {throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.")); break;}
82//            }
83//          break;
84//        }
85//      case OUT :
86//        {
87//          switch (_type_info)
88//            {
89//            case BOOL     : {delete (static_cast<sc_out <bool    > *>(_sc_signal)); break;}
90//            case UINT8_T  : {delete (static_cast<sc_out <uint8_t > *>(_sc_signal)); break;}
91//            case UINT16_T : {delete (static_cast<sc_out <uint16_t> *>(_sc_signal)); break;}
92//            case UINT32_T : {delete (static_cast<sc_out <uint32_t> *>(_sc_signal)); break;}
93//            case UINT64_T : {delete (static_cast<sc_out <uint64_t> *>(_sc_signal)); break;}
94//            default       : {throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.")); break;}
95//            }
96//          break;
97//        }
98//      case INTERNAL :
99//        {
100//          switch (_type_info)
101//            {
102//            case BOOL     : {delete (static_cast<sc_sc_signal <bool    > *>(_sc_signal)); break;}
103//            case UINT8_T  : {delete (static_cast<sc_sc_signal <uint8_t > *>(_sc_signal)); break;}
104//            case UINT16_T : {delete (static_cast<sc_sc_signal <uint16_t> *>(_sc_signal)); break;}
105//            case UINT32_T : {delete (static_cast<sc_sc_signal <uint32_t> *>(_sc_signal)); break;}
106//            case UINT64_T : {delete (static_cast<sc_sc_signal <uint64_t> *>(_sc_signal)); break;}
107//            default       : {throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.")); break;}
108//            }
109//          break;
110//        }
111//      default       : {throw (ErrorMorpheo ("Signal \""+_name+"\" : direction unknow.")); break;}
112//      }
113
114#ifdef VHDL_TESTBENCH
115    delete _list_value;
116#endif
117    log_printf(FUNC,Behavioural,"~Signal","End");
118  };
119
120}; // end namespace behavioural         
121}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.