ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
VCD.h
Go to the documentation of this file.
1
52#ifndef ETISS_INTERFACES_VCD_H
53#define ETISS_INTERFACES_VCD_H
54
55#include "etiss/Misc.h"
56
57#include <fstream>
58#include <iostream>
59#include <vector>
60
71#define ETISS_INTERFACES_VCD_DECLARE(LOG, VAR, WIDTH) \
72 { \
73 (VAR).vcd = &(LOG); \
74 (LOG).declare((VAR), ETISS_TOSTRING(VAR), WIDTH, (VAR).errval); \
75 }
76
77namespace etiss
78{
79namespace interfaces
80{
81
86class VCD : public etiss::ToString
87{
88 public:
89 class Signal
90 {
91 public:
92 inline Signal() : valid(false) {}
93 std::string name;
94 // std::string module;
95 bool valid;
97 unsigned width;
98 std::string ident;
100 };
102
103 VCD(const std::string &file, const std::string &comment = std::string());
104 virtual ~VCD();
105
106 template <typename T>
107 inline bool declare(T &variable, const std::string &name, unsigned width, uint64_t initialvalue,
108 uint64_t undefined = -1)
109 {
110 return declare((void *)&variable, name, width, initialvalue, undefined);
111 }
112
113 template <typename T>
114 inline void update(double time_s, const T &variable, uint64_t value, uint64_t undefined = 0)
115 {
116 update((uint64_t)(time_s * 1000000000000.0), (void *)&variable, value, undefined);
117 }
118
119 inline std::string toString() const { return std::string("VCD { file=\"") + file + "\"}"; }
120
121 void close();
122
123 protected:
124 bool declare(void *variable, const std::string &name, unsigned width, uint64_t initialvalue, uint64_t undefined);
125 void update(uint64_t time_ps, void *variable, uint64_t value, uint64_t undefined);
126 void flush();
127
128 private:
129 std::ofstream out_;
130 bool valid_;
132 std::vector<Signal> sigs_;
134 std::map<void *, int> ptr2index_;
135 std::string dumpvar;
136 std::string file;
137};
138
139} // namespace interfaces
140} // namespace etiss
141
142#endif // ETISS_INTERFACES_VCD_H
general configuration and logging
#define etiss_del_como(CLASS)
Definition Misc.h:94
static __inline__ uint64_t
Definition arm_cde.h:31
Marker interface for toString() support.
Definition Misc.h:137
std::ofstream out_
Definition VCD.h:129
std::map< void *, int > ptr2index_
Definition VCD.h:134
bool declare(T &variable, const std::string &name, unsigned width, uint64_t initialvalue, uint64_t undefined=-1)
Definition VCD.h:107
uint64_t lasttime_ps
Definition VCD.h:133
virtual etiss_del_como(VCD) VCD(const std ~VCD()
Definition VCD.cpp:119
void update(double time_s, const T &variable, uint64_t value, uint64_t undefined=0)
Definition VCD.h:114
std::string toString() const
Definition VCD.h:119
std::string dumpvar
TODO replace with better lookup.
Definition VCD.h:135
std::vector< Signal > sigs_
Definition VCD.h:132
std::string file
Definition VCD.h:136
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition Benchmark.h:53
#define false
Definition stdbool.h:17