# [DRAFT] Prefix-code decode
-VA2-Form
+VA-Form
-* pcdec. RT,RA,RB,RC,once
+* pcdec. RT,RA,RB,RC
Pseudo-code:
tree[0:63] <- (RB)
+ mode <- tree[62:63]
+ tree[62:63] <- 0
ra_used <- 0b0
in_bits[0:63] <- (RC|0)
if in_bits = 0 then
in_bits[0:63] <- 1
- final_in_bits <- in_bits
- final_ra_used <- ra_used
- output <- [0] * 64
- out_byte <- 0
- decoded[0:7] <- 1
- so_bit <- 0b0
- early_stop <- 0b0
- do while out_byte < 8
+ orig_in_bits <- in_bits
+ tree_index <- 1
+ found <- 0b0
+ hit_end <- 0b0
+ do bit_length = 1 to 6
in_bit <- in_bits[63]
if in_bits = 1 then
if ra_used | (_RA = 0) then
- early_stop <- 0b1
- if decoded != 1 then # error: stopped in the middle of a code
- so_bit <- 0b1
+ hit_end <- 0b1
leave
ra_used <- 0b1
in_bit <- (RA)[63]
else
in_bits <- 0b0 || in_bits[0:62]
# walk the binary tree in `tree` from parent to the selected child
- decoded <- decoded[1:7] || in_bit
- if decoded <u 64 then
- if tree[63 - decoded] then
- final_in_bits <- in_bits
- final_ra_used <- ra_used
- output[56 - 8 * out_byte:63 - 8 * out_byte] <- decoded
- decoded[0:7] <- 1
- out_byte <- out_byte + 1
- if once then
- leave
- else
- so_bit <- 0b1
- early_stop <- 0b1
+ tree_index <- tree_index * 2
+ if in_bit = 1 then
+ tree_index <- tree_index + 1
+ if tree_index < 64 then
+ if tree[63 - tree_index] then
+ found <- 0b1
+ leave
+ compressed_index <- 0
+ do i = 0 to 127
+ if i = tree_index then
leave
- RT <- output
- RS <- final_in_bits
- CR0 <- final_ra_used || (output = 0) || early_stop || so_bit
+ else if i >= 64 then
+ compressed_index <- compressed_index + 1
+ else if tree[63 - i] = 1 then
+ compressed_index <- compressed_index + 1
+ switch(mode)
+ case(0):
+ RT[0:63] <- tree_index
+ if ¬found then
+ in_bits <- orig_in_bits
+ ra_used <- 0b0
+ case(1):
+ RT[0:63] <- tree_index
+ if hit_end then
+ in_bits <- orig_in_bits
+ ra_used <- 0b0
+ case(2):
+ RT[0:63] <- compressed_index
+ if ¬found then
+ in_bits <- orig_in_bits
+ ra_used <- 0b0
+ RT[0:63] <- tree_index
+ default:
+ RT[0:63] <- compressed_index
+ if hit_end then
+ in_bits <- orig_in_bits
+ ra_used <- 0b0
+ RS <- in_bits
+ CR0 <- ra_used || (tree_index >= 64) || found || hit_end
Special Registers Altered:
absdacs,NORMAL,,1P,EXTRA2,NO,d:RT;d:CR0,s:RA,s:RB,s:RT,RA,RB,RT,RT,0,CR0,0
absdacu,NORMAL,,1P,EXTRA2,NO,d:RT;d:CR0,s:RA,s:RB,s:RT,RA,RB,RT,RT,0,CR0,0
pcdec,NORMAL,,1P,EXTRA2,NO,d:RT;d:CR0,s:RA,s:RB,s:RC,RA,RB,RC,RT,0,CR0,0
-pcdec,NORMAL,,1P,EXTRA2,NO,d:RT;d:CR0,s:RA,s:RB,s:RC,RA,RB,RC,RT,0,CR0,0
ternlogi,NORMAL,,1P,EXTRA2,NO,d:RT;d:CR0,s:RA,s:RB,s:RT,RA,RB,RT,RT,0,CR0,0
ffmsubs,NORMAL,,1P,EXTRA2,NO,d:FRT;d:CR1,s:FRA,s:FRB,s:FRC,FRA,FRB,FRC,FRT,0,CR1,0
ffmadds,NORMAL,,1P,EXTRA2,NO,d:FRT;d:CR1,s:FRA,s:FRB,s:FRC,FRA,FRB,FRC,FRT,0,CR1,0
# 1.6.21.1 VA2-FORM
|0 |6 |11 |16 |21 |24|26 |31 |
| PO | RT | RA | RB | RC | XO | Rc |
- | PO | RT | RA | RB | RC | XO |once|
# 1.6.22 VC-FORM
|0 |6 |11 |16 |21|22 |31|
Field used by XO-form instructions to enable set-
ting OV and SO in the XER.
Formats: XO
- once (31)
- Once bit. Used by Prefix-code encode/decode instructions.
- 0 Decode/Encode multiple times per instruction.
- 1 Only Decode once per instruction
- Formats: VA2
PO (0:5)
Primary opcode field.
Formats: all
51,ALU,OP_MADDLD,RA,RB,RC,RT,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,1,0,NONE,0,0,maddld,VA,,,
52,ALU,OP_DIVMOD2DU,RA,RB,RC,RT,NONE,NONE,0,0,ZERO,0,NONE,0,0,0,0,1,0,NONE,0,0,divmod2du,VA,,1,unofficial until submitted and approved/renumbered by the opf isa wg
56,ALU,OP_PCDEC,RA,RB,RC,RT,NONE,CR0,0,0,ZERO,0,NONE,0,0,0,0,1,0,ONE,0,0,pcdec,VA2,,1,unofficial until submitted and approved/renumbered by the opf isa wg
-57,ALU,OP_PCDEC,RA,RB,RC,RT,NONE,CR0,0,0,ZERO,0,NONE,0,0,0,0,1,0,ONE,0,0,pcdec,VA2,,1,unofficial until submitted and approved/renumbered by the opf isa wg
xo6 = Signal(6)
comb += xo6.eq(self.dec.opcode_in[0:6])
with m.If((major == 4) & xo6.matches(
- '11100-', # pcdec
+ '111000', # pcdec
'110010', # maddedu
'110100', # divmod2du
)):
)
def pcdec(fields):
# XXX WARNING THESE ARE NOT APPROVED BY OPF ISA WG
- # 1.6.21.1 VA2-FORM
- # |0 |6 |11 |16 |21 |24|26 |31 |
- # | PO | RT | RA | RB | RC | XO |once|
+ # 1.6.21.1 VA-FORM
+ # |0 |6 |11 |16 |21 |24|26 |
+ # | PO | RT | RA | RB | RC | XO |
PO = 4
- XO = 0b11100
- (RT, RA, RB, RC, once) = fields
+ XO = 0b111000
+ (RT, RA, RB, RC, PCDc) = fields
return instruction(
(PO, 0, 5),
(RT, 6, 10),
(RA, 11, 15),
(RB, 16, 20),
(RC, 21, 25),
- (XO, 26, 30),
- (once, 31, 31),
+ (XO, 26, 31),
)
'sv.ld 5.v, 4(1.v)',
'sv.stw 5.v, 4(1.v)',
'sv.bc/all 3,12,192',
- 'pcdec. 0,0,0,0,0',
+ 'pcdec. 0,0,0,0',
]
isa = SVP64Asm(lst, macros=macros)
log("list:\n", "\n\t".join(list(isa)))
import functools
import itertools
-from openpower.test.common import TestAccumulatorBase
+from openpower.test.common import TestAccumulatorBase, skip_case
from openpower.sv.trans.svp64 import SVP64Asm
from openpower.test.state import ExpectedState
from openpower.simulator.program import Program
class PrefixCodesCases(TestAccumulatorBase):
+ @skip_case("FIXME(programmerjake): update for new pcdec. pseudocode")
def check_pcdec(self, supported_codes, input_bits, once, src_loc_at=0):
# type: (set[str], str, bool, int) -> None
original_input_bits = input_bits