From 4ceba0ab1d32caff72a0a4ac8f8d399f07f9ac0d Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 3 Apr 2020 17:20:23 +0100 Subject: [PATCH] corrections to lte / gte --- libreriscv | 2 +- src/soc/decoder/power_pseudo.py | 7 +++++++ src/soc/decoder/pseudo/parser.py | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libreriscv b/libreriscv index df8dbe52..9518ccbc 160000 --- a/libreriscv +++ b/libreriscv @@ -1 +1 @@ -Subproject commit df8dbe52a4a201d4e23e50de5ffd84c01b54cb57 +Subproject commit 9518ccbc93df4c69ae0b715075e8a25fc3c98ef9 diff --git a/src/soc/decoder/power_pseudo.py b/src/soc/decoder/power_pseudo.py index 32479e57..ee527f0e 100644 --- a/src/soc/decoder/power_pseudo.py +++ b/src/soc/decoder/power_pseudo.py @@ -79,6 +79,13 @@ in_range <- ((x | y) & in_range <- (x + y) - (a + b) """ +cmpi = """ +(RA)[0:1] <- 1 +src1 <- EXTZ((RA)[56:63]) +CR[4*BF+32] <- 0b0 +in_range <- src21lo <= src1 & src1 <= src21hi +""" + #code = testreg #code = cnttzd code = cmpi diff --git a/src/soc/decoder/pseudo/parser.py b/src/soc/decoder/pseudo/parser.py index e752aff8..59da968d 100644 --- a/src/soc/decoder/pseudo/parser.py +++ b/src/soc/decoder/pseudo/parser.py @@ -80,10 +80,10 @@ def Assign(left, right): def make_le_compare(arg): (left, right) = arg - return ast.Compare(left, [ast.Le()], [right]) + return ast.Compare(left, [ast.LtE()], [right]) def make_ge_compare(arg): (left, right) = arg - return ast.Compare(left, [ast.Ge()], [right]) + return ast.Compare(left, [ast.GtE()], [right]) def make_lt_compare(arg): (left, right) = arg return ast.Compare(left, [ast.Lt()], [right]) @@ -356,7 +356,7 @@ class PowerParser: elif p[2] == '||': l = check_concat(p[1]) + check_concat(p[3]) p[0] = ast.Call(ast.Name("concat"), l, []) - elif p[2] in ['<', '>', '=']: + elif p[2] in ['<', '>', '=', '<=', '>=']: p[0] = binary_ops[p[2]]((p[1],p[3])) else: p[0] = ast.BinOp(p[1], binary_ops[p[2]], p[3]) -- 2.30.2