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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
Index: src/timing.cc
===================================================================
--- src/timing.cc (revision 76)
+++ src/timing.cc (working copy)
@@ -18,6 +18,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "timing.h"
+#include "string.h"
#include <map>
#include <fstream>
using namespace std;
@@ -61,21 +62,40 @@
sigvalue::sigvalue (const std::string &s, valuetype n) {
text = s;
type = n;
- if (type == UNDEF) {
- if (text == "0" || text == "false")
+ if (type == UNDEF) {
+ if (text == "0" || text == "false") {
type = ZERO;
- else if (text == "1" || text == "true")
+ val = 0.0;
+ } else if (text == "1" || text == "true") {
type = ONE;
- else if (text == "pulse")
+ val = 1.0;
+ } else if (text == "pulse") {
type = PULSE;
- else if (text == "tick")
+ val = 0.0;
+ } else if (text == "tick") {
type = TICK;
- else if (text == "X")
+ val = 0.0;
+ } else if (text == "X") {
type = X;
- else if (text == "Z")
+ val = 0.5;
+ } else if (text == "Z") {
type = Z;
- else
- type = STATE;
+ val = 0.5;
+ } else {
+ float ana;
+ int n = sscanf(text.c_str(), "%f", &ana);
+ if(n > 0) {
+ val = ana;
+ if(text[text.length()-1] == 'S') {
+ type = ANA_STEP;
+ } else {
+ type = ANA;
+ }
+ } else {
+ type = STATE;
+ val = 0.5;
+ }
+ }
}
}
@@ -84,6 +104,7 @@
sigvalue &sigvalue::operator= (const sigvalue &t) {
type = t.type;
text = t.text;
+ val = t.val;
return *this;
}
@@ -338,6 +359,16 @@
const sigvalue &value) {
switch (value.type) {
+
+ case ANA:
+ gc.line(x, y + (int) (vCellH * (1.0 - last.val)), x+vCellW, y + (int) (vCellH * (1.0 - value.val)));
+ break;
+
+ case ANA_STEP:
+ gc.line(x, y + (int) (vCellH * (1.0 - last.val)), x, y + (int) (vCellH * (1.0 - value.val)));
+ gc.line(x, y + (int) (vCellH * (1.0 - value.val)), x+vCellW, y + (int) (vCellH * (1.0 - value.val)));
+ break;
+
case ZERO:
switch (last.type) {
default:
Index: src/timing.h
===================================================================
--- src/timing.h (revision 76)
+++ src/timing.h (working copy)
@@ -29,11 +29,12 @@
namespace timing {
- enum valuetype {UNDEF, ZERO, ONE, X, Z, PULSE, TICK, STATE};
+ enum valuetype {UNDEF, ZERO, ONE, X, Z, PULSE, TICK, STATE, ANA, ANA_STEP};
struct sigvalue {
valuetype type;
std::string text;
+ float val;
sigvalue (void);
sigvalue (const sigvalue &);
sigvalue (const std::string &s, valuetype n = UNDEF);
|