diff options
author | Gabe Black <gabeblack@google.com> | 2018-09-11 21:46:12 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-10-09 21:49:08 +0000 |
commit | 8817e547e524cd81b5176cf277ef611920b0815a (patch) | |
tree | f850f6df16e62ca6ae3d9dc585d2075eb799d4f0 /src/systemc/ext/channel/sc_signal.hh | |
parent | 402377f41eb8b52de88d2231fff4d79f59a23e16 (diff) | |
download | gem5-8817e547e524cd81b5176cf277ef611920b0815a.tar.xz |
systemc: Implement sc_buffer.
This required a small change to sc_signal so that the value change
event and the change stamp for it were accessible.
Change-Id: Ife0545d84f3b25e98da079786c30ffa51025cce7
Reviewed-on: https://gem5-review.googlesource.com/c/12804
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/ext/channel/sc_signal.hh')
-rw-r--r-- | src/systemc/ext/channel/sc_signal.hh | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/systemc/ext/channel/sc_signal.hh b/src/systemc/ext/channel/sc_signal.hh index 022bd3394..bbe2d0116 100644 --- a/src/systemc/ext/channel/sc_signal.hh +++ b/src/systemc/ext/channel/sc_signal.hh @@ -151,6 +151,14 @@ class sc_signal : public sc_signal_inout_if<T>, return; m_cur_val = m_new_val; + _signalChange(); + _changeStamp = ::sc_gem5::getChangeStamp(); + _valueChangedEvent.notify(SC_ZERO_TIME); + } + + void + _signalChange() + { _changeStamp = ::sc_gem5::getChangeStamp(); _valueChangedEvent.notify(SC_ZERO_TIME); } @@ -293,18 +301,23 @@ class sc_signal<bool, WRITER_POLICY> : return; m_cur_val = m_new_val; - uint64_t change_stamp = ::sc_gem5::getChangeStamp(); - _changeStamp = change_stamp; - _valueChangedEvent.notify(SC_ZERO_TIME); + _signalChange(); if (m_cur_val) { - _posStamp = change_stamp; + _posStamp = ::sc_gem5::getChangeStamp(); _posedgeEvent.notify(SC_ZERO_TIME); } else { - _negStamp = change_stamp; + _negStamp = ::sc_gem5::getChangeStamp(); _negedgeEvent.notify(SC_ZERO_TIME); } } + void + _signalChange() + { + _changeStamp = ::sc_gem5::getChangeStamp(); + _valueChangedEvent.notify(SC_ZERO_TIME); + } + bool m_cur_val; bool m_new_val; @@ -438,11 +451,21 @@ class sc_signal<sc_dt::sc_logic, WRITER_POLICY> : return; m_cur_val = m_new_val; - _valueChangedEvent.notify(SC_ZERO_TIME); - if (m_cur_val == sc_dt::SC_LOGIC_1) + _signalChange(); + if (m_cur_val == sc_dt::SC_LOGIC_1) { + _posStamp = ::sc_gem5::getChangeStamp(); _posedgeEvent.notify(SC_ZERO_TIME); - else if (m_cur_val == sc_dt::SC_LOGIC_0) + } else if (m_cur_val == sc_dt::SC_LOGIC_0) { + _negStamp = ::sc_gem5::getChangeStamp(); _negedgeEvent.notify(SC_ZERO_TIME); + } + } + + void + _signalChange() + { + _changeStamp = ::sc_gem5::getChangeStamp(); + _valueChangedEvent.notify(SC_ZERO_TIME); } sc_dt::sc_logic m_cur_val; |