--- nono/m88xx0/m88200.h 2026/04/29 17:05:07 1.1.1.7 +++ nono/m88xx0/m88200.h 2026/04/29 17:05:15 1.1.1.8 @@ -8,11 +8,13 @@ #pragma once -#include "bus.h" +#include "device.h" +#include "mainbus.h" #include "monitor.h" #include -class m88kcpu; +class MPU88xx0Device; +class MainbusDevice; // SAPR, UAPR レジスタ struct m88200APR @@ -141,30 +143,29 @@ class m88200CacheSet int Lookup(uint32 tagaddr) const; }; -class m88200 : public Object +class m88200 : public Device { - using inherited = Object; + using inherited = Device; public: - m88200(); + m88200(MPU88xx0Device *parent_, uint id_); ~m88200() override; - // 本当はコンストラクタ渡ししたかったもの - void Ctor(m88kcpu *parent_); + bool Init() override; - // リセット + // リセット (ResetHard() ではない) void Reset(); - // モニター - Monitor reg_monitor { this }; - Monitor atc_monitor { this }; - Monitor cache_monitor { this }; - private: DECLARE_MONITOR_CALLBACK(MonitorUpdateReg); DECLARE_MONITOR_CALLBACK(MonitorUpdateATC); DECLARE_MONITOR_CALLBACK(MonitorUpdateCache); - m88kcpu *parent {}; + MPU88xx0Device *parent {}; + + // モニター + Monitor reg_monitor { this }; + Monitor atc_monitor { this }; + Monitor cache_monitor { this }; public: // @@ -187,10 +188,8 @@ class m88200 : public Object // IDR レジスタの内容を返す uint32 GetIDR() const { - return (id << 24) | (0x5 << 21); + return (id << 24) | (0x5 << 21) | (version << 16); } - // ID を設定する (IDR ではない) - void SetID(uint id_); // Version フィールドを設定する void SetVersion(uint version_); @@ -587,9 +586,6 @@ class m88200 : public Object // これは static 関数 static m88200 *GetBusMaster() { return mbus_master; } - // この CMMU からのアクセスにウェイトを加算する (VM から使う) - void AddCycle(int32 cycle); - private: void MBusAcquire(); void MBusRelease() { } @@ -598,6 +594,8 @@ class m88200 : public Object // バススヌープを行う (スレーブ側) void Snoop(uint32, int); + MainbusDevice *mainbus {}; + // MBus を所有してる CMMU を指す。NULL なら解放。 // これは static 変数で全 m88200 で共有している static m88200 *mbus_master;