blob: a10c1a1bd710637707481e4e29e37a22bd7f0492 (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#include "specs.h"
#include "value_list_source.h"
using std::cout;
using std::cerr;
using std::endl;
void VLSource::runner()
{
if (specsGlobalConfig.verbose_component_initialization)
{
cout << name() << ":" << endl;
cout << "value list (" << m_values_queue.size() << " values)";
if (false)
{
cout << ":" << endl;
for (const auto& val : m_values_queue)
cout << "\t" << "@" << sc_time(val.first, SC_SEC) << ": " << val.second << endl;
}
cout << endl;
cout << "--> " <<
(dynamic_cast<spx::oa_signal_type *>(p_out.get_interface()))->name() << endl;
cout << endl;
}
// Wait for enable signal
if (! enable.read().to_bool())
{
// cout << name() << " waiting for enable" << endl;
wait(enable.posedge_event());
cout << name() << " was enabled" << endl;
}
// Emitting 0 at enable (will only go through if there is no value at t=0)
if (m_values_queue.cbegin() == m_values_queue.cend()
|| sc_time(m_values_queue.front().first, SC_SEC).value() > 0)
{
cout << "@" << sc_time_stamp() << ", " << name() << " emitted: " << spx::oa_value_type(0) << endl;
m_out_writer.delayedWrite(spx::oa_value_type(0), SC_ZERO_TIME);
}
auto it = m_values_queue.cbegin();
while (it != m_values_queue.cend())
{
sc_time now = sc_time_stamp();
sc_time next_emit;
if (sc_time(it->first, SC_SEC) < now)
{
cout << name() << ": invalid time for signal emission !" << endl;
++it;
continue;
}
sc_time delay = sc_time(it->first, SC_SEC) - now;
// Wait until next output time
wait(delay);
auto s = it->second;
// Write value to output
m_out_writer.delayedWrite(s, SC_ZERO_TIME);
cout << "@" << sc_time_stamp() << ", " << name() << " emitted: " << s << endl;
++it;
}
// cout << name() << " completed" << endl;
while(true) { wait(); }
}
|