From 6915118bbf9bc6136d87895faccb91ee940c3609 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Wed, 30 May 2018 14:48:11 -0700 Subject: [PATCH] systemc: Add some missing functions which interact with the scheduler. Change-Id: Ifc8c8d4a7bb6e941485e80f4884cfa4bb648c17c Reviewed-on: https://gem5-review.googlesource.com/10846 Reviewed-by: Jason Lowe-Power Maintainer: Gabe Black --- src/systemc/core/sc_main.cc | 93 +++++++++++++++++++++++++++++++++ src/systemc/ext/core/_using.hh | 34 ++++++++++++ src/systemc/ext/core/sc_main.hh | 52 ++++++++++++++++++ 3 files changed, 179 insertions(+) diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc index 5a6108a6b..3c4fdbb6a 100644 --- a/src/systemc/core/sc_main.cc +++ b/src/systemc/core/sc_main.cc @@ -121,4 +121,97 @@ sc_argv() return _argv; } +void +sc_start() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_pause() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_start(const sc_time &time, sc_starvation_policy p) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +void +sc_set_stop_mode(sc_stop_mode mode) +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +sc_stop_mode +sc_get_stop_mode() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_STOP_FINISH_DELTA; +} + +void +sc_stop() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); +} + +const sc_time & +sc_time_stamp() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return *(sc_time *)nullptr; +} + +sc_dt::uint64 +sc_delta_count() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return 0; +} + +bool +sc_is_running() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +bool +sc_pending_activity_at_current_time() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +bool +sc_pending_activity_at_future_time() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +bool +sc_pending_activity() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return false; +} + +sc_time +sc_time_to_pending_activity() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return sc_time(); +} + +sc_status +sc_get_status() +{ + warn("%s not implemented.\n", __PRETTY_FUNCTION__); + return SC_ELABORATION; +} + } // namespace sc_core diff --git a/src/systemc/ext/core/_using.hh b/src/systemc/ext/core/_using.hh index 3f8bfecc5..5f5a23af4 100644 --- a/src/systemc/ext/core/_using.hh +++ b/src/systemc/ext/core/_using.hh @@ -53,6 +53,34 @@ using sc_core::sc_interface; using sc_core::sc_argc; using sc_core::sc_argv; +using sc_core::sc_starvation_policy; +using sc_core::SC_RUN_TO_TIME; +using sc_core::SC_EXIT_ON_STARVATION; +using sc_core::sc_start; +using sc_core::sc_pause; +using sc_core::sc_set_stop_mode; +using sc_core::sc_get_stop_mode; +using sc_core::sc_stop_mode; +using sc_core::SC_STOP_FINISH_DELTA; +using sc_core::SC_STOP_IMMEDIATE; +using sc_core::sc_stop; +using sc_core::sc_time_stamp; +using sc_core::sc_delta_count; +using sc_core::sc_is_running; +using sc_core::sc_pending_activity_at_current_time; +using sc_core::sc_pending_activity_at_future_time; +using sc_core::sc_pending_activity; +using sc_core::sc_time_to_pending_activity; +using sc_core::sc_get_status; +using sc_core::SC_ELABORATION; +using sc_core::SC_BEFORE_END_OF_ELABORATION; +using sc_core::SC_END_OF_ELABORATION; +using sc_core::SC_START_OF_SIMULATION; +using sc_core::SC_RUNNING; +using sc_core::SC_PAUSED; +using sc_core::SC_STOPPED; +using sc_core::SC_END_OF_SIMULATION; +using sc_core::sc_status; using sc_core::sc_bind_proxy; using sc_core::SC_BIND_PROXY_NIL; @@ -100,6 +128,12 @@ using sc_core::sc_spawn_options; using sc_core::sc_spawn; using sc_core::sc_time_unit; +using sc_core::SC_FS; +using sc_core::SC_PS; +using sc_core::SC_NS; +using sc_core::SC_US; +using sc_core::SC_MS; +using sc_core::SC_SEC; using sc_core::sc_time; using sc_core::SC_ZERO_TIME; using sc_core::sc_set_time_resolution; diff --git a/src/systemc/ext/core/sc_main.hh b/src/systemc/ext/core/sc_main.hh index 9bf0d0aae..24e93503e 100644 --- a/src/systemc/ext/core/sc_main.hh +++ b/src/systemc/ext/core/sc_main.hh @@ -30,6 +30,9 @@ #ifndef __SYSTEMC_EXT_CORE_SC_MAIN_HH__ #define __SYSTEMC_EXT_CORE_SC_MAIN_HH__ +#include "../dt/int/sc_nbdefs.hh" +#include "sc_time.hh" + extern "C" int sc_main(int argc, char *argv[]); namespace sc_core @@ -39,6 +42,55 @@ namespace sc_core // The standard version of this function doesn't have these "const" // qualifiers, but the canonical SystemC implementation does. extern "C" const char *const *sc_argv(); + + enum sc_starvation_policy + { + SC_RUN_TO_TIME, + SC_EXIT_ON_STARVATION + }; + + void sc_start(); + void sc_start(const sc_time &, sc_starvation_policy p=SC_RUN_TO_TIME); + static inline void + sc_start(double d, sc_time_unit t, sc_starvation_policy p=SC_RUN_TO_TIME) + { + sc_start(sc_time(d, t), p); + } + + void sc_pause(); + + enum sc_stop_mode + { + SC_STOP_FINISH_DELTA, + SC_STOP_IMMEDIATE, + }; + + void sc_set_stop_mode(sc_stop_mode mode); + sc_stop_mode sc_get_stop_mode(); + + void sc_stop(); + + const sc_time &sc_time_stamp(); + sc_dt::uint64 sc_delta_count(); + bool sc_is_running(); + bool sc_pending_activity_at_current_time(); + bool sc_pending_activity_at_future_time(); + bool sc_pending_activity(); + sc_time sc_time_to_pending_activity(); + + enum sc_status + { + SC_ELABORATION = 0x1, + SC_BEFORE_END_OF_ELABORATION = 0x02, + SC_END_OF_ELABORATION = 0x04, + SC_START_OF_SIMULATION = 0x08, + SC_RUNNING = 0x10, + SC_PAUSED = 0x20, + SC_STOPPED = 0x40, + SC_END_OF_SIMULATION = 0x80 + }; + + sc_status sc_get_status(); } // namespace sc_core #endif //__SYSTEMC_EXT_CORE_SC_MAIN_HH__ -- 2.30.2