15#include "trg/trg/Utilities.h"
16#include "trg/trg/Clock.h"
17#include "trg/trg/Signal.h"
18#include "trg/trg/SignalVector.h"
19#include "trg/trg/State.h"
35 for (
unsigned i = 0; i < size; i++) {
44 _name(
"CopyOf" + t._name)
47 const unsigned n = t.size();
48 for (
unsigned i = 0; i < n; i++)
53 _name(
"VectorOf" + t.name())
65 const string& pre)
const
68 cout << pre <<
_name <<
":" << size() <<
" signal(s)" << endl;
70 const bool det = msg.find(
"detail") != string::npos;
71 const bool clk = msg.find(
"clock") != string::npos;
77 for (
unsigned i = 0; i < size(); i++)
78 (*
this)[i].dump(msg,
" " + pre +
"bit" +
79 TRGUtil::itostring(i) +
":");
81 for (
unsigned i = 0; i < size(); i++)
82 if ((*
this)[i].active())
83 (*
this)[i].dump(msg,
" " + pre +
"bit" +
84 TRGUtil::itostring(i) +
":");
105 for (
unsigned i = 0; i < left.size(); i++)
113 for (
unsigned i = 0; i < size(); i++)
114 if ((*
this)[i].active())
132 std::vector<int> list;
133 const unsigned n = size();
134 for (
unsigned i = 0; i < n; i++) {
135 vector<int> a = (* this)[i].stateChanges();
136 for (
unsigned j = 0; j < a.size(); j++)
137 list.push_back(a[j]);
141 std::sort(list.begin(), list.end());
144 std::vector<int> list2;
145 int last = numeric_limits<int>::min();
146 for (
unsigned i = 0; i < list.size(); i++) {
147 const int j = list[i];
160 std::vector<bool> list;
161 const unsigned n = size();
162 for (
unsigned i = 0; i < n; i++)
163 list.push_back((*
this)[i].state(clockPosition));
172 for (
unsigned i = 0; i < size(); i++) {
183 const unsigned n = s.size();
184 for (
unsigned i = 0; i < n; i++) {
186 signal.set(cp, cp + 1, s[i]);
194 if (size() != a.size()) {
199 for (
unsigned i = 0; i < size(); i++) {
200 if ((*
this)[i] != a[i]) {
A class to represent a digitized signal. Unit is nano second.
A class to represent a bundle of digitized signals.
const TRGClock * _clock
Clock.
A class to represent a digitized signal. Unit is nano second.
A class to represent a state of multi bits.
const TRGSignalVector & set(const TRGState &, int clockPosition)
sets state at given clock.
TRGState state(int clockPosition) const
returns state at given clock position.
TRGSignalVector & operator+=(const TRGSignal &)
appends TRGSignal.
const TRGClock & clock(void) const
returns clock.
const std::string & name(void) const
returns name.
std::vector< int > stateChanges(void) const
returns a list of clock position of state change.
virtual ~TRGSignalVector()
Destructor.
static std::string itostring(int i)
converts int to string. (Use boost::lexical_cast)
bool operator==(const TRGSignalVector &) const
compare two TRGSignalVectors.
bool active(void) const
returns true if there is a signal.
TRGSignalVector(const std::string &name, const TRGClock &, unsigned size=0)
Default constructor.
void dump(const std::string &message="", const std::string &pre="") const
dumps contents.
Abstract base class for different kinds of events.