Changeset 78 for trunk/IPs/systemC/processor/Morpheo/Common
- Timestamp:
- Mar 27, 2008, 11:04:49 AM (17 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Common
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Common/include/Debug.h
r71 r78 9 9 #include <sstream> 10 10 #include <string> 11 12 std::string debug_tab (void); 13 void debug_function_begin (std::string component, std::string function); 14 void debug_function_end (std::string component, std::string function); 11 15 12 16 // Debug's Level : … … 27 31 28 32 #ifdef DEBUG 29 //Debug 30 # define log_printf(level, component, func, str... ) \ 33 # define log_printf(level, component, func, str... ) \ 31 34 do \ 32 35 { \ … … 36 39 ( DEBUG_ ## component == true )) ) \ 37 40 { \ 41 msg(_("%s"),debug_tab().c_str()); \ 38 42 if (DEBUG >= DEBUG_ALL ) \ 39 43 { \ … … 48 52 } \ 49 53 } \ 50 msg(_("<%s> "),func); \51 54 if (DEBUG >= DEBUG_FUNC) \ 52 55 { \ 56 msg(_("<%s> "),func); \ 53 57 msg(_("In file %s, "),__FILE__); \ 54 msg(_("at line %d, "),__LINE__); \ 58 msg(_("at line %d " ),__LINE__); \ 59 msg(_(": ")); \ 55 60 } \ 56 msg(_(": ")); \57 61 msg(str); \ 58 62 msg(_("\n")); \ … … 60 64 } \ 61 65 } while(0) 62 63 66 #else 64 // No debug 65 66 # define log_printf(level, component, func, str... ) \ 67 do \ 68 { \ 69 } while(0) 70 67 # define log_printf(level, component, func, str... ) \ 68 do \ 69 { \ 70 } while(0) 71 71 #endif // DEBUG 72 73 72 #endif // !DEBUG_H -
trunk/IPs/systemC/processor/Morpheo/Common/include/FromString.h
r43 r78 17 17 namespace morpheo { 18 18 19 template<typename T> inline T fromString (const std::string& x)19 template<typename T> inline T fromString (const std::string& x) 20 20 { 21 21 return static_cast<T>(x.c_str()); 22 22 } 23 23 24 template<> inline int fromString<int>(const std::string& x)24 template<> inline uint32_t fromString<uint32_t> (const std::string& x) 25 25 { 26 return atoi(x.c_str()); 26 return static_cast<uint32_t>(atoi(x.c_str())); 27 } 28 29 template<> inline bool fromString<bool> (const std::string& x) 30 { 31 return atoi(x.c_str())!=0; 27 32 } 28 33 -
trunk/IPs/systemC/processor/Morpheo/Common/include/Time.h
r71 r78 34 34 uint32_t nb_cycles = static_cast<uint32_t>(sc_simulation_time()); 35 35 36 double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec );36 double average = static_cast<double>(nb_cycles) / static_cast<double>(time_end.tv_sec-x.time_begin.tv_sec+1); 37 37 38 output_stream << nb_cycles << "\t(" << average << " cycles / seconds)" << std::endl;38 output_stream << "Timing : " << nb_cycles << " cycles \t(" << average << " cycles/s)" << std::endl; 39 39 40 40 return output_stream; -
trunk/IPs/systemC/processor/Morpheo/Common/include/ToString.h
r71 r78 58 58 } 59 59 60 //template<> inline std::string toString< int8_t> (const int8_t& x)61 //{62 //std::ostringstream out("");63 // out << x;64 //return out.str();65 //}60 template<> inline std::string toString< int8_t> (const int8_t& x) 61 { 62 std::ostringstream out(""); 63 out << static_cast< int32_t>(x); 64 return out.str(); 65 } 66 66 67 //template<> inline std::string toString<uint8_t> (const uint8_t& x)68 //{69 //std::ostringstream out("");70 // out << x;71 //return out.str();72 //}67 template<> inline std::string toString<uint8_t> (const uint8_t& x) 68 { 69 std::ostringstream out(""); 70 out << static_cast<uint32_t>(x); 71 return out.str(); 72 } 73 73 74 //template<> inline std::string toString< int16_t> (const int16_t& x)75 //{76 //std::ostringstream out("");77 // out << x;78 //return out.str();79 //}74 template<> inline std::string toString< int16_t> (const int16_t& x) 75 { 76 std::ostringstream out(""); 77 out << static_cast< int32_t>(x); 78 return out.str(); 79 } 80 80 81 //template<> inline std::string toString<uint16_t> (const uint16_t& x)82 //{83 //std::ostringstream out("");84 // out << x;85 //return out.str();86 //}81 template<> inline std::string toString<uint16_t> (const uint16_t& x) 82 { 83 std::ostringstream out(""); 84 out << static_cast<uint32_t>(x); 85 return out.str(); 86 } 87 87 88 //template<> inline std::string toString< int32_t> (const int32_t& x)89 //{90 //std::ostringstream out("");91 //out << x;92 //return out.str();93 //}88 template<> inline std::string toString< int32_t> (const int32_t& x) 89 { 90 std::ostringstream out(""); 91 out << x; 92 return out.str(); 93 } 94 94 95 //template<> inline std::string toString<uint32_t> (const uint32_t& x)96 //{97 //std::ostringstream out("");98 //out << x;99 //return out.str();100 //}95 template<> inline std::string toString<uint32_t> (const uint32_t& x) 96 { 97 std::ostringstream out(""); 98 out << x; 99 return out.str(); 100 } 101 101 102 102 }; // end namespace morpheo -
trunk/IPs/systemC/processor/Morpheo/Common/include/Types.h
r43 r78 16 16 17 17 // Definition of type 18 #if ( defined(SC_CLOCK) || defined(SC_INTERNAL) || defined(SC_SIGNAL) || defined(SC_REGISTER) || defined(SC_IN) || defined(SC_OUT) ) 18 //#if ( defined(SC_CLOCK) || defined(SC_INTERNAL) || defined(SC_SIGNAL) || defined(SC_REGISTER) || defined(SC_IN) || defined(SC_OUT) ) 19 #if ( defined(SC_CLOCK) || defined(SC_IN) || defined(SC_OUT) ) 19 20 # error "A type is already defined" 20 21 #endif … … 23 24 # error "Action is already defined" 24 25 #endif 25 #if ( defined(INTERNAL_READ) || defined(INTERNAL_WRITE) )26 # error "Action is already defined"27 #endif28 #if ( defined(SIGNAL_READ) || defined(SIGNAL_WRITE) )29 # error "Action is already defined"30 #endif31 #if ( defined(REGISTER_READ) || defined(REGISTER_WRITE) )32 # error "Action is already defined"33 #endif26 // #if ( defined(INTERNAL_READ) || defined(INTERNAL_WRITE) ) 27 // # error "Action is already defined" 28 // #endif 29 // #if ( defined(SIGNAL_READ) || defined(SIGNAL_WRITE) ) 30 // # error "Action is already defined" 31 // #endif 32 // #if ( defined(REGISTER_READ) || defined(REGISTER_WRITE) ) 33 // # error "Action is already defined" 34 // #endif 34 35 35 36 #define SC_CLOCK sc_in_clk 36 #define SC_INTERNAL(type) type37 #define SC_REGISTER(type) sc_signal<type >38 #define SC_SIGNAL(type) sc_signal<type >37 // #define SC_INTERNAL(type) type 38 // #define SC_REGISTER(type) sc_signal<type > 39 // #define SC_SIGNAL(type) sc_signal<type > 39 40 #define SC_IN(type) sc_in <type > 40 41 #define SC_OUT(type) sc_out <type > … … 42 43 #define PORT_READ(sig) sig->read() 43 44 #define PORT_WRITE(sig,val) sig->write(val) 44 #define INTERNAL_READ(sig) (*sig)45 #define INTERNAL_WRITE(sig,val) (*sig) = val46 #define SIGNAL_READ(sig) sig->read()47 #define SIGNAL_WRITE(sig,val) sig->write(val)48 #define REGISTER_READ(sig) sig->read()49 #define REGISTER_WRITE(sig,val) sig->write(val)45 // #define INTERNAL_READ(sig) (*sig) 46 // #define INTERNAL_WRITE(sig,val) (*sig) = val 47 // #define SIGNAL_READ(sig) sig->read() 48 // #define SIGNAL_WRITE(sig,val) sig->write(val) 49 // #define REGISTER_READ(sig) sig->read() 50 // #define REGISTER_WRITE(sig,val) sig->write(val) 50 51 51 52 #endif
Note: See TracChangeset
for help on using the changeset viewer.