kernel.cc (13130:e67ad27f0858) | kernel.cc (13156:b3185074b0df) |
---|---|
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 --- 72 unchanged lines hidden (view full) --- 81 for (auto p: m->ports) 82 p->before_end_of_elaboration(); 83 for (auto e: m->exports) 84 e->before_end_of_elaboration(); 85 } 86 callbackModule(nullptr); 87 for (auto c: sc_gem5::allChannels) 88 c->sc_chan()->before_end_of_elaboration(); | 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 --- 72 unchanged lines hidden (view full) --- 81 for (auto p: m->ports) 82 p->before_end_of_elaboration(); 83 for (auto e: m->exports) 84 e->before_end_of_elaboration(); 85 } 86 callbackModule(nullptr); 87 for (auto c: sc_gem5::allChannels) 88 c->sc_chan()->before_end_of_elaboration(); |
89 90 if (stopAfterCallbacks) 91 stopWork(); | |
92} 93 94void 95Kernel::regStats() 96{ | 89} 90 91void 92Kernel::regStats() 93{ |
97 if (scMainDone) | 94 if (scMainDone || stopAfterCallbacks) |
98 return; 99 100 for (auto m: sc_gem5::allModules) 101 for (auto p: m->ports) 102 p->_gem5Finalize(); 103 104 status(::sc_core::SC_END_OF_ELABORATION); 105 for (auto m: sc_gem5::allModules) { 106 callbackModule(m); 107 m->sc_mod()->end_of_elaboration(); 108 for (auto p: m->ports) 109 p->end_of_elaboration(); 110 for (auto e: m->exports) 111 e->end_of_elaboration(); 112 } 113 callbackModule(nullptr); 114 for (auto c: sc_gem5::allChannels) 115 c->sc_chan()->end_of_elaboration(); | 95 return; 96 97 for (auto m: sc_gem5::allModules) 98 for (auto p: m->ports) 99 p->_gem5Finalize(); 100 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(); 109 } 110 callbackModule(nullptr); 111 for (auto c: sc_gem5::allChannels) 112 c->sc_chan()->end_of_elaboration(); |
116 117 if (stopAfterCallbacks) 118 stopWork(); | |
119} 120 121void 122Kernel::startup() 123{ 124 if (scMainDone) 125 return; 126 | 113} 114 115void 116Kernel::startup() 117{ 118 if (scMainDone) 119 return; 120 |
121 schedule(t0Event, curTick()); 122 123 if (stopAfterCallbacks) 124 return; 125 |
|
127 status(::sc_core::SC_START_OF_SIMULATION); 128 for (auto m: sc_gem5::allModules) { 129 m->sc_mod()->start_of_simulation(); 130 for (auto p: m->ports) 131 p->start_of_simulation(); 132 for (auto e: m->exports) 133 e->start_of_simulation(); 134 } 135 for (auto c: sc_gem5::allChannels) 136 c->sc_chan()->start_of_simulation(); 137 138 startComplete = true; 139 140 if (stopAfterCallbacks) 141 stopWork(); 142 143 kernel->status(::sc_core::SC_RUNNING); 144 | 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(); 133 } 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 |
145 schedule(t0Event, curTick()); | |
146 // Run update once before the event queue starts. 147 ::sc_gem5::scheduler.update(); 148} 149 150void 151Kernel::stop() 152{ 153 if (status() < ::sc_core::SC_RUNNING) --- 19 unchanged lines hidden (view full) --- 173 endComplete = true; 174 175 status(::sc_core::SC_STOPPED); 176} 177 178void 179Kernel::t0Handler() 180{ | 144 // Run update once before the event queue starts. 145 ::sc_gem5::scheduler.update(); 146} 147 148void 149Kernel::stop() 150{ 151 if (status() < ::sc_core::SC_RUNNING) --- 19 unchanged lines hidden (view full) --- 171 endComplete = true; 172 173 status(::sc_core::SC_STOPPED); 174} 175 176void 177Kernel::t0Handler() 178{ |
181 ::sc_gem5::scheduler.initPhase(); 182 183 status(::sc_core::SC_RUNNING); | 179 if (stopAfterCallbacks) { 180 scheduler.clear(); 181 ::sc_gem5::scheduler.initPhase(); 182 scheduler.scheduleStop(false); 183 } else { 184 ::sc_gem5::scheduler.initPhase(); 185 status(::sc_core::SC_RUNNING); 186 } |
184} 185 186Kernel *kernel; 187 188} // namespace sc_gem5 189 190sc_gem5::Kernel * 191SystemC_KernelParams::create() 192{ 193 panic_if(sc_gem5::kernel, 194 "Only one systemc kernel object may be defined.\n"); 195 sc_gem5::kernel = new sc_gem5::Kernel(this); 196 return sc_gem5::kernel; 197} | 187} 188 189Kernel *kernel; 190 191} // namespace sc_gem5 192 193sc_gem5::Kernel * 194SystemC_KernelParams::create() 195{ 196 panic_if(sc_gem5::kernel, 197 "Only one systemc kernel object may be defined.\n"); 198 sc_gem5::kernel = new sc_gem5::Kernel(this); 199 return sc_gem5::kernel; 200} |