|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: // MPU (m88xx0)
8:
9: #pragma once
10:
11: #include "mpu.h"
12: #include "m88100.h"
13:
14: class MPU88xx0Device : public MPUDevice
15: {
1.1.1.2 root 16: using inherited = MPUDevice;
1.1 root 17: public:
18: MPU88xx0Device(uint32 reset_addr);
1.1.1.2 root 19: ~MPU88xx0Device() override;
1.1 root 20:
1.1.1.3 root 21: void MonitorUpdate(TextScreen&) override;
1.1 root 22:
23: // MPU を request サイクル分実行する
1.1.1.2 root 24: uint32 Run(uint64 request) override { return cpu->Run(request); }
1.1 root 25:
26: // 基準サイクル数を取得
1.1.1.4 ! root 27: uint64 total_cycle() const override { return cpu->GetTotalCycle(); }
1.1 root 28:
29: // MPU の処理をこの命令で中断させる。
1.1.1.2 root 30: void Release() override { cpu->Release(); }
1.1 root 31:
32: // 現在実行中の命令の PC を取得
1.1.1.4 ! root 33: uint32 GetPPC() const override { return cpu->GetXIP(); }
1.1 root 34:
35: // 現在アクセス中の論理アドレス、物理アドレスを取得。
1.1.1.2 root 36: uint32 GetLaddr() const override { return 0; } // XXX NotImplemented
37: uint32 GetPaddr() const override { return 0; } // XXX NotImplemented
1.1 root 38:
1.1.1.4 ! root 39: // アクセスウェイトを加算
! 40: void AddCycle(uint64 cycle) override;
! 41:
1.1 root 42: // 割り込み発生を MPU に通知
1.1.1.2 root 43: void Interrupt(Object *src, int level) override;
1.1 root 44:
45: // CPU コアを取得 (主にデバッグ用途)
46: m88kcpu *GetCPU() const { return cpu.get(); }
47:
48: private:
1.1.1.4 ! root 49: // リセット例外イベントコールバック
! 50: void ResetCallback(Event& ev);
! 51:
1.1 root 52: // リセットベクタ
1.1.1.4 ! root 53: uint32 reset_vector {};
1.1 root 54:
1.1.1.4 ! root 55: std::unique_ptr<m88kcpu> cpu {};
1.1 root 56: };
57:
1.1.1.2 root 58: // ATC モニタ
59: class MPU88200ATC : public Object
60: {
61: public:
62: MPU88200ATC(m88200 *cmmu);
63: ~MPU88200ATC() override { }
64:
1.1.1.3 root 65: void MonitorUpdate(TextScreen&) override;
1.1.1.2 root 66:
67: private:
1.1.1.4 ! root 68: m88200 *cmmu {};
1.1.1.2 root 69: };
70:
71: extern std::unique_ptr<MPU88200ATC> gMPU88200ATC[2];
72:
1.1 root 73: #define gMPU88xx0 (dynamic_cast<MPU88xx0Device *>(gMPU.get()))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.