|
|
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 (m680x0)
8:
9: #pragma once
10:
1.1.1.7 root 11: #include "event.h"
1.1 root 12: #include "mpu.h"
13: #include "m68030.h"
14:
15: class MPU680x0Device : public MPUDevice
16: {
1.1.1.2 root 17: using inherited = MPUDevice;
1.1 root 18: public:
1.1.1.7 root 19: MPU680x0Device();
1.1.1.5 root 20: virtual ~MPU680x0Device() override;
1.1 root 21:
1.1.1.2 root 22: bool Init() override;
1.1.1.7 root 23: bool PowerOn() override;
24: void ResetHard() override;
1.1 root 25:
1.1.1.5 root 26: // MPU を vtime [nsec] 分実行する
27: uint32 Run(uint32 vtime) override;
28:
29: // 現在の仮想時刻 [nsec] を取得する
1.1.1.6 root 30: uint64 GetVirtTime() const override;
1.1 root 31:
32: // 現在の PPC を取得
1.1.1.2 root 33: uint32 GetPPC() const override { return RegPPC; }
1.1 root 34:
35: // 現在アクセス中の論理アドレス、物理アドレスを取得。
1.1.1.2 root 36: uint32 GetLaddr() const override { return cpu->bus.laddr; }
37: uint32 GetPaddr() const override { return cpu->bus.paddr; }
1.1 root 38:
1.1.1.4 root 39: // アクセスウェイトを加算
1.1.1.5 root 40: void AddCycle(int32 cycle) override { cpu->used_cycle += cycle; }
1.1 root 41:
1.1.1.5 root 42: // 割り込みレベルが変わったことを MPU に通知
43: void Interrupt(int level) override;
1.1 root 44:
45: // MPU の処理をこの命令で中断させる。
46: // スケジューラのイベントリストに追加が発生した時に VM 側から
47: // MPU へ処理の中断を指示する。
1.1.1.2 root 48: void Release() override { cpu->atomic_reqflag |= CPU_REQ_RELEASE; }
1.1 root 49:
50: // A-Line, F-Line 命令エミュレーションのコールバックを指定する。
51: // (Human68k エミュレーションで使用)
52: void SetALineCallback(bool (*callback)(m68kcpu*, void*), void *arg);
53: void SetFLineCallback(bool (*callback)(m68kcpu*, void*), void *arg);
54:
1.1.1.2 root 55: // ダブルバスフォールトのコールバックを指定する。
56: void SetHaltCallback(void (*callback)(void*), void *arg);
57:
1.1 root 58: // FPU を持っているか
59: bool HaveFPU() const {
60: return cpu->has_fpu;
61: }
62:
63: // CPU コアを取得 (主にデバッグ用途)
64: m68kcpu *GetCPU() const {
65: return cpu;
66: }
67:
68: private:
1.1.1.5 root 69: // イベントコールバック
70: void Callback(Event& ev);
71:
1.1.1.7 root 72: // 割り込み用イベント
1.1.1.8 ! root 73: Event event { this };
! 74:
! 75: // レジスタモニター
! 76: DECLARE_MONITOR_CALLBACK(MonitorUpdateReg);
! 77: Monitor reg_monitor { this };
! 78:
! 79: // ATC モニター
! 80: DECLARE_MONITOR_CALLBACK(MonitorUpdateATC);
! 81: Monitor atc_monitor { this };
1.1.1.7 root 82:
1.1.1.5 root 83: // 割り込み確定のためのディレイ [nsec]
84: uint64 intdelay {};
1.1.1.4 root 85:
86: m68kcpu *cpu {};
1.1 root 87: };
88:
89: #define gMPU680x0 (dynamic_cast<MPU680x0Device *>(gMPU.get()))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.