data processing register
This commit is contained in:
parent
ce34f27fbd
commit
09956c7b2e
@ -75,6 +75,59 @@ word dpi(a64inst_instruction cI) {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
word dpr(a64inst_instruction cI) {
|
||||||
|
word out = 0;
|
||||||
|
a64inst_DPRegisterData data = cI.data.DPRegisterData;
|
||||||
|
// sf
|
||||||
|
int sf = data.regType;
|
||||||
|
// bits 27-25
|
||||||
|
out += 5*(2^25);
|
||||||
|
int m = data.DPROpType;
|
||||||
|
int opc = 0;
|
||||||
|
int opr = 0;
|
||||||
|
int rm = 0;
|
||||||
|
int operand = 0;
|
||||||
|
int rn = 0;
|
||||||
|
int rd = 0;
|
||||||
|
// multiply
|
||||||
|
if (m == 1) {
|
||||||
|
//opc = 0;
|
||||||
|
opr = 8;
|
||||||
|
if (data.processOpData.multiplydata.negProd) {
|
||||||
|
operand += 32;
|
||||||
|
}
|
||||||
|
operand += data.processOpData.multiplydata.summand;
|
||||||
|
}
|
||||||
|
// arithmetic and logical
|
||||||
|
else {
|
||||||
|
// shift
|
||||||
|
opr += 2*data.processOpData.arithmLogicData.shiftType;
|
||||||
|
// arithmetic
|
||||||
|
if (data.processOpData.arithmLogicData.type == 1){
|
||||||
|
opr += 8;
|
||||||
|
}
|
||||||
|
// logical
|
||||||
|
else {
|
||||||
|
if (data.processOpData.arithmLogicData.negShiftedSrc2) {
|
||||||
|
opr += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
operand += data.processOpData.arithmLogicData.shiftAmount;
|
||||||
|
}
|
||||||
|
rm += data.src1;
|
||||||
|
rn += data.src2;
|
||||||
|
rd += data.dest;
|
||||||
|
out += sf*(2^31);
|
||||||
|
out += opc * (2^29);
|
||||||
|
out += m* (2^28);
|
||||||
|
out += opr * (2^21);
|
||||||
|
out += rm * (2^16);
|
||||||
|
out += operand * 1024;
|
||||||
|
out += rn * 32;
|
||||||
|
out += rd;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
void secondPass(a64inst_instruction instrs[], int numInstrs, st* table){
|
void secondPass(a64inst_instruction instrs[], int numInstrs, st* table){
|
||||||
//TODO:
|
//TODO:
|
||||||
// iterate over instructions again, this time replacing labels
|
// iterate over instructions again, this time replacing labels
|
||||||
@ -86,6 +139,9 @@ void secondPass(a64inst_instruction instrs[], int numInstrs, st* table){
|
|||||||
case a64inst_DPIMMEDIATE:
|
case a64inst_DPIMMEDIATE:
|
||||||
dpi(cI);
|
dpi(cI);
|
||||||
break;
|
break;
|
||||||
|
case a64inst_DPREGISTER:
|
||||||
|
dpr(cI);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user