-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #270 from chetanya-goyal/main
Store simulation result file, return sim state from run
- Loading branch information
Showing
17 changed files
with
166 additions
and
17 deletions.
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
8 changes: 8 additions & 0 deletions
8
.github/scripts/expected_sim_outputs/temp-sense-gen/prePEX_sim_result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Temp Frequency Power Error | ||
-20.0 129.13698399282515 0.0001395741 0.0 | ||
0.0 812.2374949945864 0.000216328 -1.2889568113520866 | ||
20.0 3726.282213709738 0.000308484 -1.905159990787503 | ||
40.0 13548.077588756503 0.0004135831 -2.0993284842505844 | ||
60.0 40753.5328218765 0.0005294722 -1.884757884614622 | ||
80.0 104972.69292852504 0.0006544346 -1.288956811352108 | ||
100.0 238491.19025467758 0.0007871842 -0.3737931886616934 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
def compare_files(template_file, result_file, max_allowable_error) -> int: | ||
"""Checks if the generated simulation result file matches with | ||
the stored template file. | ||
Args: | ||
- 'template_file' (string): The stored template file | ||
- 'result_file' (string): The result file generated by the simulations | ||
- 'max_allowable_error' (float): The maximum allowable difference (percent error) in | ||
the values in both files | ||
Returns: | ||
- 'int': Returns 1 if the differences in readings (if any) is less than the 'max_allowable_error | ||
else returns 0 | ||
""" | ||
with open(template_file, 'r') as template, open(result_file, 'r') as result: | ||
next(template) | ||
next(result) | ||
|
||
for template_line, result_line in zip(template, result): | ||
template_data = [float(val) for val in template_line.split()] | ||
result_data = [float(val) for val in result_line.split()] | ||
|
||
if template_data[1] != 0.0: | ||
freq_diff = (abs(template_data[1] - result_data[1]) / template_data[1]) * 100 | ||
else: | ||
freq_diff = (abs(template_data[1] - result_data[1])) * 100 | ||
if template_data[2] != 0.0: | ||
power_diff = (abs(template_data[2] - result_data[2]) / template_data[2]) * 100 | ||
else: | ||
power_diff = (abs(template_data[2] - result_data[2])) * 100 | ||
if template_data[3] != 0.0: | ||
error_diff = (abs(template_data[3] - result_data[3]) / template_data[3]) * 100 | ||
else: | ||
error_diff = (abs(template_data[3] - result_data[3])) * 100 | ||
|
||
if freq_diff <= max_allowable_error and power_diff <= max_allowable_error and error_diff <= max_allowable_error: | ||
return 1 | ||
else: | ||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import subprocess | ||
import re | ||
|
||
def check_ngspice_version() -> int: | ||
last_known_version = "41+" | ||
result = subprocess.run(["ngspice", "--version"], capture_output=True, text=True) | ||
|
||
if result.returncode == 0: | ||
data = result.stdout.strip() | ||
match = re.search(r'ngspice-(\S+)', data) | ||
|
||
if match: | ||
ngspice_version = match.group(1) | ||
return ngspice_version == last_known_version | ||
else: | ||
print("Error parsing ngspice version.") | ||
else: | ||
print("Error getting ngspice version:", result.stderr) | ||
|
||
return 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters