{"id":18813679,"url":"https://github.com/iabdullah215/16-bit-instruction-set-architecture-simulator","last_synced_at":"2026-01-12T13:30:18.601Z","repository":{"id":229556168,"uuid":"772097339","full_name":"iabdullah215/16-bit-Instruction-Set-Architecture-Simulator","owner":"iabdullah215","description":null,"archived":false,"fork":false,"pushed_at":"2024-03-25T04:40:54.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-30T00:28:40.399Z","etag":null,"topics":["cpp","instruction-set-architecture","instruction-set-simulator"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iabdullah215.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-14T14:30:18.000Z","updated_at":"2024-05-28T18:40:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"4979d0c1-b86d-46c1-afa3-e0bcb25f5bb5","html_url":"https://github.com/iabdullah215/16-bit-Instruction-Set-Architecture-Simulator","commit_stats":null,"previous_names":["iabdullah215/16-bit-instruction-set-architecture-simulator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iabdullah215%2F16-bit-Instruction-Set-Architecture-Simulator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iabdullah215%2F16-bit-Instruction-Set-Architecture-Simulator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iabdullah215%2F16-bit-Instruction-Set-Architecture-Simulator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iabdullah215%2F16-bit-Instruction-Set-Architecture-Simulator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iabdullah215","download_url":"https://codeload.github.com/iabdullah215/16-bit-Instruction-Set-Architecture-Simulator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239748343,"owners_count":19690245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","instruction-set-architecture","instruction-set-simulator"],"created_at":"2024-11-07T23:38:12.903Z","updated_at":"2025-02-19T23:19:56.765Z","avatar_url":"https://github.com/iabdullah215.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 16-bit-Instruction-Set-Architecture-Simulator\n\n# ISA Simulator\n\nThis C++ code simulates a simple Instruction Set Architecture (ISA) processor. Let's break down the code and understand its components and functionality.\n\n## Constants\nSeveral constants are defined at the beginning, including `MEMORY_SIZE` for the size of the memory, `REGISTER_COUNT` for the number of registers, and various opcode constants representing different instructions.\n\n## Class `ISA_Simulator`\nThis class represents the ISA simulator.\n- Private member variables:\n  - `memory`: A vector representing the memory of the simulated ISA machine.\n  - `registers`: A vector representing the registers of the simulated ISA machine.\n  - `pc`: An integer representing the program counter.\n- Public member functions:\n  - `ISA_Simulator()`: The constructor that initializes memory, registers, and the program counter.\n  - `void loadProgram(const std::vector\u003cshort\u003e\u0026 program)`: Loads a program into the memory.\n  - `void run()`: Executes the loaded program.\n  - `void printMemory() const`: Prints the content of the memory.\n  - `void printRegisters() const`: Prints the content of the registers.\n\n## `loadProgram` Function\nLoads the given program into the memory.\n\n## `run` Function\nExecutes the loaded program by iterating through memory instructions.\n- Fetches each instruction from memory, extracts the opcode and operand, and performs the corresponding operation.\n- The loop continues until the program counter reaches the end of the memory or a halt instruction is encountered.\n\n## `printMemory` Function\nPrints the content of the memory in hexadecimal format.\n\n## `printRegisters` Function\nPrints the content of the registers.\n\n## `main` Function\nCreates an instance of `ISA_Simulator`.\nDefines an example program using opcode constants and operand values.\nLoads the program into the simulator, runs it, and then prints the memory and registers after execution.\n\n## Example Program\nThe example program loads values from memory into registers, adds them, stores the result in memory and a register, and then halts.\nEach instruction in the program is represented by a short integer where the opcode occupies the upper 8 bits and the operand occupies the lower 8 bits.\n\nThis code provides a basic framework for simulating an ISA processor with a limited set of instructions and capabilities. It can be extended further to support additional instructions and features as needed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiabdullah215%2F16-bit-instruction-set-architecture-simulator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiabdullah215%2F16-bit-instruction-set-architecture-simulator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiabdullah215%2F16-bit-instruction-set-architecture-simulator/lists"}