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

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

28 */
29
30#ifndef __SYSTEMC_EXT_CHANNEL_SC_INOUT_HH__
31#define __SYSTEMC_EXT_CHANNEL_SC_INOUT_HH__
32
33#include <string>
34
35#include "../core/sc_event.hh"
36#include "../core/sc_main.hh"
37#include "../core/sc_port.hh"
38#include "../dt/bit/sc_logic.hh"
39#include "../utils/sc_trace_file.hh"
40#include "sc_signal_inout_if.hh"
41
42namespace sc_dt
43{
44

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

180 // Disabled
181 sc_inout(const sc_inout<T> &);
182};
183
184template <class T>
185inline void
186sc_trace(sc_trace_file *tf, const sc_inout<T> &i, const std::string &name)
187{
187 if (i.size())
188 sc_trace(tf, i->read(), name);
189 else
188 if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
189 i.add_trace(tf, name);
190 else
191 sc_trace(tf, i->read(), name);
192}
193
194template <>
195class sc_inout<bool> : public sc_port<sc_signal_inout_if<bool>, 1>
196{
197 public:
198 sc_inout() : sc_port<sc_signal_inout_if<bool>, 1>(), initValue(nullptr),
199 _valueChangedFinder(*this,

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

353 // Disabled
354 sc_inout(const sc_inout<bool> &);
355};
356
357template <>
358inline void sc_trace<bool>(
359 sc_trace_file *tf, const sc_inout<bool> &i, const std::string &name)
360{
360 if (i.size())
361 sc_trace(tf, i->read(), name);
362 else
361 if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
362 i.add_trace(tf, name);
363 else
364 sc_trace(tf, i->read(), name);
365}
366
367template <>
368class sc_inout<sc_dt::sc_logic> :
369 public sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1>
370{
371 public:
372 sc_inout() : sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1>(),

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

545 sc_inout(const sc_inout<sc_dt::sc_logic> &);
546};
547
548template <>
549inline void
550sc_trace<sc_dt::sc_logic>(sc_trace_file *tf,
551 const sc_inout<sc_dt::sc_logic> &i, const std::string &name)
552{
552 if (i.size())
553 sc_trace(tf, i->read(), name);
554 else
553 if (::sc_core::sc_get_status() < ::sc_core::SC_START_OF_SIMULATION)
554 i.add_trace(tf, name);
555 else
556 sc_trace(tf, i->read(), name);
557}
558
559} // namespace sc_core
560
561#endif //__SYSTEMC_EXT_CHANNEL_SC_INOUT_HH__