from nmigen import Module, Elaboratable, Signal, Cat, Mux
from nmigen.cli import rtlil
from soc.decoder.power_enums import (Function, Form, InternalOp,
- In1Sel, In2Sel, In3Sel, OutSel, RC, LdstLen,
- CryIn, get_csv, single_bit_flags,
- get_signal_name, default_values)
+ In1Sel, In2Sel, In3Sel, OutSel,
+ RC, LdstLen, CryIn, get_csv,
+ single_bit_flags, CRInSel,
+ CROutSel, get_signal_name,
+ default_values)
from soc.decoder.power_fields import DecodeFields
from soc.decoder.power_fieldsn import SigDecode, SignalBitRange
self.in2_sel = Signal(In2Sel, reset_less=True)
self.in3_sel = Signal(In3Sel, reset_less=True)
self.out_sel = Signal(OutSel, reset_less=True)
+ self.cr_in = Signal(CRInSel, reset_less=True)
self.ldst_len = Signal(LdstLen, reset_less=True)
self.rc_sel = Signal(RC, reset_less=True)
self.cry_in = Signal(CryIn, reset_less=True)
# TODO: this conversion process from a dict to an object
# should really be done using e.g. namedtuple and then
# call eq not _eq
+ if row['CR in'] == '1':
+ import pdb; pdb.set_trace()
+ print(row)
res = [self.function_unit.eq(Function[row['unit']]),
self.form.eq(Form[row['form']]),
self.internal_op.eq(InternalOp[row['internal op']]),
self.in2_sel.eq(In2Sel[row['in2']]),
self.in3_sel.eq(In3Sel[row['in3']]),
self.out_sel.eq(OutSel[row['out']]),
+ self.cr_in.eq(CRInSel[row['CR in']]),
self.ldst_len.eq(LdstLen[row['ldst len']]),
self.rc_sel.eq(RC[row['rc']]),
self.cry_in.eq(CryIn[row['cry in']]),
self.in2_sel.eq(otherop.in2_sel),
self.in3_sel.eq(otherop.in3_sel),
self.out_sel.eq(otherop.out_sel),
+ self.cr_in.eq(otherop.cr_in),
self.rc_sel.eq(otherop.rc_sel),
self.ldst_len.eq(otherop.ldst_len),
self.cry_in.eq(otherop.cry_in)]
self.in2_sel,
self.in3_sel,
self.out_sel,
+ self.cr_in,
self.ldst_len,
self.rc_sel,
self.internal_op,
# names of the fields in the tables that don't correspond to an enum
-single_bit_flags = ['CR in', 'CR out', 'inv A', 'inv out',
+single_bit_flags = ['CR out', 'inv A', 'inv out',
'cry out', 'BR', 'sgn ext', 'upd', 'rsrv', '32b',
'sgn', 'lk', 'sgl pipe']
# default values for fields in the table
default_values = {'unit': "NONE", 'internal op': "OP_ILLEGAL",
'in1': "RA", 'in2': 'NONE', 'in3': 'NONE', 'out': 'NONE',
+ 'CR in': 'NONE',
'ldst len': 'NONE',
'rc': 'NONE', 'cry in': 'ZERO', 'form': 'NONE'}
ONE = 1
CA = 2
+@unique
+class CRInSel(Enum):
+ NONE = 0
+ CR0 = 1
+ BI = 2
+ BFA = 3
+ BA_BB = 4
+ BC = 5
+ WHOLE_REG = 6
+
+@unique
+class CROutSel(Enum):
+ NONE = 0
+ CR0 = 1
+ BF = 2
+ BT = 3
+ WHOLE_REG = 4
+
# SPRs - Special-Purpose Registers. See V3.0B Figure 18 p971 and
# http://libre-riscv.org/openpower/isatables/sprs.csv
import unittest
from soc.decoder.power_decoder import (create_pdecode)
from soc.decoder.power_enums import (Function, InternalOp,
- In1Sel, In2Sel,In3Sel,
- OutSel, RC, LdstLen, CryIn, single_bit_flags,
- get_signal_name, get_csv)
+ In1Sel, In2Sel, In3Sel,
+ CRInSel, CROutSel,
+ OutSel, RC, LdstLen, CryIn,
+ single_bit_flags,
+ get_signal_name, get_csv)
class DecoderTestCase(FHDLTestCase):
in2_sel = Signal(In2Sel)
in3_sel = Signal(In3Sel)
out_sel = Signal(OutSel)
+ cr_in = Signal(CRInSel)
rc_sel = Signal(RC)
ldst_len = Signal(LdstLen)
cry_in = Signal(CryIn)
in2_sel.eq(dut.op.in2_sel),
in3_sel.eq(dut.op.in3_sel),
out_sel.eq(dut.op.out_sel),
+ cr_in.eq(dut.op.cr_in),
rc_sel.eq(dut.op.rc_sel),
ldst_len.eq(dut.op.ldst_len),
cry_in.eq(dut.op.cry_in),
(in2_sel, In2Sel, 'in2'),
(in3_sel, In3Sel, 'in3'),
(out_sel, OutSel, 'out'),
+ (cr_in, CRInSel, 'CR in'),
(rc_sel, RC, 'rc'),
(cry_in, CryIn, 'cry in'),
(ldst_len, LdstLen, 'ldst len')]