VCDTypes.hpp
Go to the documentation of this file.
1 
2 #include <map>
3 #include <utility>
4 #include <string>
5 #include <vector>
6 #include <deque>
7 
8 /*!
9 @file VCDTypes.hpp
10 @brief A file for common types and data structures used by the VCD parser.
11 */
12 
13 #ifndef VCDTypes_HPP
14 #define VCDTypes_HPP
15 
16 //! Friendly name for a signal
17 typedef std::string VCDSignalReference;
18 
19 //! Friendly name for a scope
20 typedef std::string VCDScopeName;
21 
22 //! Compressed hash representation of a signal.
23 typedef std::string VCDSignalHash;
24 
25 //! Represents a single instant in time in a trace
26 typedef double VCDTime;
27 
28 //! Specifies the timing resoloution along with VCDTimeUnit
29 typedef unsigned VCDTimeRes;
30 
31 //! Width in bits of a signal.
32 typedef unsigned VCDSignalSize;
33 
34 //! Represents the four-state signal values of a VCD file.
35 typedef enum {
36  VCD_0 = 0, //!< Logic zero
37  VCD_1 = 1, //!< Logic one
38  VCD_X = 2, //!< Unknown / Undefined
39  VCD_Z = 3 //!< High Impedence.
40 } VCDBit;
41 
42 
43 //! A vector of VCDBit values.
44 typedef std::vector<VCDBit> VCDBitVector;
45 
46 //! Typedef to identify a real number as stored in a VCD.
47 typedef double VCDReal;
48 
49 
50 //! Describes how a signal value is represented in the VCD trace.
51 typedef enum {
52  VCD_SCALAR, //!< Single VCDBit
53  VCD_VECTOR, //!< Vector of VCDBit
54  VCD_REAL //!< IEEE Floating point (64bit).
55 } VCDValueType;
56 
57 
58 // Forward declaration of class.
59 class VCDValue;
60 
61 
62 //! A signal value tagged with times.
63 typedef struct {
67 
68 
69 //! A vector of tagged time/value pairs, sorted by time values.
70 typedef std::deque<VCDTimedValue*> VCDSignalValues;
71 
72 
73 //! Variable types of a signal in a VCD file.
74 typedef enum {
93 } VCDVarType;
94 
95 
96 //! Represents the possible time units a VCD file is specified in.
97 typedef enum {
98  TIME_S, //!< Seconds
99  TIME_MS, //!< Milliseconds
100  TIME_US, //!< Microseconds
101  TIME_NS, //!< Nanoseconds
102  TIME_PS, //!< Picoseconds
103 } VCDTimeUnit;
104 
105 
106 //! Represents the type of SV construct who's scope we are in.
107 typedef enum {
114 } VCDScopeType;
115 
116 
117 // Typedef over vcdscope to make it available to VCDSignal struct.
118 typedef struct vcdscope VCDScope;
119 
120 //! Represents a single signal reference within a VCD file
121 typedef struct {
127  int lindex; // -1 if no brackets, otherwise [lindex] or [lindex:rindex]
128  int rindex; // -1 if not [lindex:rindex]
129 } VCDSignal;
130 
131 
132 //! Represents a scope type, scope name pair and all of it's child signals.
133 struct vcdscope {
134  VCDScopeName name; //!< The short name of the scope
135  VCDScopeType type; //!< Construct type
136  VCDScope * parent; //!< Parent scope object
137  std::vector<VCDScope*> children; //!< Child scope objects.
138  std::vector<VCDSignal*> signals; //!< Signals in this scope.
139 };
140 
141 
142 #endif
IEEE Floating point (64bit).
Definition: VCDTypes.hpp:54
VCDTime time
Definition: VCDTypes.hpp:64
std::vector< VCDBit > VCDBitVector
A vector of VCDBit values.
Definition: VCDTypes.hpp:44
VCDSignalHash hash
Definition: VCDTypes.hpp:122
std::string VCDSignalHash
Compressed hash representation of a signal.
Definition: VCDTypes.hpp:23
VCDScope * parent
Parent scope object.
Definition: VCDTypes.hpp:136
Logic one.
Definition: VCDTypes.hpp:37
VCDSignalSize size
Definition: VCDTypes.hpp:125
VCDVarType type
Definition: VCDTypes.hpp:126
Unknown / Undefined.
Definition: VCDTypes.hpp:38
VCDSignalReference reference
Definition: VCDTypes.hpp:123
std::vector< VCDSignal * > signals
Signals in this scope.
Definition: VCDTypes.hpp:138
VCDScope * scope
Definition: VCDTypes.hpp:124
Microseconds.
Definition: VCDTypes.hpp:100
Represents a single value found in a VCD File.
Definition: VCDValue.hpp:12
int lindex
Definition: VCDTypes.hpp:127
A signal value tagged with times.
Definition: VCDTypes.hpp:63
std::vector< VCDScope * > children
Child scope objects.
Definition: VCDTypes.hpp:137
std::deque< VCDTimedValue * > VCDSignalValues
A vector of tagged time/value pairs, sorted by time values.
Definition: VCDTypes.hpp:70
Represents a single signal reference within a VCD file.
Definition: VCDTypes.hpp:121
Picoseconds.
Definition: VCDTypes.hpp:102
unsigned VCDSignalSize
Width in bits of a signal.
Definition: VCDTypes.hpp:32
VCDScopeName name
The short name of the scope.
Definition: VCDTypes.hpp:134
Seconds.
Definition: VCDTypes.hpp:98
VCDValue * value
Definition: VCDTypes.hpp:65
Represents a scope type, scope name pair and all of it&#39;s child signals.
Definition: VCDTypes.hpp:133
Milliseconds.
Definition: VCDTypes.hpp:99
double VCDReal
Typedef to identify a real number as stored in a VCD.
Definition: VCDTypes.hpp:47
VCDScopeType type
Construct type.
Definition: VCDTypes.hpp:135
VCDValueType
Describes how a signal value is represented in the VCD trace.
Definition: VCDTypes.hpp:51
Logic zero.
Definition: VCDTypes.hpp:36
Vector of VCDBit.
Definition: VCDTypes.hpp:53
VCDBit
Represents the four-state signal values of a VCD file.
Definition: VCDTypes.hpp:35
Single VCDBit.
Definition: VCDTypes.hpp:52
unsigned VCDTimeRes
Specifies the timing resoloution along with VCDTimeUnit.
Definition: VCDTypes.hpp:29
VCDVarType
Variable types of a signal in a VCD file.
Definition: VCDTypes.hpp:74
int rindex
Definition: VCDTypes.hpp:128
High Impedence.
Definition: VCDTypes.hpp:39
Nanoseconds.
Definition: VCDTypes.hpp:101
VCDScopeType
Represents the type of SV construct who&#39;s scope we are in.
Definition: VCDTypes.hpp:107
std::string VCDSignalReference
Friendly name for a signal.
Definition: VCDTypes.hpp:17
double VCDTime
Represents a single instant in time in a trace.
Definition: VCDTypes.hpp:26
VCDTimeUnit
Represents the possible time units a VCD file is specified in.
Definition: VCDTypes.hpp:97
std::string VCDScopeName
Friendly name for a scope.
Definition: VCDTypes.hpp:20