diff options
| author | Clément Zrounba <clement.zrounba@ec-lyon.fr> | 2023-11-14 17:48:26 +0000 |
|---|---|---|
| committer | Clément Zrounba <clement.zrounba@ec-lyon.fr> | 2023-11-14 18:17:32 +0000 |
| commit | ce5bd6f52ec438ae21ff38181c465e0ea40a4a36 (patch) | |
| tree | 7a39d0fe6dc36818cf335dd771d73bd4186a794b | |
| parent | c8450b94be661a6d9d9d2718cc16befa4a5abae9 (diff) | |
| download | specs-ce5bd6f52ec438ae21ff38181c465e0ea40a4a36.tar.gz specs-ce5bd6f52ec438ae21ff38181c465e0ea40a4a36.zip | |
Fix reporting of specs settings in tracefile
- Seems like an `(int&)` cast was necessary to correctly trace the value
of the enum ?
- pyspecs was updated to use the available top-level values instead of
convoluted checks
| -rw-r--r-- | pyspecs/specsparse.py | 30 | ||||
| -rw-r--r-- | src/specs.cpp | 8 | ||||
| -rw-r--r-- | src/specs.h | 12 |
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; |
