sc_main.cc (13038:7bf84150855b) sc_main.cc (13043:3d8585dabc3e)
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

--- 230 unchanged lines hidden (view full) ---

239}
240
241sc_status
242sc_get_status()
243{
244 return ::sc_gem5::kernel ? ::sc_gem5::kernel->status() : SC_ELABORATION;
245}
246
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

--- 230 unchanged lines hidden (view full) ---

239}
240
241sc_status
242sc_get_status()
243{
244 return ::sc_gem5::kernel ? ::sc_gem5::kernel->status() : SC_ELABORATION;
245}
246
247std::ostream &
248operator << (std::ostream &os, sc_status s)
249{
250 switch (s) {
251 case SC_ELABORATION:
252 os << "SC_ELABORATION";
253 break;
254 case SC_BEFORE_END_OF_ELABORATION:
255 os << "SC_BEFORE_END_OF_ELABORATION";
256 break;
257 case SC_END_OF_ELABORATION:
258 os << "SC_END_OF_ELABORATION";
259 break;
260 case SC_START_OF_SIMULATION:
261 os << "SC_START_OF_SIMULATION";
262 break;
263 case SC_RUNNING:
264 os << "SC_RUNNING";
265 break;
266 case SC_PAUSED:
267 os << "SC_PAUSED";
268 break;
269 case SC_STOPPED:
270 os << "SC_STOPPED";
271 break;
272 case SC_END_OF_SIMULATION:
273 os << "SC_END_OF_SIMULATION";
274 break;
275
276 // Nonstandard
277 case SC_END_OF_INITIALIZATION:
278 os << "SC_END_OF_INITIALIZATION";
279 break;
280 case SC_END_OF_UPDATE:
281 os << "SC_END_OF_UPDATE";
282 break;
283 case SC_BEFORE_TIMESTEP:
284 os << "SC_BEFORE_TIMESTEP";
285 break;
286
287 default:
288 if (s & SC_STATUS_ANY) {
289 const char *prefix = "(";
290 for (sc_status m = (sc_status)0x1;
291 m < SC_STATUS_ANY; m = (sc_status)(m << 1)) {
292 if (m & s) {
293 os << prefix;
294 prefix = "|";
295 os << m;
296 }
297 }
298 os << ")";
299 } else {
300 ccprintf(os, "%#x", s);
301 }
302 }
303
304 return os;
305}
306
247} // namespace sc_core
307} // namespace sc_core