diff options
author | 2018-02-27 17:54:29 +0700 | |
---|---|---|
committer | 2018-02-27 17:54:29 +0700 | |
commit | 421d6dd2cc8d6c2999d26a7ee96eb6fd70a14cce (patch) | |
tree | f064d2ee9513384a01138b8380bfc418955b364d /src/devices/cpu/clipper/clipper.h | |
parent | 2bd73cc9775901c47bf73e237e501601f5ce2249 (diff) |
interpro: various improvements
Many changes, most notable end result is the ability to boot the "blue screen" rebuild floppy, and nearly booting CLIX (hangs trying to mount the filesystems).
Summary of changes:
* added a softlist
* refactored cpu/mmu memory access
* added alignment faults
* implemented most c400 instructions
* fixed wait instruction
* corrections to interpro driver
* removed broken forced interrupt handling
* added support for dma virtual addressing
Diffstat (limited to 'src/devices/cpu/clipper/clipper.h')
-rw-r--r-- | src/devices/cpu/clipper/clipper.h | 141 |
1 files changed, 47 insertions, 94 deletions
diff --git a/src/devices/cpu/clipper/clipper.h b/src/devices/cpu/clipper/clipper.h index 1781401fece..c1324d8ae27 100644 --- a/src/devices/cpu/clipper/clipper.h +++ b/src/devices/cpu/clipper/clipper.h @@ -10,6 +10,9 @@ #include "softfloat/milieu.h" #include "softfloat/softfloat.h" +#include "cpu/clipper/common.h" +#include "machine/cammu.h" + // convenience macros for dealing with the psw and ssw #define PSW(mask) (m_psw & PSW_##mask) #define SSW(mask) (m_ssw & SSW_##mask) @@ -17,22 +20,9 @@ class clipper_device : public cpu_device { public: - DECLARE_READ32_MEMBER(get_ssw) const { return m_ssw; } DECLARE_WRITE8_MEMBER(set_ivec) { m_ivec = data; } DECLARE_WRITE16_MEMBER(set_exception); - enum addressing_modes : u8 - { - ADDR_MODE_PC32 = 0x10, // pc relative with 32 bit displacement - ADDR_MODE_ABS32 = 0x30, // 32 bit absolute - ADDR_MODE_REL32 = 0x60, // relative with 32 bit displacement - ADDR_MODE_PC16 = 0x90, // pc relative with 16 bit displacement - ADDR_MODE_REL12 = 0xa0, // relative with 12 bit displacement - ADDR_MODE_ABS16 = 0xb0, // 16 bit absolute - ADDR_MODE_PCX = 0xd0, // pc indexed - ADDR_MODE_RELX = 0xe0 // relative indexed - }; - // branch conditions (first description for comparison, second for move/logical) enum branch_conditions : u8 { @@ -94,73 +84,21 @@ public: FR_3 = 0x00018000 // round toward zero }; - enum ssw : u32 + enum psw_dsp : u32 { - SSW_IN = 0x0000000f, // interrupt number (4 bits) - SSW_IL = 0x000000f0, // interrupt level (4 bits) - SSW_EI = 0x00000100, // enable interrupts - SSW_ID = 0x0001fe00, // cpu rev # and type (8 bits) - // unused (5 bits) - SSW_FRD = 0x00400000, // floating registers dirty - SSW_TP = 0x00800000, // trace trap pending - SSW_ECM = 0x01000000, // enable corrected memory error - SSW_DF = 0x02000000, // fpu disabled - SSW_M = 0x04000000, // mapped mode - SSW_KU = 0x08000000, // user protect key - SSW_UU = 0x10000000, // user data mode - SSW_K = 0x20000000, // protect key - SSW_U = 0x40000000, // user mode - SSW_P = 0x80000000 // previous mode + DSP_NONE = 0x00000000, // no delayed branch active + DSP_S1 = 0x00100000, // delayed branch slot 1 active + DSP_SALL = 0x00200000, // delayed branch slots 0 and 1 active + DSP_SETUP = 0x00300000 // delayed branch taken }; enum ssw_id : u32 { - SSW_ID_C400R0 = 0x00000, - SSW_ID_C400R1 = 0x04000, - SSW_ID_C400R2 = 0x08000, - SSW_ID_C400R3 = 0x0c000, - SSW_ID_C400R4 = 0x10000 - }; - - enum exception_vectors : u16 - { - // data memory trap group - EXCEPTION_D_CORRECTED_MEMORY_ERROR = 0x108, - EXCEPTION_D_UNCORRECTABLE_MEMORY_ERROR = 0x110, - EXCEPTION_D_ALIGNMENT_FAULT = 0x120, - EXCEPTION_D_PAGE_FAULT = 0x128, - EXCEPTION_D_READ_PROTECT_FAULT = 0x130, - EXCEPTION_D_WRITE_PROTECT_FAULT = 0x138, - - // floating-point arithmetic trap group - EXCEPTION_FLOATING_INEXACT = 0x180, - EXCEPTION_FLOATING_UNDERFLOW = 0x188, - EXCEPTION_FLOATING_DIVIDE_BY_ZERO = 0x190, - EXCEPTION_FLOATING_OVERFLOW = 0x1a0, - EXCEPTION_FLOATING_INVALID_OPERATION = 0x1c0, - - // integer arithmetic trap group - EXCEPTION_INTEGER_DIVIDE_BY_ZERO = 0x208, - - // instruction memory trap group - EXCEPTION_I_CORRECTED_MEMORY_ERROR = 0x288, - EXCEPTION_I_UNCORRECTABLE_MEMORY_ERROR = 0x290, - EXCEPTION_I_ALIGNMENT_FAULT = 0x2a0, - EXCEPTION_I_PAGE_FAULT = 0x2a8, - EXCEPTION_I_EXECUTE_PROTECT_FAULT = 0x2b0, - - // illegal operation trap group - EXCEPTION_ILLEGAL_OPERATION = 0x300, - EXCEPTION_PRIVILEGED_INSTRUCTION = 0x308, - - // diagnostic trap group - EXCEPTION_TRACE = 0x380, - - // supervisor calls (0x400-0x7f8) - EXCEPTION_SUPERVISOR_CALL_BASE = 0x400, - - // prioritized interrupts (0x800-0xff8) - EXCEPTION_INTERRUPT_BASE = 0x800 + SSW_ID_C400R0 = 0x00800, + SSW_ID_C400R1 = 0x04800, + SSW_ID_C400R2 = 0x08800, + SSW_ID_C400R3 = 0x0c800, + SSW_ID_C400R4 = 0x10800 }; // trap source values are shifted into the correct field in the psw @@ -230,13 +168,17 @@ protected: // device_disasm_interface overrides virtual util::disasm_interface *create_disassembler() override; + // mmu helpers + virtual cammu_device &get_icammu() const = 0; + virtual cammu_device &get_dcammu() const = 0; + // cpu execution logic bool decode_instruction(); virtual void execute_instruction(); bool evaluate_branch() const; // exception entry and return helpers - u32 intrap(const u16 vector, const u32 old_pc); + virtual u32 intrap(const u16 vector, const u32 old_pc); u32 reti(); // cpu state helpers @@ -248,11 +190,6 @@ protected: virtual int get_ireg_count() const { return 16; } virtual int get_freg_count() const { return 8; } - // exception vector and frame helpers - virtual int get_eframe_size() const { return 12; } - virtual int get_evpc_offset() const { return 0; } - virtual int get_evssw_offset() const { return 4; } - // floating point helpers float32 get_fp32(const u8 reg) const { return m_f[reg & 0xf]; } float64 get_fp64(const u8 reg) const { return m_f[reg & 0xf]; } @@ -317,11 +254,9 @@ protected: }; // emulation state - address_space_config m_insn_config; - address_space_config m_data_config; - - address_space *m_insn; - address_space *m_data; + address_space_config m_main_config; + address_space_config m_io_config; + address_space_config m_boot_config; enum registers { @@ -333,6 +268,7 @@ protected: }; int m_icount; // instruction cycle count + bool m_wait; // program-visible cpu state u32 m_pc; // current instruction address @@ -372,12 +308,28 @@ class clipper_c100_device : public clipper_device { public: clipper_c100_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + virtual cammu_device &get_icammu() const override { return *m_icammu; } + virtual cammu_device &get_dcammu() const override { return *m_dcammu; } + +private: + required_device<cammu_device> m_icammu; + required_device<cammu_device> m_dcammu; }; class clipper_c300_device : public clipper_device { public: clipper_c300_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + +protected: + virtual cammu_device &get_icammu() const override { return *m_icammu; } + virtual cammu_device &get_dcammu() const override { return *m_dcammu; } + +private: + required_device<cammu_device> m_icammu; + required_device<cammu_device> m_dcammu; }; class clipper_c400_device : public clipper_device @@ -386,19 +338,20 @@ public: clipper_c400_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); protected: + virtual u32 intrap(const u16 vector, const u32 old_pc) override; + // C400 has additional 8 floating point registers virtual int get_freg_count() const override { return 16; } - // C400 creates a 24 byte exception frame (C100/C300 is 12 bytes), but the - // service routine must increment sp by 12 prior to executing reti - // exception frame size - virtual int get_eframe_size() const override { return 24; } + virtual void execute_instruction() override; - // C400 pc and ssw are reversed in exception vector compared to C100/C300 - virtual int get_evpc_offset() const override { return 4; } - virtual int get_evssw_offset() const override { return 0; } + virtual cammu_device &get_icammu() const override { return *m_cammu; } + virtual cammu_device &get_dcammu() const override { return *m_cammu; } - virtual void execute_instruction() override; +private: + u32 m_db_pc; // delayed branch pc + + required_device<cammu_device> m_cammu; }; DECLARE_DEVICE_TYPE(CLIPPER_C100, clipper_c100_device) |