Changeset 52 for sources/src/sc_interface.cc
- Timestamp:
- Jan 22, 2013, 4:23:22 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sources/src/sc_interface.cc
r31 r52 34 34 */ 35 35 36 #include <iostream> 37 #include <map> 38 #include <cstdlib> //exit 39 36 40 #include "sc_interface.h" 37 41 #include "sc_event.h" 38 42 #include "assert.h" 39 #include <iostream> 40 #include <map> 43 41 44 #ifdef HAVE_CONFIG_H 42 45 #include "config.h" 43 46 #endif 44 #include <cstdlib> //exit45 47 46 48 using namespace std; 47 49 48 50 namespace sc_core { 51 49 52 struct interface_infos_t { 50 size_t data_size_in_bytes; 51 sc_event default_event; 52 interface_infos_t () 53 { 54 exit(12); 55 } 56 interface_infos_t (size_t s, sc_event e) 57 : data_size_in_bytes(s), default_event (e) 58 { 59 } 53 size_t data_size_in_bytes; 54 sc_event default_event; 55 interface_infos_t() { 56 exit(12); 57 } 58 interface_infos_t (size_t s, sc_event e) : data_size_in_bytes(s), default_event(e) {} 60 59 }; 61 typedef std::map<const sc_interface*,interface_infos_t> interface2infos_t; 60 61 typedef std::map<const sc_interface *,interface_infos_t> interface2infos_t; 62 62 static interface2infos_t interface2infos; 63 63 64 } 64 65 … … 71 72 // ---------------------------------------------------------------------------- 72 73 73 #if 0 74 static 75 ostream& 76 operator << (ostream &o, 77 const sc_interface &i) 78 { 79 return o << hex << &i; 80 } 81 #endif 82 83 /* 84 void 85 sc_interface::register_port (sc_port_base & port_, const char *if_typename_) 86 { 87 } 88 */ 89 90 sc_interface::~sc_interface () 91 {} 74 sc_interface::~sc_interface() {} 92 75 93 76 // constructor 94 sc_interface::sc_interface () 95 { 77 sc_interface::sc_interface() { 96 78 pointer = NULL; // => not assigned 97 79 } 98 80 99 void 100 sc_interface::init (size_t s) const 101 { 102 interface2infos_t::value_type pair (this, 103 interface_infos_t (s,sc_event (*this, sc_event::VAL))); 104 interface2infos.insert (pair); 81 82 void sc_interface::init (size_t s) const { 83 interface2infos_t::value_type pair (this, interface_infos_t(s,sc_event (*this, sc_event::VAL))); 84 interface2infos.insert(pair); 105 85 } 106 86 107 size_t 108 sc_interface::data_size_in_bytes () const 109 { 110 interface2infos_t::iterator i = interface2infos.find (this); 87 size_t sc_interface::data_size_in_bytes () const { 88 interface2infos_t::iterator i = interface2infos.find(this); 111 89 #ifdef CONFIG_DEBUG 112 if (i == interface2infos.end()) {113 114 115 90 if (i == interface2infos.end()) { 91 cerr << "Internal error : can't find data size of " << this << "\n"; 92 exit (90); 93 } 116 94 #endif 117 95 return i->second.data_size_in_bytes; 118 96 } 119 97 120 const sc_event & 121 sc_interface::default_event () const 122 { 123 interface2infos_t::iterator i = interface2infos.find (this); 98 99 const sc_event & sc_interface::default_event () const { 100 interface2infos_t::iterator i = interface2infos.find(this); 124 101 #ifdef CONFIG_DEBUG 125 126 127 128 102 if (i == interface2infos.end ()) { 103 cerr << "Internal error : can't find default event of " << this << "\n"; 104 exit (90); 105 } 129 106 #endif 130 107 return i->second.default_event; 131 108 } 132 109 110 111 /* 112 # Local Variables: 113 # tab-width: 4; 114 # c-basic-offset: 4; 115 # c-file-offsets:((innamespace . 0)(inline-open . 0)); 116 # indent-tabs-mode: nil; 117 # End: 118 # 119 # vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 120 */ 121
Note: See TracChangeset
for help on using the changeset viewer.