A library for building CPU emulators in Python
Project description
CPUBuilder
CPUBuilderは、Pythonで CPU エミュレータを作成するためのヘルパーライブラリです。 バイナリデータの操作、命令セットの定義、メモリ操作、デバッグ機能など、 CPUエミュレータの開発に必要な機能を提供します。
インストール方法
pip install cpubuilder
主な機能
- バイナリデータ操作ユーティリティ
- デコレータを使用した簡単な命令セット定義
- メモリ操作ヘルパー
- 充実したデバッグツール
使用例
命令セットの定義
from cpubuilder import InstructionBase, instruction
class MyInstructionSet(InstructionBase):
@instruction(opcode=0x00, cycles=1, description="No operation")
def nop(self):
pass
@instruction(opcode=0x10, cycles=2, description="Load immediate value")
def load_immediate(self, reg: int, value: int):
self.registers[reg] = value
メモリ操作
from cpubuilder import MemoryHelper
memory = MemoryHelper(size=65536)
memory.write(0x1000, 0xFF)
value = memory.read(0x1000)
デバッグ機能
from cpubuilder import DebugTools
debug = DebugTools()
debug.add_breakpoint(0x1000)
debug.add_watch("R0", lambda: cpu.registers[0])
debug.start_trace()
バイナリデータ操作
from cpubuilder import BinaryHelper
data = BinaryHelper.to_bytes(0xFF, 2)
value = BinaryHelper.extract_bits(0xFF, 4, 4)
ライセンス
このプロジェクトはMITライセンスの下で公開されています。
貢献
バグ報告や機能リクエストは、GitHubのIssueで受け付けています。 プルリクエストも歓迎です。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cpubuilder-0.1.0.tar.gz
(7.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cpubuilder-0.1.0.tar.gz.
File metadata
- Download URL: cpubuilder-0.1.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59fa3aed5351312276a383a63c15032ef5f42c7a385ed3b3d46ced103cb996b4
|
|
| MD5 |
3fb77e1938abd7f09d0c568e4d1d9cb9
|
|
| BLAKE2b-256 |
26432241ba1add19d045a46dca1804407fe4c411fca08ccb61ed9db36db0417c
|
File details
Details for the file cpubuilder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cpubuilder-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f47c410ab558e9f2e147cfd97289a01fd2e03db60bd226eff6e3dc54d2da5af9
|
|
| MD5 |
e3b336f1beaa53c4dcb735bf42d70a4d
|
|
| BLAKE2b-256 |
6402f136cd4c4198b74cc95d706583ee3f6f7d4b9f00804d4bc1076e97c4b0c0
|