blob: 4be593424fc2c9bf25a99fb2df08f93924e43ae4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;
}
}
|