RSIM Bug Report #15

Version of RSIM1.0
Bug number15
Bug class4
Date3/2/99
Reported byinternal
AffectsWrite ancillary state register instructions
Filespredecode_instr.cc , funcs.cc , except.cc

Problem Description

The implementation of the write ancillary state register instruction did not match the description given in the SPARC architecture reference. In particular, only one source register was accepted, whereas the reference requires the XOR of two source registers. (In practice, this does not seem to have affected any applications under the distribution version of RSIM, since this instruction [called arithS2 in RSIM] was only used for deprecated multiply and divide forms, and even then seems to have not used the 2nd source register for any non-zero value.)

Suggested work-around

This requires the following changes:

In predecode_instr.cc, replace the existing function arith_spec2 with the following:

int arith_spec2(instr *in, unsigned undec) { /* NOTE: arith_spec1 can either be write of some state register or a software-initiated reset. Here is the register mapping: rd register type 0 Y register (for old mul/div ops) 1 reserved 2 Condition Codes Reg (xcc/icc) 3 ASI reg 4,5 Ancillary state registers (reserved) 6 FP registers status register 7-14 Ancillary state regs (reserved) 15 Software initiated reset 16-31 imp-dep */ in->rd = STATE_REGISTERS + Extract(undec,29,25); /* this is all for write state register */ in->rs1 = Extract(undec,18,14); if (in->rd == STATE_CCR) { in->rd = COND_ICC; /* they're the same thing... */ } if ((in->aux1 = Extract(undec,13,13))) { in->imm = SE(Extract(undec,12,0),13); } else { in->rs2 = Extract(undec,4,0); } /* we will implement the other specialties later.... */ return 1; } In funcs.cc, in the function fnarithSPECIAL2, replace the expression inst->rdvali=inst->rs1vali; with:

if (inst->code->aux1) { inst->rdvali=inst->rs1vali ^ inst->code->imm; } else { inst->rdvali=inst->rs1vali ^ inst->rs2vali; } In except.cc, in the function ProcessSerializedInstruction, make the same change as in funcs.cc for the code in case iarithSPECIAL2 .