diff options
| author | Clément Zrounba <6691770+clement-z@users.noreply.github.com> | 2023-09-30 23:06:01 +0200 |
|---|---|---|
| committer | Clément Zrounba <6691770+clement-z@users.noreply.github.com> | 2023-09-30 23:26:46 +0200 |
| commit | ff9b8bb838ecdfbfc1dc81038fcf3b2a87636982 (patch) | |
| tree | 21f27be782ce11c6d00b96ce100a2bff88141b2e /src/devices/cw_source.cpp | |
| download | specs-ff9b8bb838ecdfbfc1dc81038fcf3b2a87636982.tar.gz specs-ff9b8bb838ecdfbfc1dc81038fcf3b2a87636982.zip | |
Initial release
Diffstat (limited to 'src/devices/cw_source.cpp')
| -rw-r--r-- | src/devices/cw_source.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/devices/cw_source.cpp b/src/devices/cw_source.cpp new file mode 100644 index 0000000..4be5934 --- /dev/null +++ b/src/devices/cw_source.cpp @@ -0,0 +1,45 @@ +#include "specs.h" +#include <cw_source.h> + +using std::cout; +using std::endl; + +void CWSource::runner() +{ + if (specsGlobalConfig.verbose_component_initialization) + { + cout << name() << ":" << endl; + cout << "signal on: " << m_signal_on << endl; + cout << "--> " << + (dynamic_cast<spx::oa_signal_type *>(p_out.get_interface()))->name() << endl; + cout << endl; + } + + bool first_run = true; + + while (true) { + // Wait for enable signal + if (! enable.read().to_bool()) + { + // cout << name() << " waiting for enable" << endl; + wait(enable.posedge_event()); + } + // cout << name() << " was enabled" << endl; + auto s = m_signal_on; + s.getNewId(); + + // Write value to output + m_out_writer.delayedWrite(s, SC_ZERO_TIME); + cout << name() << " emitted: " << s << endl; + + // Wait for reset + if ( !first_run || !reset.read().to_bool()) + { + // cout << name() << " waiting for reset" << endl; + wait(reset.posedge_event()); + reset.write(sc_logic(0)); + wait(reset.negedge_event()); + } + // cout << name() << " was reset" << endl; + } +} |
