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 "base/logging.hh" 31#include "systemc/core/channel.hh" 32#include "systemc/core/scheduler.hh"
| 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 "base/logging.hh" 31#include "systemc/core/channel.hh" 32#include "systemc/core/scheduler.hh"
|
| 33#include "systemc/ext/channel/messages.hh"
|
33#include "systemc/ext/core/sc_main.hh" 34#include "systemc/ext/core/sc_prim.hh" 35 36namespace sc_gem5 37{ 38 39uint64_t getChangeStamp() { return scheduler.changeStamp(); } 40 41} // namespace sc_gem5 42 43namespace sc_core 44{ 45 46sc_prim_channel::sc_prim_channel() : _gem5_channel(nullptr) 47{ 48 if (sc_is_running()) {
| 34#include "systemc/ext/core/sc_main.hh" 35#include "systemc/ext/core/sc_prim.hh" 36 37namespace sc_gem5 38{ 39 40uint64_t getChangeStamp() { return scheduler.changeStamp(); } 41 42} // namespace sc_gem5 43 44namespace sc_core 45{ 46 47sc_prim_channel::sc_prim_channel() : _gem5_channel(nullptr) 48{ 49 if (sc_is_running()) {
|
49 SC_REPORT_ERROR("(E113) insert primitive channel failed", 50 "simulation running");
| 50 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "simulation running");
|
51 } 52 if (::sc_gem5::scheduler.elaborationDone()) {
| 51 } 52 if (::sc_gem5::scheduler.elaborationDone()) {
|
53 SC_REPORT_ERROR("(E113) insert primitive channel failed", 54 "elaboration done");
| 53 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "elaboration done");
|
55 } 56 _gem5_channel = new sc_gem5::Channel(this); 57} 58 59sc_prim_channel::sc_prim_channel(const char *_name) : 60 sc_object(_name), _gem5_channel(nullptr) 61{ 62 if (sc_is_running()) {
| 54 } 55 _gem5_channel = new sc_gem5::Channel(this); 56} 57 58sc_prim_channel::sc_prim_channel(const char *_name) : 59 sc_object(_name), _gem5_channel(nullptr) 60{ 61 if (sc_is_running()) {
|
63 SC_REPORT_ERROR("(E113) insert primitive channel failed", 64 "simulation running");
| 62 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "simulation running");
|
65 } 66 if (::sc_gem5::scheduler.elaborationDone()) {
| 63 } 64 if (::sc_gem5::scheduler.elaborationDone()) {
|
67 SC_REPORT_ERROR("(E113) insert primitive channel failed", 68 "elaboration done");
| 65 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "elaboration done");
|
69 } 70 _gem5_channel = new sc_gem5::Channel(this); 71} 72 73sc_prim_channel::~sc_prim_channel() { delete _gem5_channel; } 74 75void 76sc_prim_channel::request_update() 77{ 78 _gem5_channel->requestUpdate(); 79} 80 81void 82sc_prim_channel::async_request_update() 83{ 84 _gem5_channel->asyncRequestUpdate(); 85} 86 87void 88sc_prim_channel::next_trigger() 89{ 90 ::sc_core::next_trigger(); 91} 92 93void 94sc_prim_channel::next_trigger(const sc_event &e) 95{ 96 ::sc_core::next_trigger(e); 97} 98 99void 100sc_prim_channel::next_trigger(const sc_event_or_list &eol) 101{ 102 ::sc_core::next_trigger(eol); 103} 104 105void 106sc_prim_channel::next_trigger(const sc_event_and_list &eal) 107{ 108 ::sc_core::next_trigger(eal); 109} 110 111void 112sc_prim_channel::next_trigger(const sc_time &t) 113{ 114 ::sc_core::next_trigger(t); 115} 116 117void 118sc_prim_channel::next_trigger(double d, sc_time_unit u) 119{ 120 ::sc_core::next_trigger(d, u); 121} 122 123void 124sc_prim_channel::next_trigger(const sc_time &t, const sc_event &e) 125{ 126 ::sc_core::next_trigger(t, e); 127} 128 129void 130sc_prim_channel::next_trigger(double d, sc_time_unit u, const sc_event &e) 131{ 132 ::sc_core::next_trigger(d, u, e); 133} 134 135void 136sc_prim_channel::next_trigger(const sc_time &t, const sc_event_or_list &eol) 137{ 138 ::sc_core::next_trigger(t, eol); 139} 140 141void 142sc_prim_channel::next_trigger( 143 double d, sc_time_unit u, const sc_event_or_list &eol) 144{ 145 ::sc_core::next_trigger(d, u, eol); 146} 147 148void 149sc_prim_channel::next_trigger(const sc_time &t, const sc_event_and_list &eal) 150{ 151 ::sc_core::next_trigger(t, eal); 152} 153 154void 155sc_prim_channel::next_trigger( 156 double d, sc_time_unit u, const sc_event_and_list &eal) 157{ 158 ::sc_core::next_trigger(d, u, eal); 159} 160 161bool 162sc_prim_channel::timed_out() 163{ 164 return ::sc_core::timed_out(); 165} 166 167void 168sc_prim_channel::wait() 169{ 170 ::sc_core::wait(); 171} 172 173void 174sc_prim_channel::wait(int i) 175{ 176 ::sc_core::wait(i); 177} 178 179void 180sc_prim_channel::wait(const sc_event &e) 181{ 182 ::sc_core::wait(e); 183} 184 185void 186sc_prim_channel::wait(const sc_event_or_list &eol) 187{ 188 ::sc_core::wait(eol); 189} 190 191void 192sc_prim_channel::wait(const sc_event_and_list &eal) 193{ 194 ::sc_core::wait(eal); 195} 196 197void 198sc_prim_channel::wait(const sc_time &t) 199{ 200 ::sc_core::wait(t); 201} 202 203void 204sc_prim_channel::wait(double d, sc_time_unit u) 205{ 206 ::sc_core::wait(d, u); 207} 208 209void 210sc_prim_channel::wait(const sc_time &t, const sc_event &e) 211{ 212 ::sc_core::wait(t, e); 213} 214 215void 216sc_prim_channel::wait(double d, sc_time_unit u, const sc_event &e) 217{ 218 ::sc_core::wait(d, u, e); 219} 220 221void 222sc_prim_channel::wait(const sc_time &t, const sc_event_or_list &eol) 223{ 224 ::sc_core::wait(t, eol); 225} 226 227void 228sc_prim_channel::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 229{ 230 ::sc_core::wait(d, u, eol); 231} 232 233void 234sc_prim_channel::wait(const sc_time &t, const sc_event_and_list &eal) 235{ 236 ::sc_core::wait(t, eal); 237} 238 239void 240sc_prim_channel::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 241{ 242 ::sc_core::wait(d, u, eal); 243} 244 245} // namespace sc_core
| 66 } 67 _gem5_channel = new sc_gem5::Channel(this); 68} 69 70sc_prim_channel::~sc_prim_channel() { delete _gem5_channel; } 71 72void 73sc_prim_channel::request_update() 74{ 75 _gem5_channel->requestUpdate(); 76} 77 78void 79sc_prim_channel::async_request_update() 80{ 81 _gem5_channel->asyncRequestUpdate(); 82} 83 84void 85sc_prim_channel::next_trigger() 86{ 87 ::sc_core::next_trigger(); 88} 89 90void 91sc_prim_channel::next_trigger(const sc_event &e) 92{ 93 ::sc_core::next_trigger(e); 94} 95 96void 97sc_prim_channel::next_trigger(const sc_event_or_list &eol) 98{ 99 ::sc_core::next_trigger(eol); 100} 101 102void 103sc_prim_channel::next_trigger(const sc_event_and_list &eal) 104{ 105 ::sc_core::next_trigger(eal); 106} 107 108void 109sc_prim_channel::next_trigger(const sc_time &t) 110{ 111 ::sc_core::next_trigger(t); 112} 113 114void 115sc_prim_channel::next_trigger(double d, sc_time_unit u) 116{ 117 ::sc_core::next_trigger(d, u); 118} 119 120void 121sc_prim_channel::next_trigger(const sc_time &t, const sc_event &e) 122{ 123 ::sc_core::next_trigger(t, e); 124} 125 126void 127sc_prim_channel::next_trigger(double d, sc_time_unit u, const sc_event &e) 128{ 129 ::sc_core::next_trigger(d, u, e); 130} 131 132void 133sc_prim_channel::next_trigger(const sc_time &t, const sc_event_or_list &eol) 134{ 135 ::sc_core::next_trigger(t, eol); 136} 137 138void 139sc_prim_channel::next_trigger( 140 double d, sc_time_unit u, const sc_event_or_list &eol) 141{ 142 ::sc_core::next_trigger(d, u, eol); 143} 144 145void 146sc_prim_channel::next_trigger(const sc_time &t, const sc_event_and_list &eal) 147{ 148 ::sc_core::next_trigger(t, eal); 149} 150 151void 152sc_prim_channel::next_trigger( 153 double d, sc_time_unit u, const sc_event_and_list &eal) 154{ 155 ::sc_core::next_trigger(d, u, eal); 156} 157 158bool 159sc_prim_channel::timed_out() 160{ 161 return ::sc_core::timed_out(); 162} 163 164void 165sc_prim_channel::wait() 166{ 167 ::sc_core::wait(); 168} 169 170void 171sc_prim_channel::wait(int i) 172{ 173 ::sc_core::wait(i); 174} 175 176void 177sc_prim_channel::wait(const sc_event &e) 178{ 179 ::sc_core::wait(e); 180} 181 182void 183sc_prim_channel::wait(const sc_event_or_list &eol) 184{ 185 ::sc_core::wait(eol); 186} 187 188void 189sc_prim_channel::wait(const sc_event_and_list &eal) 190{ 191 ::sc_core::wait(eal); 192} 193 194void 195sc_prim_channel::wait(const sc_time &t) 196{ 197 ::sc_core::wait(t); 198} 199 200void 201sc_prim_channel::wait(double d, sc_time_unit u) 202{ 203 ::sc_core::wait(d, u); 204} 205 206void 207sc_prim_channel::wait(const sc_time &t, const sc_event &e) 208{ 209 ::sc_core::wait(t, e); 210} 211 212void 213sc_prim_channel::wait(double d, sc_time_unit u, const sc_event &e) 214{ 215 ::sc_core::wait(d, u, e); 216} 217 218void 219sc_prim_channel::wait(const sc_time &t, const sc_event_or_list &eol) 220{ 221 ::sc_core::wait(t, eol); 222} 223 224void 225sc_prim_channel::wait(double d, sc_time_unit u, const sc_event_or_list &eol) 226{ 227 ::sc_core::wait(d, u, eol); 228} 229 230void 231sc_prim_channel::wait(const sc_time &t, const sc_event_and_list &eal) 232{ 233 ::sc_core::wait(t, eal); 234} 235 236void 237sc_prim_channel::wait(double d, sc_time_unit u, const sc_event_and_list &eal) 238{ 239 ::sc_core::wait(d, u, eal); 240} 241 242} // namespace sc_core
|