From ce2a467088bb471c5a2fc13ce2cff94085c852be Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Sun, 7 Jun 2020 07:33:47 +0100 Subject: [PATCH] add TRAP function, stub --- src/soc/decoder/isa/caller.py | 5 +++++ src/soc/decoder/pseudo/parser.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index 61aa451a..ae5d479a 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -233,6 +233,11 @@ class ISACaller: self.decoder = decoder2.dec self.dec2 = decoder2 + def TRAP(self, trap_addr=0x700): + print ("TRAP: TODO") + # store PC in SRR0, set PC to 0x700 + # store MSR in SRR1, set MSR to um errr something + def memassign(self, ea, sz, val): self.mem.memassign(ea, sz, val) diff --git a/src/soc/decoder/pseudo/parser.py b/src/soc/decoder/pseudo/parser.py index daf75df6..d2466eac 100644 --- a/src/soc/decoder/pseudo/parser.py +++ b/src/soc/decoder/pseudo/parser.py @@ -333,6 +333,11 @@ class PowerParser: | expr_stmt""" if isinstance(p[1], ast.Call): p[0] = ast.Expr(p[1]) + elif isinstance(p[1], ast.Name) and p[1].id == 'TRAP': + # TRAP needs to actually be a function + name = ast.Name("self", ast.Load()) + name = ast.Attribute(name, "TRAP", ast.Load()) + p[0] = ast.Call(name, [], []) else: p[0] = p[1] -- 2.30.2