Skip to main content

GitHub release (latest by date) PyPI Travis-CI

Introduction

MIPS-Simulator runs MIPS32 programs. Unlike real simulator, which assembles the instructions into machine code and executes them, MIPS-Simulator just parse the instructions and runs them using python code. In other words, MIPS-simulator actually interprets mips instructions.

https://raw.githubusercontent.com/CQU-AI/pymips/master/example.png

Note

  • This project is in its early stage, which means some functions may not supported yet.

Install

  • With pip : pip3 install fengyong

  • With src : Clone or fork this project, then build it with python3 setup.py install

Usage

Shell

After install, you can run a mips shell with mips-shell command.

Assemble

from fengyong import Assembler

instructions = """
j 10000
add $s0,$a1,$t7
sw $s1,10($s2)"""

machine_code = Assembler.encode(instructions)
print(machine_code.bin)
print(machine_code.value_base(16))

DisAssemble

from fengyong import DisAssembler
from fengyong import  RegData

machine_code = RegData("0x8002710af820ae51000a")
instructions = DisAssembler.decode(machine_code)
print(instructions)

Simulate - RUN!

from fengyong import Simulator


# Run mips instruction in line
Simulator.run_line("addi $s0, $s1, 10")

# Run asm file
Simulator.run_file("../test/drings.asm")

Simulate - Debug

from fengyong import Registers
from fengyong import RegData


# Set the register data
Registers.reg_set("$s0",RegData(100))

# Get the register data
res = Registers.reg_get("$s0")

# print all the "s" registers
Registers.print("s")

# print all registers
Registers.print()

Example

Contributing

Read CONTRIBUTING for more information.

Metadata

Release files for fengyong 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fengyong 1.3.0
File Size Uploaded Provenance
fengyong-1.3.0.tar.gz 10.9 kB Without provenance Details

Release files / fengyong-1.3.0.tar.gz

Download URL fengyong-1.3.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c50dff769e4344a986266fcc9162f6616ad377785cac42662448291bf07e57fc
BLAKE2b-256 checksum
How to use checksums
795ca0044006244c58e84a63c5cb3e129d90d564365d0faee4b8d336dd32fc9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

Security for fengyong 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page