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
- Author: Alexandre Le Mercier
- Date: February 20, 2024
- Email: alexandre.le.mercier@ulb.be
- LinkedIn: Alexandre Le Mercier
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
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 microprocessors-0.1.8.tar.gz.
File metadata
- Download URL: microprocessors-0.1.8.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbcdf7b71f176fbb70473ca306511881e8c7f69d1b699b7e621813c615da0634
|
|
| MD5 |
073b0718e05840f55894a319d80f0b1d
|
|
| BLAKE2b-256 |
f5133f63b7a12f8753368c324c6ca0be9c1b8be99e0777d82226e19a36f8a54a
|
File details
Details for the file microprocessors-0.1.8-py3-none-any.whl.
File metadata
- Download URL: microprocessors-0.1.8-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c0a55076253b6955448eb7f4fc629bf7f36acbb2c1ee2b81b48b6912aa774f0
|
|
| MD5 |
879875145cba3f5cb0e9de9cdb414ab3
|
|
| BLAKE2b-256 |
2a549b068db5c287f0e2c188c42e172f80797930a4947fe5e8b08df7d584720d
|