- Timestamp:
- Dec 10, 2008, 7:31:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Signal.h
r82 r88 38 38 UINT64_T } type_info_t; 39 39 40 typedef enum {PORT_VHDL_YES_TESTBENCH_YES, 40 typedef enum {PORT_SYSTEMC_NO , // also, vhdl_no and testbench_no 41 PORT_VHDL_YES_TESTBENCH_YES, 41 42 PORT_VHDL_YES_TESTBENCH_NO , 42 43 PORT_VHDL_NO_TESTBENCH_YES , … … 72 73 73 74 // -----[ methods ]--------------------------------------------------- 74 public : Signal (std::stringname ,75 direction_t direction ,76 uint32_t size ,77 presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES);78 public : Signal (const Signal &);79 public : ~Signal ();75 public : Signal (std::string name , 76 direction_t direction , 77 uint32_t size , 78 presence_port_t presence_port = PORT_VHDL_YES_TESTBENCH_YES); 79 public : Signal (const Signal &); 80 public : ~Signal (); 80 81 81 82 public : std::string get_name (void); … … 93 94 94 95 public : bool test_map (uint32_t depth, bool top_level, bool is_behavioural); 95 // 96 //public : bool test_equi (uint32_t depth); 96 97 97 98 public : void link (Signal * signal_dest, … … 108 109 case IN : {return read_in <T>();} 109 110 case OUT : {return read_out <T>();} 110 default : throw (ErrorMorpheo ("Signal \""+_name+"\" : direction unknow. "));111 default : throw (ErrorMorpheo ("Signal \""+_name+"\" : direction unknow.\n")); 111 112 } 112 113 } … … 122 123 case UINT32_T : return (static_cast<sc_in <uint32_t> *>(_sc_signal_map)->read()); 123 124 case UINT64_T : return (static_cast<sc_in <uint64_t> *>(_sc_signal_map)->read()); 124 default : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow. "));125 default : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.\n")); 125 126 } 126 127 } … … 136 137 case UINT32_T : return (static_cast<sc_out <uint32_t> *>(_sc_signal_map)->read()); 137 138 case UINT64_T : return (static_cast<sc_out <uint64_t> *>(_sc_signal_map)->read()); 138 default : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow. "));139 default : throw (ErrorMorpheo ("Signal \""+_name+"\" : type unknow.\n")); 139 140 } 140 141 } … … 148 149 149 150 if (_type_info != UNKNOW) 150 throw (ErrorMorpheo ( "Signal \""+_name+"\" : already allocate."));151 throw (ErrorMorpheo (toString(_("Signal \"%s\" : already allocate.\n"),_name.c_str()))); 151 152 152 153 if (test<T>(_size) == false) 153 throw (ErrorMorpheo ( "Signal \""+_name+"\" : size is too small to the associate type."));154 throw (ErrorMorpheo (toString(_("Signal \"%s\" : size is too small (%d bits) to the associate type (%d bits).\n"),_name.c_str(),_size,8*sizeof(T)))); 154 155 155 156 _is_allocate = true; … … 157 158 _sc_signal_map = sc_signal; 158 159 159 log_printf(TRACE,Behavioural,FUNCTION, "Allocation of %s - %.8x", _name.c_str(), (uint32_t)(_sc_signal_map));160 161 160 if (typeid(T) == typeid(bool )) 162 161 _type_info = BOOL; … … 175 174 else 176 175 _type_info = UNKNOW; 176 177 log_printf(TRACE,Behavioural,FUNCTION, "Allocation of %s (%s, 0x%.8x)", _name.c_str(),toString(_type_info).c_str(), static_cast<uint32_t>(reinterpret_cast<uint64_t>(_sc_signal_map))); 177 178 178 179 log_printf(FUNC,Behavioural,FUNCTION,"End"); … … 204 205 }; 205 206 }; // end namespace behavioural 207 208 209 206 210 207 211 template<> inline std::string toString<morpheo::behavioural::presence_port_t>(const morpheo::behavioural::presence_port_t& x) … … 221 225 } 222 226 227 typedef enum {UNKNOW , 228 BOOL , 229 UINT8_T , 230 UINT16_T , 231 UINT32_T , 232 UINT64_T } type_info_t; 233 234 template<> inline std::string toString<morpheo::behavioural::type_info_t>(const morpheo::behavioural::type_info_t& x) 235 { 236 switch (x) 237 { 238 case morpheo::behavioural::BOOL : return "bool" ; break; 239 case morpheo::behavioural::UINT8_T : return "uint8_t" ; break; 240 case morpheo::behavioural::UINT16_T : return "uint16_t"; break; 241 case morpheo::behavioural::UINT32_T : return "uint32_t"; break; 242 case morpheo::behavioural::UINT64_T : return "uint64_t"; break; 243 case morpheo::behavioural::UNKNOW : 244 default : return "unknow" ; break; 245 } 246 } 247 223 248 }; // end namespace morpheo 224 249
Note: See TracChangeset
for help on using the changeset viewer.