mirror of
https://github.com/holub/mame
synced 2025-05-30 01:23:07 +03:00
130 lines
3.1 KiB
C++
130 lines
3.1 KiB
C++
// license:BSD-3-Clause
|
|
// copyright-holders:Patrick Mackinlay
|
|
|
|
#ifndef MAME_CPU_NS32000_COMMON_H
|
|
#define MAME_CPU_NS32000_COMMON_H
|
|
|
|
#pragma once
|
|
|
|
namespace ns32000
|
|
{
|
|
enum st_mask : unsigned
|
|
{
|
|
ST_ICI = 0x0, // bus idle (CPU busy)
|
|
ST_ICW = 0x1, // bus idle (CPU wait)
|
|
ST_ISE = 0x3, // bus idle (slave execution)
|
|
ST_IAM = 0x4, // interrupt acknowledge, master
|
|
ST_IAC = 0x5, // interrupt acknowledge, cascaded
|
|
ST_EIM = 0x6, // end of interrupt, master
|
|
ST_EIC = 0x7, // end of interrupt, cascaded
|
|
ST_SIF = 0x8, // sequential instruction fetch
|
|
ST_NIF = 0x9, // non-sequential instruction fetch
|
|
ST_ODT = 0xa, // operand data transfer
|
|
ST_RMW = 0xb, // read RMW operand
|
|
ST_EAR = 0xc, // effective address read
|
|
ST_SOP = 0xd, // slave operand
|
|
ST_SST = 0xe, // slave status
|
|
ST_SID = 0xf, // slave ID
|
|
|
|
ST_PT1 = 0xd, // access pte1 by MMU (32532)
|
|
ST_PT2 = 0xe, // access pte2 by MMU (32532)
|
|
ST_SLV = 0x10, // slave access ST4 (32532)
|
|
};
|
|
}
|
|
|
|
class ns32000_state_interface
|
|
{
|
|
public:
|
|
virtual void state_add(device_state_interface &parent, int &index) = 0;
|
|
};
|
|
|
|
class ns32000_fpu_interface
|
|
: public device_interface
|
|
, public ns32000_state_interface
|
|
{
|
|
protected:
|
|
ns32000_fpu_interface(machine_config const &mconfig, device_t &device)
|
|
: device_interface(device, "ns32000_fpu")
|
|
{
|
|
}
|
|
};
|
|
|
|
class ns32000_mmu_interface
|
|
: public device_interface
|
|
, public ns32000_state_interface
|
|
{
|
|
public:
|
|
enum translate_result : unsigned { COMPLETE, CANCEL, ABORT };
|
|
virtual translate_result translate(address_space &space, unsigned st, u32 &address, bool user, bool write, bool flag = false, bool suppress = false) = 0;
|
|
|
|
protected:
|
|
ns32000_mmu_interface(machine_config const &mconfig, device_t &device)
|
|
: device_interface(device, "ns32000_mmu")
|
|
{
|
|
}
|
|
};
|
|
|
|
class ns32000_slave_interface : public device_interface
|
|
{
|
|
public:
|
|
auto out_scb() { return m_out_scb.bind(); }
|
|
|
|
ns32000_slave_interface(machine_config const &mconfig, device_t &device)
|
|
: device_interface(device, "ns32000_slave")
|
|
, m_out_scb(*this)
|
|
{
|
|
}
|
|
|
|
enum slave_status : u16
|
|
{
|
|
SLAVE_Q = 0x0001, // quit (1=error)
|
|
SLAVE_L = 0x0004,
|
|
SLAVE_F = 0x0020,
|
|
SLAVE_Z = 0x0040,
|
|
SLAVE_N = 0x0080,
|
|
SLAVE_TS = 0x8000, // trap status (1=UND, 0=FPU)
|
|
|
|
SLAVE_OK = 0,
|
|
};
|
|
|
|
protected:
|
|
ns32000_slave_interface(machine_config const &mconfig, device_t &device, char const *type)
|
|
: device_interface(device, type)
|
|
, m_out_scb(*this)
|
|
{
|
|
}
|
|
|
|
devcb_write_line m_out_scb;
|
|
};
|
|
|
|
class ns32000_slow_slave_interface : public ns32000_slave_interface
|
|
{
|
|
public:
|
|
virtual void write_id(u16 data) = 0;
|
|
virtual void write_op(u16 data) = 0;
|
|
virtual u16 read_st(int *icount = nullptr) = 0;
|
|
virtual u16 read_op() = 0;
|
|
|
|
protected:
|
|
ns32000_slow_slave_interface(machine_config const &mconfig, device_t &device)
|
|
: ns32000_slave_interface(mconfig, device)
|
|
{
|
|
}
|
|
};
|
|
|
|
class ns32000_fast_slave_interface : public ns32000_slave_interface
|
|
{
|
|
public:
|
|
virtual u32 read_st32(int *icount = nullptr) = 0;
|
|
virtual u32 read() = 0;
|
|
virtual void write(u32 data) = 0;
|
|
|
|
protected:
|
|
ns32000_fast_slave_interface(machine_config const &mconfig, device_t &device)
|
|
: ns32000_slave_interface(mconfig, device)
|
|
{
|
|
}
|
|
};
|
|
|
|
#endif // MAME_CPU_NS32000_COMMON_H
|