if regfile == 'CR':
# CRRegs register numbering is *unary* encoded
+ # *sigh*. numbering inverted on part-CRs. because POWER.
if name == 'full_cr': # full CR
return e.read_cr_whole, 0b11111111, 0b11111111
if name == 'cr_a': # CR A
- return e.read_cr1.ok, 1<<e.read_cr1.data, 1<<e.write_cr.data
+ return e.read_cr1.ok, 1<<(7-e.read_cr1.data), 1<<(7-e.write_cr.data)
if name == 'cr_b': # CR B
- return e.read_cr2.ok, 1<<e.read_cr2.data, None
+ return e.read_cr2.ok, 1<<(7-e.read_cr2.data), None
if name == 'cr_c': # CR C
- return e.read_cr3.ok, 1<<e.read_cr2.data, None
+ return e.read_cr3.ok, 1<<(7-e.read_cr2.data), None
if regfile == 'XER':
# XERRegs register numbering is *unary* encoded
# set up CR regfile, "direct" write across all CRs
cr = test.cr
- # sigh. Because POWER
- cr = int('{:032b}'.format(test.cr)[::-1], 2)
print ("cr reg", hex(cr))
for i in range(8):
- j = i
cri = (cr>>(j*4)) & 0xf
- # sigh. Because POWER
- cri = int('{:04b}'.format(cri)[::-1], 2)
print ("cr reg", hex(cri), i,
core.regs.cr.regs[i].reg.shape())
yield core.regs.cr.regs[i].reg.eq(cri)