sc_main.cc (12949:7014101fea10) sc_main.cc (12956:264cdc9261e6)
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

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

28 */
29
30#include <cstring>
31
32#include "base/fiber.hh"
33#include "base/logging.hh"
34#include "base/types.hh"
35#include "python/pybind11/pybind.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

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

28 */
29
30#include <cstring>
31
32#include "base/fiber.hh"
33#include "base/logging.hh"
34#include "base/types.hh"
35#include "python/pybind11/pybind.hh"
36#include "sim/core.hh"
36#include "sim/eventq.hh"
37#include "sim/init.hh"
37#include "sim/eventq.hh"
38#include "sim/init.hh"
39#include "systemc/core/scheduler.hh"
38#include "systemc/ext/core/sc_main.hh"
39#include "systemc/ext/utils/sc_report_handler.hh"
40
41// A weak symbol to detect if sc_main has been defined, and if so where it is.
42[[gnu::weak]] int sc_main(int argc, char *argv[]);
43
44namespace sc_core
45{

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

119EmbeddedPyBind embed_("systemc", &systemc_pybind);
120
121sc_stop_mode _stop_mode = SC_STOP_FINISH_DELTA;
122sc_status _status = SC_ELABORATION;
123
124Tick _max_tick = MaxTick;
125sc_starvation_policy _starvation = SC_EXIT_ON_STARVATION;
126
40#include "systemc/ext/core/sc_main.hh"
41#include "systemc/ext/utils/sc_report_handler.hh"
42
43// A weak symbol to detect if sc_main has been defined, and if so where it is.
44[[gnu::weak]] int sc_main(int argc, char *argv[]);
45
46namespace sc_core
47{

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

121EmbeddedPyBind embed_("systemc", &systemc_pybind);
122
123sc_stop_mode _stop_mode = SC_STOP_FINISH_DELTA;
124sc_status _status = SC_ELABORATION;
125
126Tick _max_tick = MaxTick;
127sc_starvation_policy _starvation = SC_EXIT_ON_STARVATION;
128
127uint64_t _deltaCycles = 0;
128
129} // anonymous namespace
130
131int
132sc_argc()
133{
134 return _argc;
135}
136

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

188sc_stop()
189{
190 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
191}
192
193const sc_time &
194sc_time_stamp()
195{
129} // anonymous namespace
130
131int
132sc_argc()
133{
134 return _argc;
135}
136

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

188sc_stop()
189{
190 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
191}
192
193const sc_time &
194sc_time_stamp()
195{
196 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
197 return *(sc_time *)nullptr;
196 static sc_time tstamp;
197 Tick tick = sc_gem5::scheduler.eventQueue().getCurTick();
198 //XXX We're assuming the systemc time resolution is in ps.
199 tstamp = sc_time::from_value(tick / SimClock::Int::ps);
200 return tstamp;
198}
199
200sc_dt::uint64
201sc_delta_count()
202{
201}
202
203sc_dt::uint64
204sc_delta_count()
205{
203 return _deltaCycles;
206 return sc_gem5::scheduler.numCycles();
204}
205
206bool
207sc_is_running()
208{
209 return _status & (SC_RUNNING | SC_PAUSED);
210}
211

--- 35 unchanged lines hidden ---
207}
208
209bool
210sc_is_running()
211{
212 return _status & (SC_RUNNING | SC_PAUSED);
213}
214

--- 35 unchanged lines hidden ---