oppc/code: drop explicit ctx argument
[openpower-isa.git] / src / openpower / exceptions.py
1 """exceptions
2 """
3 from nmutil.iocontrol import RecordObject
4 from nmigen import Signal
5 from collections import namedtuple
6
7 exc_types = ['alignment',
8 'instr_fault', # this one is not an actual exception
9 # but information *about* the type of
10 # exception that must be generated
11 'invalid',
12 'badtree',
13 'perm_error',
14 'rc_error',
15 'segment_fault',
16 'happened', # must be last: may overlap with Data.ok
17 ]
18
19 LDSTExceptionTuple = namedtuple("LDSTExceptionTuple", exc_types)
20
21 # https://bugs.libre-soc.org/show_bug.cgi?id=465
22 class LDSTException(RecordObject):
23 _exc_types = exc_types
24 def __init__(self, name=None):
25 RecordObject.__init__(self, name=name)
26 for f in self._exc_types:
27 setattr(self, f, Signal(name=f))
28 self.srr1 = Signal(64)
29 length = len(exc_types) + 64 # update this if adding anything else!