1/* 2 * Copyright 2018 Google, Inc. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer; 8 * redistributions in binary form must reproduce the above copyright 9 * notice, this list of conditions and the following disclaimer in the 10 * documentation and/or other materials provided with the distribution; 11 * neither the name of the copyright holders nor the names of its 12 * contributors may be used to endorse or promote products derived from 13 * this software without specific prior written permission. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 * Authors: Gabe Black 28 */ 29
| 1/* 2 * Copyright 2018 Google, Inc. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer; 8 * redistributions in binary form must reproduce the above copyright 9 * notice, this list of conditions and the following disclaimer in the 10 * documentation and/or other materials provided with the distribution; 11 * neither the name of the copyright holders nor the names of its 12 * contributors may be used to endorse or promote products derived from 13 * this software without specific prior written permission. 14 * 15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 * Authors: Gabe Black 28 */ 29
|
| 30#include <vector> 31
|
30#include "base/logging.hh"
| 32#include "base/logging.hh"
|
| 33#include "systemc/core/object.hh"
|
31#include "systemc/ext/core/sc_object.hh" 32 33namespace sc_core 34{ 35
| 34#include "systemc/ext/core/sc_object.hh" 35 36namespace sc_core 37{ 38
|
| 39namespace 40{ 41 42std::vector<sc_object *> top_level_objects; 43 44} // anonymous namespace 45
|
36const char * 37sc_object::name() const 38{
| 46const char * 47sc_object::name() const 48{
|
39 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 40 return "sc_object";
| 49 return _gem5_object->name();
|
41} 42 43const char * 44sc_object::basename() const 45{
| 50} 51 52const char * 53sc_object::basename() const 54{
|
46 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 47 return "sc_object";
| 55 return _gem5_object->basename();
|
48} 49
| 56} 57
|
50const char * 51sc_object::kind() const 52{ 53 return "sc_object"; 54} 55
| |
56void 57sc_object::print(std::ostream &out) const 58{
| 58void 59sc_object::print(std::ostream &out) const 60{
|
59 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 61 _gem5_object->print(out);
|
60} 61 62void 63sc_object::dump(std::ostream &out) const 64{
| 62} 63 64void 65sc_object::dump(std::ostream &out) const 66{
|
65 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 67 _gem5_object->dump(out);
|
66} 67 68const std::vector<sc_object *> & 69sc_object::get_child_objects() const 70{
| 68} 69 70const std::vector<sc_object *> & 71sc_object::get_child_objects() const 72{
|
71 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 72 return *(const std::vector<sc_object *> *)nullptr;
| 73 return _gem5_object->get_child_objects();
|
73} 74 75const std::vector<sc_event *> & 76sc_object::get_child_events() const 77{
| 74} 75 76const std::vector<sc_event *> & 77sc_object::get_child_events() const 78{
|
78 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 79 return *(const std::vector<sc_event *> *)nullptr;
| 79 return _gem5_object->get_child_events();
|
80} 81 82sc_object * 83sc_object::get_parent_object() const 84{
| 80} 81 82sc_object * 83sc_object::get_parent_object() const 84{
|
85 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 86 return NULL;
| 85 return _gem5_object->get_parent_object();
|
87} 88 89bool
| 86} 87 88bool
|
90sc_object::add_attribute(sc_attr_base &)
| 89sc_object::add_attribute(sc_attr_base &attr)
|
91{
| 90{
|
92 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 93 return false;
| 91 return _gem5_object->add_attribute(attr);
|
94} 95 96sc_attr_base *
| 92} 93 94sc_attr_base *
|
97sc_object::get_attribute(const std::string &)
| 95sc_object::get_attribute(const std::string &name)
|
98{
| 96{
|
99 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 100 return NULL;
| 97 return _gem5_object->get_attribute(name);
|
101} 102 103sc_attr_base *
| 98} 99 100sc_attr_base *
|
104sc_object::remove_attribute(const std::string &)
| 101sc_object::remove_attribute(const std::string &name)
|
105{
| 102{
|
106 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 107 return NULL;
| 103 return _gem5_object->remove_attribute(name);
|
108} 109 110void 111sc_object::remove_all_attributes() 112{
| 104} 105 106void 107sc_object::remove_all_attributes() 108{
|
113 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 109 return _gem5_object->remove_all_attributes();
|
114} 115 116int 117sc_object::num_attributes() const 118{
| 110} 111 112int 113sc_object::num_attributes() const 114{
|
119 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 120 return 0;
| 115 return _gem5_object->num_attributes();
|
121} 122 123sc_attr_cltn & 124sc_object::attr_cltn() 125{
| 116} 117 118sc_attr_cltn & 119sc_object::attr_cltn() 120{
|
126 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 127 return *(sc_attr_cltn *)NULL;
| 121 return _gem5_object->attr_cltn();
|
128} 129 130const sc_attr_cltn & 131sc_object::attr_cltn() const 132{
| 122} 123 124const sc_attr_cltn & 125sc_object::attr_cltn() const 126{
|
133 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 134 return *(sc_attr_cltn *)NULL;
| 127 return _gem5_object->attr_cltn();
|
135} 136 137sc_simcontext * 138sc_object::simcontext() const 139{
| 128} 129 130sc_simcontext * 131sc_object::simcontext() const 132{
|
140 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 141 return nullptr;
| 133 return _gem5_object->simcontext();
|
142} 143 144sc_object::sc_object() 145{
| 134} 135 136sc_object::sc_object() 137{
|
146 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 138 _gem5_object = new sc_gem5::Object(this);
|
147} 148 149sc_object::sc_object(const char *name) 150{
| 139} 140 141sc_object::sc_object(const char *name) 142{
|
151 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 143 _gem5_object = new sc_gem5::Object(this, name);
|
152} 153
| 144} 145
|
154sc_object::sc_object(const sc_object &arg)
| 146sc_object::sc_object(const sc_object &other)
|
155{
| 147{
|
156 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 148 _gem5_object = new sc_gem5::Object(this, *other._gem5_object);
|
157} 158 159sc_object &
| 149} 150 151sc_object &
|
160sc_object::operator = (const sc_object &)
| 152sc_object::operator = (const sc_object &other)
|
161{
| 153{
|
| 154 *_gem5_object = *other._gem5_object;
|
162 return *this; 163} 164 165sc_object::~sc_object() 166{
| 155 return *this; 156} 157 158sc_object::~sc_object() 159{
|
167 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 160 delete _gem5_object;
|
168} 169 170const std::vector<sc_object *> & 171sc_get_top_level_objects() 172{
| 161} 162 163const std::vector<sc_object *> & 164sc_get_top_level_objects() 165{
|
173 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 174 return *(const std::vector<sc_object *> *)nullptr;
| 166 return sc_gem5::topLevelObjects;
|
175} 176 177sc_object *
| 167} 168 169sc_object *
|
178sc_find_object(const char *)
| 170sc_find_object(const char *name)
|
179{
| 171{
|
180 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 181 return NULL;
| 172 return sc_gem5::findObject(name);
|
182} 183 184} // namespace sc_core
| 173} 174 175} // namespace sc_core
|