From 9a2dfd830101b063688f83d9d457e39eb863721b Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 14 Jun 2021 22:46:57 +0100 Subject: [PATCH] series of text macro formats to look for: x.v, x.s (x) --- src/openpower/sv/trans/svp64.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/openpower/sv/trans/svp64.py b/src/openpower/sv/trans/svp64.py index a20d2840..7d2a7346 100644 --- a/src/openpower/sv/trans/svp64.py +++ b/src/openpower/sv/trans/svp64.py @@ -742,12 +742,33 @@ def macro_subst(macros, txt): while again: again = False for macro, value in macros.items(): - if macro == txt or ('(' in txt and macro in txt) or \ - (txt.endswith('.v') and macro in txt): + if macro == txt: again = True replaced = txt.replace(macro, value) print ("macro", txt, "replaced", replaced, macro, value) txt = replaced + continue + toreplace = '%s.s' % macro + if toreplace == txt: + again = True + replaced = txt.replace(toreplace, value) + print ("macro", txt, "replaced", replaced, toreplace, value) + txt = replaced + continue + toreplace = '%s.v' % macro + if toreplace == txt: + again = True + replaced = txt.replace(toreplace, value) + print ("macro", txt, "replaced", replaced, toreplace, value) + txt = replaced + continue + toreplace = '(%s)' % macro + if toreplace == txt: + again = True + replaced = txt.replace(toreplace, value) + print ("macro", txt, "replaced", replaced, toreplace, value) + txt = replaced + continue print (" processed", txt) return txt -- 2.30.2