[Libre-soc-bugs] [Bug 671] convert spec pseudocode to use XLEN width
bugzilla-daemon at libre-soc.org
bugzilla-daemon at libre-soc.org
Sun Aug 22 18:06:30 BST 2021
https://bugs.libre-soc.org/show_bug.cgi?id=671
--- Comment #5 from dmitry.selyutin at 3mdeb.com ---
I managed to "teach" parser and and lexer XLEN, but I doubt this is how we want
it to be handled.
diff --git a/src/openpower/decoder/pseudo/lexer.py
b/src/openpower/decoder/pseudo/lexer.py
index aad11a0..ce79e6a 100644
--- a/src/openpower/decoder/pseudo/lexer.py
+++ b/src/openpower/decoder/pseudo/lexer.py
@@ -326,6 +326,7 @@ class PowerLexer:
'INDENT',
'DEDENT',
'ENDMARKER',
+ 'XLEN',
)
# Build the lexer
@@ -398,6 +399,11 @@ class PowerLexer:
"default": "DEFAULT",
}
+ def t_XLEN(self, t):
+ r'XLEN'
+ t.type = self.RESERVED.get(t.value, "XLEN")
+ return t
+
def t_NAME(self, t):
r'[a-zA-Z_][a-zA-Z0-9_]*'
t.type = self.RESERVED.get(t.value, "NAME")
diff --git a/src/openpower/decoder/pseudo/parser.py
b/src/openpower/decoder/pseudo/parser.py
index 4f11f6f..61376ab 100644
--- a/src/openpower/decoder/pseudo/parser.py
+++ b/src/openpower/decoder/pseudo/parser.py
@@ -721,6 +721,10 @@ class PowerParser:
if name in regs + fregs:
self.read_regs.add(name)
+ def p_XLEN(self, p):
+ """atom : XLEN"""
+ p[0] = ast.Constant(64)
+
def p_atom_name(self, p):
"""atom : NAME"""
name = p[1]
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the libre-soc-bugs
mailing list