1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-06 12:07:57 +00:00
CLK/InstructionSets/PowerPC/Decoder.hpp

57 lines
1.2 KiB
C++
Raw Normal View History

2021-01-15 23:16:01 +00:00
//
// Decoder.hpp
// Clock Signal
//
// 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"
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,
};
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.
@c model Indicates the instruction set to decode.
2021-01-15 23:16:01 +00:00
@c validate_reserved_bits If set to @c true, check that all
2022-04-10 13:37:18 +00:00
reserved bits are 0 or 1 as required and produce an invalid opcode if not.
Otherwise does no inspection of reserved bits.
2021-01-15 23:16:01 +00:00
TODO: determine what specific models of PowerPC do re: reserved bits.
*/
template <Model model, bool validate_reserved_bits = false> struct Decoder {
Instruction decode(uint32_t opcode);
2021-01-15 23:16:01 +00:00
};
}
}
#endif /* InstructionSets_PowerPC_Decoder_hpp */