kernel.cc (13185:286a48639227) | kernel.cc (13188:7af408b60cac) |
---|---|
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 --- 80 unchanged lines hidden (view full) --- 89} 90 91void 92Kernel::regStats() 93{ 94 if (scMainDone || stopAfterCallbacks) 95 return; 96 | 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 --- 80 unchanged lines hidden (view full) --- 89} 90 91void 92Kernel::regStats() 93{ 94 if (scMainDone || stopAfterCallbacks) 95 return; 96 |
97 for (auto m: sc_gem5::allModules) 98 for (auto p: m->ports) 99 p->_gem5Finalize(); | 97 try { 98 for (auto m: sc_gem5::allModules) 99 for (auto p: m->ports) 100 p->_gem5Finalize(); |
100 | 101 |
101 status(::sc_core::SC_END_OF_ELABORATION); 102 for (auto m: sc_gem5::allModules) { 103 callbackModule(m); 104 m->sc_mod()->end_of_elaboration(); 105 for (auto p: m->ports) 106 p->end_of_elaboration(); 107 for (auto e: m->exports) 108 e->end_of_elaboration(); | 102 status(::sc_core::SC_END_OF_ELABORATION); 103 for (auto m: sc_gem5::allModules) { 104 callbackModule(m); 105 m->sc_mod()->end_of_elaboration(); 106 for (auto p: m->ports) 107 p->end_of_elaboration(); 108 for (auto e: m->exports) 109 e->end_of_elaboration(); 110 } 111 callbackModule(nullptr); 112 for (auto c: sc_gem5::allChannels) 113 c->sc_chan()->end_of_elaboration(); 114 } catch (...) { 115 ::sc_gem5::scheduler.throwToScMain(); |
109 } | 116 } |
110 callbackModule(nullptr); 111 for (auto c: sc_gem5::allChannels) 112 c->sc_chan()->end_of_elaboration(); | 117 118 ::sc_gem5::scheduler.elaborationDone(true); |
113} 114 115void 116Kernel::startup() 117{ 118 if (scMainDone) 119 return; 120 121 schedule(t0Event, curTick()); 122 123 if (stopAfterCallbacks) 124 return; 125 | 119} 120 121void 122Kernel::startup() 123{ 124 if (scMainDone) 125 return; 126 127 schedule(t0Event, curTick()); 128 129 if (stopAfterCallbacks) 130 return; 131 |
126 status(::sc_core::SC_START_OF_SIMULATION); 127 for (auto m: sc_gem5::allModules) { 128 m->sc_mod()->start_of_simulation(); 129 for (auto p: m->ports) 130 p->start_of_simulation(); 131 for (auto e: m->exports) 132 e->start_of_simulation(); | 132 try { 133 status(::sc_core::SC_START_OF_SIMULATION); 134 for (auto m: sc_gem5::allModules) { 135 m->sc_mod()->start_of_simulation(); 136 for (auto p: m->ports) 137 p->start_of_simulation(); 138 for (auto e: m->exports) 139 e->start_of_simulation(); 140 } 141 callbackModule(nullptr); 142 for (auto c: sc_gem5::allChannels) 143 c->sc_chan()->start_of_simulation(); 144 } catch (...) { 145 ::sc_gem5::scheduler.throwToScMain(); |
133 } | 146 } |
134 for (auto c: sc_gem5::allChannels) 135 c->sc_chan()->start_of_simulation(); | |
136 137 startComplete = true; 138 139 if (stopAfterCallbacks) 140 stopWork(); 141 142 kernel->status(::sc_core::SC_RUNNING); 143} --- 6 unchanged lines hidden (view full) --- 150 else 151 stopWork(); 152} 153 154void 155Kernel::stopWork() 156{ 157 status(::sc_core::SC_END_OF_SIMULATION); | 147 148 startComplete = true; 149 150 if (stopAfterCallbacks) 151 stopWork(); 152 153 kernel->status(::sc_core::SC_RUNNING); 154} --- 6 unchanged lines hidden (view full) --- 161 else 162 stopWork(); 163} 164 165void 166Kernel::stopWork() 167{ 168 status(::sc_core::SC_END_OF_SIMULATION); |
158 for (auto m: sc_gem5::allModules) { 159 m->sc_mod()->end_of_simulation(); 160 for (auto p: m->ports) 161 p->end_of_simulation(); 162 for (auto e: m->exports) 163 e->end_of_simulation(); | 169 try { 170 for (auto m: sc_gem5::allModules) { 171 m->sc_mod()->end_of_simulation(); 172 for (auto p: m->ports) 173 p->end_of_simulation(); 174 for (auto e: m->exports) 175 e->end_of_simulation(); 176 } 177 callbackModule(nullptr); 178 for (auto c: sc_gem5::allChannels) 179 c->sc_chan()->end_of_simulation(); 180 } catch (...) { 181 ::sc_gem5::scheduler.throwToScMain(); |
164 } | 182 } |
165 for (auto c: sc_gem5::allChannels) 166 c->sc_chan()->end_of_simulation(); | |
167 168 endComplete = true; 169 170 status(::sc_core::SC_STOPPED); 171} 172 173void 174Kernel::t0Handler() --- 23 unchanged lines hidden --- | 183 184 endComplete = true; 185 186 status(::sc_core::SC_STOPPED); 187} 188 189void 190Kernel::t0Handler() --- 23 unchanged lines hidden --- |