2012-03-23 10:43:39 +00:00
|
|
|
#ifndef PROCESSOR_ARM_HPP
|
|
|
|
#define PROCESSOR_ARM_HPP
|
|
|
|
|
|
|
|
namespace Processor {
|
|
|
|
|
2015-06-24 13:21:24 +00:00
|
|
|
//Supported Models:
|
2015-07-01 10:58:42 +00:00
|
|
|
//* ARMv3 (ARM60)
|
|
|
|
//* ARMv4T (ARM7TDMI)
|
Update to v087r08 release.
byuu says:
Added some more ARM opcodes, hooked up MMIO. Bind it with mmio[(addr
000-3ff)] = this; inside CPU/PPU/APU, goes to read(), write().
Also moved the Hitachi HG51B core to processor/, and split it apart from
the snes/chip/hitachidsp implementation.
This one actually worked really well. Very clean split between MMIO/DMA
and the processor core. I may move a more generic DMA function inside
the core, not sure yet.
I still believe the HG51B169 to be a variant of the HG51BS family, but
given they're meant to be incredibly flexible microcontrollers, it's
possible that each variant gets its own instruction set.
So, who knows. We'll worry about it if we ever find another HG51B DSP,
I guess.
GBA BIOS is constantly reading from 04000300, but it never writes. If
I return prng()&1, I can get it to proceed until it hits a bad opcode
(stc opcode, which the GBA lacks a coprocessor so ... bad codepath.)
Without it, it just reads that register forever and keeps resetting the
system, or something ...
I guess we're going to have to try and get ARMwrestler working, because
the BIOS seems to need too much emulation code to do anything at all.
2012-03-24 07:52:36 +00:00
|
|
|
|
2012-03-23 10:43:39 +00:00
|
|
|
struct ARM {
|
2015-07-01 10:58:42 +00:00
|
|
|
enum : unsigned { //mode flags for bus_read, bus_write:
|
|
|
|
Nonsequential = 1, //N cycle
|
|
|
|
Sequential = 2, //S cycle
|
|
|
|
Prefetch = 4, //instruction fetch (eligible for prefetch)
|
|
|
|
Byte = 8, //8-bit access
|
|
|
|
Half = 16, //16-bit access
|
|
|
|
Word = 32, //32-bit access
|
|
|
|
Load = 64, //load operation
|
|
|
|
Store = 128, //store operation
|
|
|
|
};
|
2015-06-24 13:21:24 +00:00
|
|
|
|
2012-03-23 10:43:39 +00:00
|
|
|
#include "registers.hpp"
|
|
|
|
#include "instructions-arm.hpp"
|
|
|
|
#include "instructions-thumb.hpp"
|
|
|
|
#include "disassembler.hpp"
|
2015-06-24 13:21:24 +00:00
|
|
|
|
|
|
|
virtual auto step(unsigned clocks) -> void = 0;
|
2015-07-01 10:58:42 +00:00
|
|
|
virtual auto bus_idle() -> void = 0;
|
|
|
|
virtual auto bus_read(unsigned mode, uint32 addr) -> uint32 = 0;
|
|
|
|
virtual auto bus_write(unsigned mode, uint32 addr, uint32 word) -> void = 0;
|
2015-06-24 13:21:24 +00:00
|
|
|
|
|
|
|
//arm.cpp
|
|
|
|
auto power() -> void;
|
|
|
|
auto exec() -> void;
|
|
|
|
auto idle() -> void;
|
2015-07-01 10:58:42 +00:00
|
|
|
auto read(unsigned mode, uint32 addr) -> uint32;
|
|
|
|
auto load(unsigned mode, uint32 addr) -> uint32;
|
|
|
|
auto write(unsigned mode, uint32 addr, uint32 word) -> void;
|
|
|
|
auto store(unsigned mode, uint32 addr, uint32 word) -> void;
|
2015-06-24 13:21:24 +00:00
|
|
|
auto vector(uint32 addr, Processor::Mode mode) -> void;
|
|
|
|
|
|
|
|
//algorithms.cpp
|
|
|
|
auto condition(uint4 condition) -> bool;
|
|
|
|
auto bit(uint32 result) -> uint32;
|
|
|
|
auto add(uint32 source, uint32 modify, bool carry) -> uint32;
|
|
|
|
auto sub(uint32 source, uint32 modify, bool carry) -> uint32;
|
|
|
|
auto mul(uint32 product, uint32 multiplicand, uint32 multiplier) -> uint32;
|
|
|
|
auto lsl(uint32 source, uint8 shift) -> uint32;
|
|
|
|
auto lsr(uint32 source, uint8 shift) -> uint32;
|
|
|
|
auto asr(uint32 source, uint8 shift) -> uint32;
|
|
|
|
auto ror(uint32 source, uint8 shift) -> uint32;
|
|
|
|
auto rrx(uint32 source) -> uint32;
|
|
|
|
|
|
|
|
//step.cpp
|
2015-07-01 10:58:42 +00:00
|
|
|
auto pipeline_step() -> void;
|
2015-06-24 13:21:24 +00:00
|
|
|
auto arm_step() -> void;
|
|
|
|
auto thumb_step() -> void;
|
|
|
|
|
|
|
|
//serialization.cpp
|
|
|
|
auto serialize(serializer&) -> void;
|
|
|
|
|
2015-07-01 10:58:42 +00:00
|
|
|
bool trace = false;
|
|
|
|
uintmax_t instructions = 0;
|
2012-03-23 10:43:39 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|