projects
/
soc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
870ca8a
)
try again with adding XOR operator
author
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Sat, 4 Apr 2020 20:19:40 +0000
(21:19 +0100)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Sat, 4 Apr 2020 20:19:40 +0000
(21:19 +0100)
src/soc/decoder/power_pseudo.py
patch
|
blob
|
history
src/soc/decoder/pseudo/lexer.py
patch
|
blob
|
history
src/soc/decoder/pseudo/parser.py
patch
|
blob
|
history
src/soc/decoder/pseudo/pywriter.py
patch
|
blob
|
history
diff --git
a/src/soc/decoder/power_pseudo.py
b/src/soc/decoder/power_pseudo.py
index fc3f54103e67c8c782c8260611feb4fce53743ba..3bd52a3a6eac78dc476ea7066c766cfd27f0f5c9 100644
(file)
--- a/
src/soc/decoder/power_pseudo.py
+++ b/
src/soc/decoder/power_pseudo.py
@@
-134,12
+134,17
@@
MEM(EA, 4) <- GPR(r)[32:63]
#x <- x[0][32:63]
"""
#x <- x[0][32:63]
"""
+testdo = r"""
+for i = 0 to 7
+ print(i)
+"""
+code = testdo
#code = testmul
#code = testgetzero
#code = testcat
#code = testgpr
#code = testmem
#code = testmul
#code = testgetzero
#code = testcat
#code = testgpr
#code = testmem
-code = testgprslice
+
#
code = testgprslice
#code = testreg
#code = cnttzd
#code = cmpi
#code = testreg
#code = cnttzd
#code = cmpi
diff --git
a/src/soc/decoder/pseudo/lexer.py
b/src/soc/decoder/pseudo/lexer.py
index ee06c3f154578d84bd20a524f38c1defece8b274..3638a7fe4c285b02ed4bb775c087c927fbbed099 100644
(file)
--- a/
src/soc/decoder/pseudo/lexer.py
+++ b/
src/soc/decoder/pseudo/lexer.py
@@
-256,6
+256,7
@@
class PowerLexer:
'APPEND',
'BITOR',
'BITAND',
'APPEND',
'BITOR',
'BITAND',
+ 'BITXOR',
'RETURN',
'WS',
'NEWLINE',
'RETURN',
'WS',
'NEWLINE',
@@
-308,6
+309,7
@@
class PowerLexer:
t_APPEND = r'\|\|'
t_BITOR = r'\|'
t_BITAND = r'\&'
t_APPEND = r'\|\|'
t_BITOR = r'\|'
t_BITAND = r'\&'
+ t_BITXOR = r'\&'
# Ply nicely documented how to do this.
# Ply nicely documented how to do this.
diff --git
a/src/soc/decoder/pseudo/parser.py
b/src/soc/decoder/pseudo/parser.py
index 6abe1913a204d3bf7b6683e28fda08ae94fc4840..60a815c446be7e4a652d7566894fdf8403adb51c 100644
(file)
--- a/
src/soc/decoder/pseudo/parser.py
+++ b/
src/soc/decoder/pseudo/parser.py
@@
-107,6
+107,7
@@
def make_eq_compare(arg):
binary_ops = {
binary_ops = {
+ "^": ast.BitXor(),
"&": ast.BitAnd(),
"|": ast.BitOr(),
"+": ast.Add(),
"&": ast.BitAnd(),
"|": ast.BitOr(),
"+": ast.Add(),
@@
-209,6
+210,7
@@
class PowerParser:
precedence = (
("left", "EQ", "GT", "LT", "LE", "GE", "LTU", "GTU"),
("left", "BITOR"),
precedence = (
("left", "EQ", "GT", "LT", "LE", "GE", "LTU", "GTU"),
("left", "BITOR"),
+ ("left", "BITXOR"),
("left", "BITAND"),
("left", "PLUS", "MINUS"),
("left", "MULT", "DIV", "MOD"),
("left", "BITAND"),
("left", "PLUS", "MINUS"),
("left", "MULT", "DIV", "MOD"),
@@
-439,6
+441,7
@@
class PowerParser:
| comparison LT comparison
| comparison GT comparison
| comparison BITOR comparison
| comparison LT comparison
| comparison GT comparison
| comparison BITOR comparison
+ | comparison BITXOR comparison
| comparison BITAND comparison
| PLUS comparison
| comparison MINUS
| comparison BITAND comparison
| PLUS comparison
| comparison MINUS
diff --git
a/src/soc/decoder/pseudo/pywriter.py
b/src/soc/decoder/pseudo/pywriter.py
index d26074cf31ff2d7299e1a87e153779132af4b528..2f5cd3a46f494394d3415dad7c780885402652a7 100644
(file)
--- a/
src/soc/decoder/pseudo/pywriter.py
+++ b/
src/soc/decoder/pseudo/pywriter.py
@@
-80,8
+80,9
@@
class PyISAWriter(ISA):
if __name__ == '__main__':
isa = PyISAWriter()
if __name__ == '__main__':
isa = PyISAWriter()
- isa.write_pysource('fixed
store
')
+ isa.write_pysource('fixed
logical
')
exit(0)
exit(0)
+ isa.write_pysource('fixedstore')
isa.write_pysource('fixedload')
isa.write_pysource('comparefixed')
isa.write_pysource('fixedarith')
isa.write_pysource('fixedload')
isa.write_pysource('comparefixed')
isa.write_pysource('fixedarith')