restructure: get rid of cpu/utility

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-09-23 14:12:53 +05:30
parent 1e8966553f
commit 4e0fe4be03
11 changed files with 161 additions and 261 deletions

View File

@@ -60,9 +60,7 @@ GET_SET_NTH_BIT_FUNCTIONS(n, 31);
#undef GET_SET_NTH_BIT_FUNCTIONS
bool
Psr::condition(arm::Condition cond) const {
using arm::Condition;
Psr::condition(Condition cond) const {
switch (cond) {
case Condition::EQ:
return z();
@@ -93,9 +91,42 @@ Psr::condition(arm::Condition cond) const {
case Condition::LE:
return z() || (n() != v());
case Condition::AL:
return true;
return true && state() == State::Arm;
}
return false;
}
std::ostream&
operator<<(std::ostream& os, const Condition cond) {
#define CASE(cond) \
case Condition::cond: \
os << #cond; \
break;
switch (cond) {
CASE(EQ)
CASE(NE)
CASE(CS)
CASE(CC)
CASE(MI)
CASE(PL)
CASE(VS)
CASE(VC)
CASE(HI)
CASE(LS)
CASE(GE)
CASE(LT)
CASE(GT)
CASE(LE)
case Condition::AL: {
// empty
}
}
#undef CASE
return os;
}
}