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

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

30#include <memory>
31#include <string>
32#include <vector>
33
34#include "base/logging.hh"
35#include "systemc/core/kernel.hh"
36#include "systemc/core/module.hh"
37#include "systemc/core/process_types.hh"
38#include "systemc/core/sensitivity.hh"
39#include "systemc/ext/channel/sc_signal_in_if.hh"
40#include "systemc/ext/core/sc_module.hh"
41#include "systemc/ext/core/sc_module_name.hh"
42#include "systemc/ext/dt/bit/sc_logic.hh"
43#include "systemc/ext/utils/sc_report_handler.hh"
44
45namespace sc_gem5
46{

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

240
241void
242sc_module::end_module()
243{
244 _gem5_module->endModule();
245}
246
247void
247sc_module::reset_signal_is(const sc_in<bool> &, bool)
248sc_module::reset_signal_is(const sc_in<bool> &port, bool val)
249{
249 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
250 sc_gem5::newResetSensitivityPort(
251 ::sc_gem5::Process::newest(), &port, val, true);
252}
253
254void
253sc_module::reset_signal_is(const sc_inout<bool> &, bool)
255sc_module::reset_signal_is(const sc_inout<bool> &port, bool val)
256{
255 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
257 sc_gem5::newResetSensitivityPort(
258 ::sc_gem5::Process::newest(), &port, val, true);
259}
260
261void
259sc_module::reset_signal_is(const sc_out<bool> &, bool)
262sc_module::reset_signal_is(const sc_out<bool> &port, bool val)
263{
261 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
264 sc_gem5::newResetSensitivityPort(
265 ::sc_gem5::Process::newest(), &port, val, true);
266}
267
268void
265sc_module::reset_signal_is(const sc_signal_in_if<bool> &, bool)
269sc_module::reset_signal_is(const sc_signal_in_if<bool> &signal, bool val)
270{
267 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
271 sc_gem5::newResetSensitivitySignal(
272 ::sc_gem5::Process::newest(), &signal, val, true);
273}
274
275
276void
272sc_module::async_reset_signal_is(const sc_in<bool> &, bool)
277sc_module::async_reset_signal_is(const sc_in<bool> &port, bool val)
278{
274 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
279 sc_gem5::newResetSensitivityPort(
280 ::sc_gem5::Process::newest(), &port, val, false);
281}
282
283void
278sc_module::async_reset_signal_is(const sc_inout<bool> &, bool)
284sc_module::async_reset_signal_is(const sc_inout<bool> &port, bool val)
285{
280 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
286 sc_gem5::newResetSensitivityPort(
287 ::sc_gem5::Process::newest(), &port, val, false);
288}
289
290void
284sc_module::async_reset_signal_is(const sc_out<bool> &, bool)
291sc_module::async_reset_signal_is(const sc_out<bool> &port, bool val)
292{
286 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
293 sc_gem5::newResetSensitivityPort(
294 ::sc_gem5::Process::newest(), &port, val, false);
295}
296
297void
290sc_module::async_reset_signal_is(const sc_signal_in_if<bool> &, bool)
298sc_module::async_reset_signal_is(const sc_signal_in_if<bool> &signal, bool val)
299{
292 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
300 sc_gem5::newResetSensitivitySignal(
301 ::sc_gem5::Process::newest(), &signal, val, false);
302}
303
304
305void
306sc_module::dont_initialize()
307{
308 ::sc_gem5::Process::newest()->dontInitialize(true);
309}

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

630
631void
632wait(int n)
633{
634 if (n <= 0) {
635 std::string msg = csprintf("n = %d", n);
636 SC_REPORT_ERROR("(E525) wait(n) is only valid for n > 0", msg.c_str());
637 }
629 for (int i = 0; i < n; i++)
630 wait();
638 sc_gem5::Process *p = sc_gem5::scheduler.current();
639 p->waitCount(n - 1);
640 wait();
641}
642
643void
644wait(const sc_event &e)
645{
646 sc_gem5::Process *p = sc_gem5::scheduler.current();
647 if (waitErrorCheck(p))
648 return;

--- 174 unchanged lines hidden ---