aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyspecs/specsparse.py30
-rw-r--r--src/specs.cpp8
-rw-r--r--src/specs.h12
3 files changed, 20 insertions, 30 deletions
diff --git a/pyspecs/specsparse.py b/pyspecs/specsparse.py
index 91f4f4f..65fa6ce 100644
--- a/pyspecs/specsparse.py
+++ b/pyspecs/specsparse.py
@@ -55,7 +55,7 @@ def parse_vcd_dataframe(filename):
# print(f'top level scopes: {[x["name"] for x in scopes]}')
# print(f'top level probes: {[x["name"] for x in probes]}')
- is_wl_sweep = check_wl_sweep(probes)
+ is_wl_sweep = check_wl_sweep(top_scope)
has_wl = False
save_wl = False
@@ -255,25 +255,15 @@ def is_probe(data):
return False
return True
-def check_wl_sweep(probes):
- for probe in probes:
- # see if wavelength is part of probe attributes
- attrs = ["wavelength", "power", "abs", "phase"]
- lengths = {a:-1 for a in attrs}
- for signal in probe['children']:
- for a in attrs:
- if signal['name'] == a:
- lengths[a] = len( signal['data'] )
-
- match = False
- if lengths[attrs[1]] != -1:
- match = lengths[attrs[0]] == lengths[attrs[1]]
- if lengths[attrs[2]] != -1:
- match = lengths[attrs[0]] == lengths[attrs[2]]
-
- if match and lengths[attrs[0]] != 1:
- return True
- return False
+def check_wl_sweep(top_scope):
+ # Need to check that SystemC.analysis_type == 1 (CW sweep)
+ for child in top_scope['children']:
+ if child['name'] == 'analysis_type':
+ print(child)
+ analysis_type = child['data'][0][1]
+ print(f'analysis_type:{analysis_type}')
+ return analysis_type == 'b01'
+ raise ValueError('Expected to find key "analysis_type" in VCD trace.')
def vcd_get_data_vector(signal):
data = np.array([float(tup[1][1::]) for tup in signal['data']])
diff --git a/src/specs.cpp b/src/specs.cpp
index 2b9727d..c58fd10 100644
--- a/src/specs.cpp
+++ b/src/specs.cpp
@@ -374,10 +374,10 @@ inline void sc_trace(sc_trace_file *tf, const SPECSConfig &s, string parent_tree
parent_tree += (parent_tree.size() ? "." : "");
sc_trace(tf, s.default_abstol, parent_tree + "abstol");
sc_trace(tf, s.default_reltol, parent_tree + "reltol");
- sc_trace(tf, s.default_resolution_multiplier, parent_tree + "resolution_multiplier");
- sc_trace(tf, s.engine_timescale, parent_tree + "engine_timescale");
- sc_trace(tf, s.simulation_mode, parent_tree + "simulation_mode");
- sc_trace(tf, s.analysis_type, parent_tree + "analysis_type");
+ sc_trace(tf, (int&)s.default_resolution_multiplier, parent_tree + "resolution_multiplier");
+ sc_trace(tf, (int&)s.engine_timescale, parent_tree + "engine_timescale");
+ sc_trace(tf, (int&)s.simulation_mode, parent_tree + "simulation_mode");
+ sc_trace(tf, (int&)s.analysis_type, parent_tree + "analysis_type");
sc_trace(tf, s.trace_all_optical_nets, parent_tree + "trace_all_optical_nets");
sc_trace(tf, s.verbose_component_initialization, parent_tree + "verbose_component_initialization");
} \ No newline at end of file
diff --git a/src/specs.h b/src/specs.h
index fe56d6a..f2ae80a 100644
--- a/src/specs.h
+++ b/src/specs.h
@@ -73,10 +73,10 @@ public:
};
enum AnalysisType {
- ANALYSIS_TYPE_MINVAL,
- CW_OPERATING_POINT,
- CW_SWEEP,
- TIME_DOMAIN,
+ ANALYSIS_TYPE_MINVAL = -1,
+ CW_OPERATING_POINT = 0,
+ CW_SWEEP = 1,
+ TIME_DOMAIN = 2,
ANALYSIS_TYPE_MAXVAL,
// aliases
@@ -114,7 +114,7 @@ public:
// other
sc_signal<bool, SC_MANY_WRITERS> drop_all_events;
- bool verbose_component_initialization = true;
+ bool verbose_component_initialization = false;
SPECSConfig(sc_module_name name);
@@ -156,4 +156,4 @@ public:
sc_trace(sc_trace_file *tf, const SPECSConfig &s, string parent_tree);
};
-extern SPECSConfig specsGlobalConfig; \ No newline at end of file
+extern SPECSConfig specsGlobalConfig;