sc_prim.cc (13189:057566bc8fd6) sc_prim.cc (13238:3521d1f59c22)
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"
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/core/sc_main.hh"
33#include "systemc/ext/core/sc_prim.hh"
34
35namespace sc_gem5
36{
37
38uint64_t getChangeStamp() { return scheduler.changeStamp(); }
39
40} // namespace sc_gem5
41
42namespace sc_core
43{
44
34#include "systemc/ext/core/sc_prim.hh"
35
36namespace sc_gem5
37{
38
39uint64_t getChangeStamp() { return scheduler.changeStamp(); }
40
41} // namespace sc_gem5
42
43namespace sc_core
44{
45
45sc_prim_channel::sc_prim_channel() :
46 _gem5_channel(new sc_gem5::Channel(this))
47{}
46sc_prim_channel::sc_prim_channel() : _gem5_channel(nullptr)
47{
48 if (sc_is_running()) {
49 SC_REPORT_ERROR("(E113) insert primitive channel failed",
50 "simulation running");
51 } else if (::sc_gem5::scheduler.elaborationDone()) {
52 SC_REPORT_ERROR("(E113) insert primitive channel failed",
53 "elaboration done");
54 } else {
55 _gem5_channel = new sc_gem5::Channel(this);
56 }
57}
48
49sc_prim_channel::sc_prim_channel(const char *_name) :
58
59sc_prim_channel::sc_prim_channel(const char *_name) :
50 sc_object(_name), _gem5_channel(new sc_gem5::Channel(this))
51{}
60 sc_object(_name), _gem5_channel(nullptr)
61{
62 if (sc_is_running()) {
63 SC_REPORT_ERROR("(E113) insert primitive channel failed",
64 "simulation running");
65 } else if (::sc_gem5::scheduler.elaborationDone()) {
66 SC_REPORT_ERROR("(E113) insert primitive channel failed",
67 "elaboration done");
68 } else {
69 _gem5_channel = new sc_gem5::Channel(this);
70 }
71}
52
53sc_prim_channel::~sc_prim_channel() { delete _gem5_channel; }
54
55void
56sc_prim_channel::request_update()
57{
58 _gem5_channel->requestUpdate();
59}

--- 166 unchanged lines hidden ---
72
73sc_prim_channel::~sc_prim_channel() { delete _gem5_channel; }
74
75void
76sc_prim_channel::request_update()
77{
78 _gem5_channel->requestUpdate();
79}

--- 166 unchanged lines hidden ---