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

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

25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * Authors: Gabe Black
28 */
29
30#include "base/logging.hh"
31#include "systemc/core/channel.hh"
32#include "systemc/core/scheduler.hh"
33#include "systemc/ext/channel/messages.hh"
34#include "systemc/ext/core/sc_main.hh"
35#include "systemc/ext/core/sc_prim.hh"
36
37namespace sc_gem5
38{
39
40uint64_t getChangeStamp() { return scheduler.changeStamp(); }
41
42} // namespace sc_gem5
43
44namespace sc_core
45{
46
47sc_prim_channel::sc_prim_channel() : _gem5_channel(nullptr)
48{
49 if (sc_is_running()) {
49 SC_REPORT_ERROR("(E113) insert primitive channel failed",
50 "simulation running");
50 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "simulation running");
51 }
52 if (::sc_gem5::scheduler.elaborationDone()) {
53 SC_REPORT_ERROR("(E113) insert primitive channel failed",
54 "elaboration done");
53 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "elaboration done");
54 }
55 _gem5_channel = new sc_gem5::Channel(this);
56}
57
58sc_prim_channel::sc_prim_channel(const char *_name) :
59 sc_object(_name), _gem5_channel(nullptr)
60{
61 if (sc_is_running()) {
63 SC_REPORT_ERROR("(E113) insert primitive channel failed",
64 "simulation running");
62 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "simulation running");
63 }
64 if (::sc_gem5::scheduler.elaborationDone()) {
67 SC_REPORT_ERROR("(E113) insert primitive channel failed",
68 "elaboration done");
65 SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "elaboration done");
66 }
67 _gem5_channel = new sc_gem5::Channel(this);
68}
69
70sc_prim_channel::~sc_prim_channel() { delete _gem5_channel; }
71
72void
73sc_prim_channel::request_update()

--- 169 unchanged lines hidden ---