From: Luke Kenneth Casson Leighton Date: Fri, 19 Jun 2020 14:21:15 +0000 (+0100) Subject: add another bad hack in parser.py which identifies "undefined" slice assignment X-Git-Tag: div_pipeline~313 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ae8e522eb04eec9356e41bd91d6eda84bfc07370;p=soc.git add another bad hack in parser.py which identifies "undefined" slice assignment --- diff --git a/src/soc/decoder/pseudo/parser.py b/src/soc/decoder/pseudo/parser.py index dae0e4e8..6446a2df 100644 --- a/src/soc/decoder/pseudo/parser.py +++ b/src/soc/decoder/pseudo/parser.py @@ -43,8 +43,13 @@ def Assign(autoassign, assignname, left, right, iea_mode): ass_list = [ast.AssName(name, 'OP_ASSIGN') for name in names] return ast.Assign([ast.AssTuple(ass_list)], right) elif isinstance(left, ast.Subscript): - res = ast.Assign([left], right) ls = left.slice + if (isinstance(ls, ast.Slice) and isinstance(right, ast.Name) and + right.id == 'undefined'): + # undefined needs to be copied the exact same slice + right = ast.Subscript(right, ls, ast.Load()) + return ast.Assign([left], right) + res = ast.Assign([left], right) if autoassign and isinstance(ls, ast.Slice): # hack to create a variable pre-declared based on a slice. # dividend[0:32] = (RA)[0:32] will create