diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-08-17 11:29:37 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2019-08-17 11:29:37 +0200 |
commit | f95853c8228ec8310a1142fe29eea85b765ea3b4 (patch) | |
tree | a6b16af5dcae6b7e10fd10d2af545a2f1f3abfbf /passes/pmgen/pmgen.py | |
parent | cd5a372cd18fe71cfa8428be59e355d82f34000d (diff) | |
download | yosys-f95853c8228ec8310a1142fe29eea85b765ea3b4.tar.gz yosys-f95853c8228ec8310a1142fe29eea85b765ea3b4.tar.bz2 yosys-f95853c8228ec8310a1142fe29eea85b765ea3b4.zip |
Add pmgen "fallthrough" statement
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'passes/pmgen/pmgen.py')
-rw-r--r-- | passes/pmgen/pmgen.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/passes/pmgen/pmgen.py b/passes/pmgen/pmgen.py index 6950a99c0..8401e1295 100644 --- a/passes/pmgen/pmgen.py +++ b/passes/pmgen/pmgen.py @@ -141,12 +141,23 @@ def process_pmgfile(f, filename): assert current_pattern is not None - if cmd == "subpattern": + if cmd == "fallthrough": block = dict() - block["type"] = "final" - block["pattern"] = (current_pattern, current_subpattern) + block["type"] = "fallthrough" blocks.append(block) line = line.split() + assert len(line) == 1 + continue + + if cmd == "subpattern": + if len(blocks) == 0 or blocks[-1]["type"] != "fallthrough": + block = dict() + block["type"] = "final" + block["pattern"] = (current_pattern, current_subpattern) + blocks.append(block) + elif len(blocks) and blocks[-1]["type"] == "fallthrough": + del blocks[-1] + line = line.split() assert len(line) == 2 current_subpattern = line[1] subpattern_args[(current_pattern, current_subpattern)] = list() |