Skip to main content

A simulation of the RiSC-16 (Ridiculously Simple Computer - 16 bit) processor.

Project description

Microprocessors

Example of Library Use

from microprocessors.architechture import RiSC16

risc = RiSC16()

# Properly queue instructions
risc.encode_instruction('ADDI', 1, 0, 5)  # R1 = 5
risc.encode_instruction('LUI', 2, None, 1)  # R2 = 1 << (16 - immediate_bits)
risc.encode_instruction('ADD', 3, 1, 2)  # R3 = R1 + R2
risc.encode_instruction('NAND', 4, 1, 2)  # R4 = ~(R1 & R2)
risc.encode_instruction('SW', 3, 0, 10)  # Memory[10] = R3
risc.encode_instruction('LW', 5, 0, 10)  # R5 = Memory[10]
risc.encode_instruction('BEQ', 1, 2, 2)  # if R1 == R2, skip next 2 instructions
risc.encode_instruction('ADDI', 6, 0, 1)  # R6 = 1 (skipped if R1 == R2)
risc.encode_instruction('JALR', 7, 0)  # R7 = PC + 1; PC = R0

# Run all and visalize register at final state
risc.run_program()
risc.visualize_state()

Documentation

Refer to the in-line comments and method docstrings for detailed usage of each feature.

Contribution

Contributions are welcome! Feel free to submit pull requests, suggest features, or report bugs.

License

This library is distributed under the MIT license. See LICENSE for more information.

Contact

Happy coding!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microprocessors-0.1.7.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

microprocessors-0.1.7-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file microprocessors-0.1.7.tar.gz.

File metadata

  • Download URL: microprocessors-0.1.7.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.2

File hashes

Hashes for microprocessors-0.1.7.tar.gz
Algorithm Hash digest
SHA256 0f86a177a2f10b85e364696509ad0dc12ff1f51a3941c0ca786977b84d2e1450
MD5 40b86071d9c7cd2d143cd7c15cce3431
BLAKE2b-256 3d5448c0c35da355262af0a30bd48833dc1feb33220853e5139b805d71579d02

See more details on using hashes here.

File details

Details for the file microprocessors-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for microprocessors-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 b5d6cae1d6eff9916d186ea3f2810d31a9394ad8519b34701ef07cc7d10f933f
MD5 08b0eb090833a6fc7ab4766dacf1942f
BLAKE2b-256 b0a963bd6e3d17d728b488d81b013586eae7833b6fc840a8c660c86b8d32ae66

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page