From ae8e522eb04eec9356e41bd91d6eda84bfc07370 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 19 Jun 2020 15:21:15 +0100 Subject: [PATCH] add another bad hack in parser.py which identifies "undefined" slice assignment --- src/soc/decoder/pseudo/parser.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- 2.30.2