1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-30 22:29:56 +00:00

Resolve final branch test: aa() applies.

This commit is contained in:
Thomas Harte 2022-03-25 20:10:08 -04:00
parent 1a5d3bb69c
commit 73ae7ad82f
2 changed files with 13 additions and 9 deletions

View File

@ -120,8 +120,9 @@ enum class Operation: uint8_t {
/// Branch conditional.
///
/// aa() determines whether the branch has a relative or absolute target.
/// lk() determines whether to update the link register.
/// bd() supplies a relative displacment.
/// bd() supplies a relative displacment or absolute address.
/// bi() specifies which CR bit to use as a condition; cf. the Condition enum.
/// bo() provides other branch options and a branch prediction hint as per (BranchOptions enum << 1) | hint.
///
@ -131,7 +132,7 @@ enum class Operation: uint8_t {
/// Branch conditional to count register.
///
/// bi(), bo() and lk() are as per bcx.
/// aa(), bi(), bo() and lk() are as per bcx.
///
/// On the MPC601, anything that decrements the count register will use the non-decremented
/// version as the branch target. Other processors will use the decremented version.
@ -139,7 +140,7 @@ enum class Operation: uint8_t {
/// Branch conditional to link register.
///
/// bi(), bo() and lk() are as per bcx.
/// aa(), bi(), bo() and lk() are as per bcx.
bclrx,
cmp, cmpi, cmpl, cmpli,

View File

@ -116,14 +116,14 @@ using namespace InstructionSet::PowerPC;
break;
case Operation::bcx: {
// if(instruction.aa()) {
// baseOperation = [baseOperation stringByAppendingString:@"a"];
// } else {
//
// }
uint32_t decoded_destination;
if(instruction.aa()) {
decoded_destination = instruction.bd();
} else {
decoded_destination = instruction.bd() + address;
}
const uint32_t destination = uint32_t(std::strtol([[columns lastObject] UTF8String], 0, 16));
const uint32_t decoded_destination = instruction.bd() + address;
XCTAssertEqual(decoded_destination, destination);
} break;
@ -136,6 +136,9 @@ using namespace InstructionSet::PowerPC;
if(instruction.lk()) {
baseOperation = [baseOperation stringByAppendingString:@"l"];
}
if(instruction.aa()) {
baseOperation = [baseOperation stringByAppendingString:@"a"];
}
if(instruction.branch_prediction_hint()) {
baseOperation = [baseOperation stringByAppendingString:@"+"];
}