sc_module.cc (13248:a07071974510) sc_module.cc (13260:4d18f1d20093)
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"
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"
38#include "systemc/ext/channel/sc_signal_in_if.hh"
39#include "systemc/ext/core/sc_module.hh"
40#include "systemc/ext/core/sc_module_name.hh"
41#include "systemc/ext/dt/bit/sc_logic.hh"
42#include "systemc/ext/utils/sc_report_handler.hh"
43
44namespace sc_gem5
45{

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

239
240void
241sc_module::end_module()
242{
243 _gem5_module->endModule();
244}
245
246void
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)
248{
249{
249 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
250 sc_gem5::newResetSensitivityPort(
251 ::sc_gem5::Process::newest(), &port, val, true);
250}
251
252void
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)
254{
256{
255 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
257 sc_gem5::newResetSensitivityPort(
258 ::sc_gem5::Process::newest(), &port, val, true);
256}
257
258void
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)
260{
263{
261 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
264 sc_gem5::newResetSensitivityPort(
265 ::sc_gem5::Process::newest(), &port, val, true);
262}
263
264void
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)
266{
270{
267 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
271 sc_gem5::newResetSensitivitySignal(
272 ::sc_gem5::Process::newest(), &signal, val, true);
268}
269
270
271void
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)
273{
278{
274 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
279 sc_gem5::newResetSensitivityPort(
280 ::sc_gem5::Process::newest(), &port, val, false);
275}
276
277void
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)
279{
285{
280 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
286 sc_gem5::newResetSensitivityPort(
287 ::sc_gem5::Process::newest(), &port, val, false);
281}
282
283void
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)
285{
292{
286 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
293 sc_gem5::newResetSensitivityPort(
294 ::sc_gem5::Process::newest(), &port, val, false);
287}
288
289void
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)
291{
299{
292 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
300 sc_gem5::newResetSensitivitySignal(
301 ::sc_gem5::Process::newest(), &signal, val, false);
293}
294
295
296void
297sc_module::dont_initialize()
298{
299 ::sc_gem5::Process::newest()->dontInitialize(true);
300}

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

621
622void
623wait(int n)
624{
625 if (n <= 0) {
626 std::string msg = csprintf("n = %d", n);
627 SC_REPORT_ERROR("(E525) wait(n) is only valid for n > 0", msg.c_str());
628 }
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();
631}
632
633void
634wait(const sc_event &e)
635{
636 sc_gem5::Process *p = sc_gem5::scheduler.current();
637 if (waitErrorCheck(p))
638 return;

--- 174 unchanged lines hidden ---
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 ---