From e0ebf93b2f323202ad73d06dfe16cae7c53d703c Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Mon, 31 Jul 2023 19:44:00 -0700 Subject: [PATCH] add support for pseudocode being a [[!inline]] directive --- src/openpower/decoder/pseudo/pagereader.py | 43 ++++++++++++++++++++-- src/openpower/decoder/pseudo/pywriter.py | 3 +- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/openpower/decoder/pseudo/pagereader.py b/src/openpower/decoder/pseudo/pagereader.py index b2fca28e..a3db0ffb 100644 --- a/src/openpower/decoder/pseudo/pagereader.py +++ b/src/openpower/decoder/pseudo/pagereader.py @@ -52,7 +52,7 @@ import os import re opfields = ("desc", "form", "opcode", "regs", "pcode", "sregs", "page", - "extra_uninit_regs") + "extra_uninit_regs", "pcode_fname") Ops = namedtuple("Ops", opfields) @@ -222,6 +222,7 @@ class ISA: l = lines.pop(0).rstrip() # get first line prefix_lines = 0 while lines: + pcode_fname = fname if self.verbose: print(l) # look for HTML comment, if starting, skip line. @@ -310,8 +311,7 @@ class ISA: # fix parser line numbers by prepending the right number of # blank lines to the parser input - li = [""] * prefix_lines - li += [l[4:]] # first line detected with 4-space + li = [""] * (prefix_lines + 1) while True: l = lines.pop(0).rstrip() prefix_lines += 1 @@ -325,13 +325,50 @@ class ISA: extra_uninit_regs.add(i) li.append("") continue + if l.startswith("[[!inline "): + li.append(l) + continue if l.strip().startswith('