2021-01-15 23:16:01 +00:00
|
|
|
//
|
|
|
|
// Decoder.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
2021-01-17 03:09:19 +00:00
|
|
|
// Created by Thomas Harte on 30/12/20.
|
2021-01-15 23:16:01 +00:00
|
|
|
// Copyright © 2020 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef InstructionSets_PowerPC_Decoder_hpp
|
|
|
|
#define InstructionSets_PowerPC_Decoder_hpp
|
|
|
|
|
|
|
|
#include "Instruction.hpp"
|
|
|
|
|
2021-01-16 02:30:30 +00:00
|
|
|
namespace InstructionSet {
|
2021-01-15 23:16:01 +00:00
|
|
|
namespace PowerPC {
|
|
|
|
|
|
|
|
enum class Model {
|
|
|
|
/// i.e. 32-bit, with POWER carry-over instructions.
|
|
|
|
MPC601,
|
|
|
|
/// i.e. 32-bit, no POWER instructions.
|
|
|
|
MPC603,
|
|
|
|
/// i.e. 64-bit.
|
|
|
|
MPC620,
|
|
|
|
};
|
|
|
|
|
2022-03-21 14:41:17 +00:00
|
|
|
constexpr bool is64bit(Model model) {
|
|
|
|
return model == Model::MPC620;
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr bool is32bit(Model model) {
|
|
|
|
return !is64bit(model);
|
|
|
|
}
|
|
|
|
|
|
|
|
constexpr bool is601(Model model) {
|
|
|
|
return model == Model::MPC601;
|
|
|
|
}
|
|
|
|
|
2021-01-15 23:16:01 +00:00
|
|
|
/*!
|
|
|
|
Implements PowerPC instruction decoding.
|
|
|
|
|
|
|
|
This is an experimental implementation; it has not yet undergone significant testing.
|
|
|
|
*/
|
|
|
|
struct Decoder {
|
|
|
|
public:
|
|
|
|
Decoder(Model model);
|
|
|
|
|
|
|
|
Instruction decode(uint32_t opcode);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Model model_;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* InstructionSets_PowerPC_Decoder_hpp */
|