Skip to content

Commit

Permalink
Fix behaviour after tools+run changes:
Browse files Browse the repository at this point in the history
- add tools.config for ltspice
- fix parameter name in node stack in read_source
- update relog.get_stats after update of log.svh
- update report template to remove errors
- fix analog sim in run
- update tb with log_*F1 and log_*F2
  • Loading branch information
LudwigCRON committed Aug 6, 2020
1 parent 74f55c8 commit 9c12eb3
Show file tree
Hide file tree
Showing 17 changed files with 148 additions and 111 deletions.
5 changes: 5 additions & 0 deletions analog/tools/ltspice/tools.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[actions]
sim = main

[ltspice]
format = raw
2 changes: 2 additions & 0 deletions analog/tools/ltspice_view/tools.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[actions]
view = main
1 change: 1 addition & 0 deletions analog/tools/ngspice/tools.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[actions]
18 changes: 13 additions & 5 deletions common/read_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,18 @@ def read_sources(filepath: str, graph: dict = {}, depth: int = 0):
parameter_value = []
op_increment = False
wait_new_line = False
beginning_of_line = True
continue_append = False
last_is_tag = False
node_stack = []
for type, token in tokens:
# indentation management
if type == TokenType.INDENT:
if type == TokenType.INDENT and beginning_of_line:
indent_level += 1
continue_append = False
# string or parameter value with '=' or '+='
elif type == TokenType.STRING:
beginning_of_line = False
if parameter_name is not None:
if op_increment or continue_append:
parameter_value.append(token)
Expand All @@ -268,11 +270,14 @@ def read_sources(filepath: str, graph: dict = {}, depth: int = 0):
node_stack.append(Node(path))
last_is_tag = True
continue_append = False
beginning_of_line = False
# received ':' so the file as dependences
elif type == TokenType.SEP:
node_stack.append(Node(path))
in_group = indent_level + 1
continue_append = False
if parameter_name is None:
node_stack.append(Node(path))
in_group = indent_level + 1
continue_append = False
beginning_of_line = False
# received '=' or '+=' so previous string is a parameter name
elif type == TokenType.PARAM_SEP:
if not wait_new_line:
Expand All @@ -288,6 +293,8 @@ def read_sources(filepath: str, graph: dict = {}, depth: int = 0):
else:
parameter_value.append("=")
continue_append = True
node_stack = []
beginning_of_line = False
elif type == TokenType.NEW_LINE:
if parameter_name:
_val = no.params[parameter_name.strip()]
Expand Down Expand Up @@ -319,7 +326,7 @@ def read_sources(filepath: str, graph: dict = {}, depth: int = 0):
no.addEdge(graph[path])
# stop dependencies check from ':'
# if empty line detected or wrong indentation
if (parameter_name is None) or (indent_level < in_group):
if indent_level < in_group:
while node_stack:
no.addEdge(node_stack.pop())
in_group = indent_level
Expand All @@ -330,6 +337,7 @@ def read_sources(filepath: str, graph: dict = {}, depth: int = 0):
op_increment = False
wait_new_line = False
continue_append = False
beginning_of_line = True
last_is_tag = False
# if in recursion
if depth > 0:
Expand Down
4 changes: 2 additions & 2 deletions common/relog.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ def get_stats(path: str):
with open(path, "r+") as fp:
k = 0
for k, l in enumerate(fp.readlines()):
if "Warning" in l:
if "WARNING" in l:
Warnings += 1
elif "Error" in l:
elif "ERROR" in l:
Errors += 1
return Warnings, Errors

Expand Down
6 changes: 3 additions & 3 deletions common/templates/report.html.mako
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ def get_block_name(block: dict):
<h1>${os.path.basename(os.getcwd())}</h1>
<h2>${datetime.now().strftime("%A, %d. %B %Y %H:%M")}</h2>
<p>
<em>Errors:</em>${"%d" % sum((b.get("errors") for b in blocks))}
<em>Errors:</em>${"%d" % sum((b.get("errors", 0) for b in blocks))}
<br>
<em>Warnings:</em>${"%d" % sum((b.get("warnings") for b in blocks))}
<em>Warnings:</em>${"%d" % sum((b.get("warnings", 0) for b in blocks))}
<br>
<em>Elapsed Time:</em>${to_time(sum((b.get("total_time") for b in blocks)))}
<em>Elapsed Time:</em>${to_time(sum((b.get("total_time", 0) for b in blocks)))}
</p>
<button id="expand_all_btn">Expand All</button>
<button id="close_all_btn">Close All</button>
Expand Down
4 changes: 2 additions & 2 deletions envs/bin/run
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def prepare_task(type: str = "sim", use_custom_logger: bool = False):
files, params = read_sources.read_from(CURRENT_DIR, no_logger=True)
# determine the type of simulation
digital_only = all((utils.files.is_digital(file) for file, _ in files))
analog_only = all((utils.files.is_digital(file) for file, _ in files))
analog_only = all((utils.files.is_analog(file) for file, _ in files))
if digital_only and not use_custom_logger:
files.insert(
0, (os.path.join(REFLOW_DIR, "digital/packages/log.svh"), "SYSTEM_VERILOG"),
Expand Down Expand Up @@ -263,7 +263,7 @@ if __name__ == "__main__":
if type is SimType.DIGITAL:
tool_name = Config.tools.get("DIG_COVERAGE")
else:
relog.error("Not yet implementd mixed signal or analog simulations")
relog.error("cannot coverage mixed signal or analog simulations")
exit(0)
# execute simulation
utils.tools.launch_tool(tool_name, "cov", NO_CALLBACKS, files, params)
Expand Down
Loading

0 comments on commit 9c12eb3

Please sign in to comment.