-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsignalZ.h
executable file
·187 lines (163 loc) · 4.94 KB
/
signalZ.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
/**
* This is written by Zhiyang Ong to parse a STIL file into a FLAT tabular
* test pattern format that contains input test patterns for execution on
* automatic test equipment
*
* Function to parse files for static analysis, and generation of output
* file containing the test patterns for the automatic test equipment
*/
// Import Header files from the C++ STL
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <climits>
#include <cfloat>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <list>
#include <iterator>
#ifndef __SIGNAL_H
#define __SIGNAL_H
using namespace std;
// List of strings
typedef list<string> str_list;
// Pointer to list of strings
typedef list<string>::iterator str_l_p;
// =======================================================================
//class file_analyzer;
// Class definition...
class signalZ {
public:
// Defining constants...
static const string UNDEFINED;
static const string L;
static const string H;
static const string U;
static const string ONE;
static const string ZERO;
static const string X;
static const string Z;
static const string P;
static const string HASH;
static const string D_U;
static const string X_H_L;
static const string H_L;
static const string LH;
static const string XLH;
static const string ZERO_ONE;
/**
* Number of cycles needed to let the signal settle, or reach steady state
* This value is arbitrarily chosen, and will be system/ATE dependent;
* if it is required
*/
static const int NCYCLES = 3;
static const int LOGIC_ZERO = 0;
static const int LOGIC_ONE = 1;
static const int LOGIC_HIGH_IMPEDANCE = 2;
static const int LOGIC_UNDEFINED = 3;
// Default constructor
signalZ();
// Standard Constructor...
signalZ(string name);
// Define headers for functions...
void add_values(string s);
void add_char(char c);
string get_name();
void print_output_ln(ofstream &outputfile);
// Declare data structure to contain its waveform properties
struct wave_prop {
string time;
string logic_val;
};
// List of waveform/timing properties of the signal...
typedef list<wave_prop> wp_list;
// Pointer to list of waveform/timing properties
typedef list<wave_prop>::iterator wp_l_p;
// Add the waveform/timing properties of the signal to the list of signals
void add_wave_prop(wave_prop w);
// Obtain the waveform/timing properties of these signal
wp_list get_wave_prop();
// Obtain the triggering condition of the signal...
string get_trigger();
// Set the triggering condition of the signal...
void set_trigger(string t);
// Toggle between the odd/even signals
void toggle();
// Is this signal odd?
bool is_odd();
// Set the initial condition for the signal
void set_condition(string c);
// Get the initial condition for the signal
string get_condition();
// Is the condition met?
bool condition_met();
// Get the current condition
string current_condition();
// Add pattern to the list of signal patterns
void add_sig_patterns(string s);
// Is the condition equal to "P"?
bool is_condition_p();
// Check if list of signal patterns is empty
bool is_pattern_list_empty();
// Obtain the most recent signal pattern
string get_last_pattern();
// Obtain the values of the signal vector
string get_sig_values();
// Get the number of assigned signal patterns to this signal vector
int get_num_patterns();
// Get the assigned string patterns of this signal
str_list get_sig_patterns();
// Convert the waveform properties into signal values; Deprecated
void convert_wave_prop();
// Get the period of the signal
int get_sig_period();
// Set the period of the signal
void set_sig_period(int i);
/**
* Additional functions to handle waveform properties and logic values
* for the clock
*/
void clk_waveform(string logic);
void sig_vector(string logic);
void sig_waveform(string logic);
/**
* Clear the waveform properties of this signal as another clock signal waveform
* is loaded into it
*/
void clr_waveform_properties();
bool is_clk();
private:
// Declaration of instance variables...
// Name of signal
string sig_name;
// Values of signal
string sig;
// Triggering condition of the signal
string trigger;
// List of waveform/timing properties of the signal...
wp_list wpl;
/**
* Indicator of whether it is an odd/even signal in the list of input
* or output signals
*
* If it is an odd signal, it is true.
* Else, it is false
*
* Since the waveform signals may be defined based on a pair of values,
* the flag is necessary to alternate between odd and even signals
*/
bool sig_is_odd;
/**
* Condition of signal that must be met for the signal's value to be
* set from the signal vector
*/
string sig_condition;
// List of signal patterns
str_list s_p;
// Period of the signal
int sig_period;
};
#endif