-
Notifications
You must be signed in to change notification settings - Fork 0
/
NetlistParser.h
89 lines (71 loc) · 2.45 KB
/
NetlistParser.h
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef _TRAN_NLPS_H_
#define _TRAN_NLPS_H_
#include <vector>
#include <string>
#include <unordered_map>
#include "Base.h"
namespace Tran {
struct ParserDevice {
std::string _name;
std::string _posNode;
std::string _negNode;
std::string _posSampleNode;
std::string _negSampleNode;
DeviceType _type;
bool _isPWLValue = false;
union {
double _value;
size_t _PWLData = 0;
};
};
struct MeasurePoint {
std::string _variableName;
double _timeDelay = .0f;
std::string _trigger;
SimResultType _triggerType;
double _triggerValue;
std::string _target;
SimResultType _targetType;
double _targetValue;
};
struct PlotData {
std::string _canvasName;
std::vector<std::string> _nodeToPlot;
std::vector<std::string> _deviceToPlot;
};
class NetlistParser {
public:
NetlistParser(const char* fileName);
void parseLine(const std::string& line);
std::vector<ParserDevice> devices() const { return _devices; }
std::vector<PWLValue> PWLData() const { return _PWLData; }
double simulationTime() const { return _simTime; }
double simulationTick() const { return _simTick; }
IntegrateMethod integrateMethod() const { return _intMethod; }
const std::vector<PlotData>& plotData() const { return _plotData; }
std::vector<PlotData>& plotData() { return _plotData; }
bool needPlot() const { return _plotData.empty() == false; }
int plotWidth() const { return _plotWidth; }
int plotHeight() const { return _plotHeight; }
bool dumpData() const { return _saveData; }
double relTol() const { return _relTol; }
bool haveMeasurePoints() const { return !_measurePoints.empty(); }
const std::vector<MeasurePoint>& measurePoints() const { return _measurePoints; }
private:
void processCommands(const std::string& line);
void processOption(const std::string& line);
private:
std::vector<ParserDevice> _devices;
std::vector<PWLValue> _PWLData;
std::vector<MeasurePoint> _measurePoints;
double _simTick = 1e-15;
double _simTime = 2;
double _relTol = 1e-6;
IntegrateMethod _intMethod = IntegrateMethod::Gear2;
bool _saveData = false;
size_t _plotWidth = static_cast<size_t>(-1);
size_t _plotHeight = static_cast<size_t>(-1);
std::vector<PlotData> _plotData;
};
}
#endif