sc_inout.hh (13245:c666c5d4996b) sc_inout.hh (13269:8807a4b970d4)
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"
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"
36#include "../core/sc_port.hh"
37#include "../dt/bit/sc_logic.hh"
38#include "../utils/sc_trace_file.hh"
39#include "sc_signal_inout_if.hh"
40
41namespace sc_dt
42{
43

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

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

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

352 // Disabled
353 sc_inout(const sc_inout<bool> &);
354};
355
356template <>
357inline void sc_trace<bool>(
358 sc_trace_file *tf, const sc_inout<bool> &i, const std::string &name)
359{
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)
363 i.add_trace(tf, name);
362 i.add_trace(tf, name);
363 else
364 sc_trace(tf, i->read(), name);
364}
365
366template <>
367class sc_inout<sc_dt::sc_logic> :
368 public sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1>
369{
370 public:
371 sc_inout() : sc_port<sc_signal_inout_if<sc_dt::sc_logic>, 1>(),

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

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