{"id":26017561,"url":"https://github.com/natelapak/risc-v_decoder","last_synced_at":"2026-04-15T14:33:10.262Z","repository":{"id":277879470,"uuid":"932568985","full_name":"NateLapak/RISC-V_Decoder","owner":"NateLapak","description":"Website that converts a binary or hexadecimal number into its RISC-V Instruction and vice versa","archived":false,"fork":false,"pushed_at":"2025-03-05T05:18:29.000Z","size":143,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T06:25:02.504Z","etag":null,"topics":["assembly","react","risc-v","tailwindcss","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/NateLapak.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":"2025-02-14T05:56:55.000Z","updated_at":"2025-03-05T05:18:33.000Z","dependencies_parsed_at":"2025-02-16T19:23:09.623Z","dependency_job_id":"75471d1a-1059-455f-b872-7777d1677e95","html_url":"https://github.com/NateLapak/RISC-V_Decoder","commit_stats":null,"previous_names":["natelapak/risc-v_decoder"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NateLapak%2FRISC-V_Decoder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NateLapak%2FRISC-V_Decoder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NateLapak%2FRISC-V_Decoder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NateLapak%2FRISC-V_Decoder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NateLapak","download_url":"https://codeload.github.com/NateLapak/RISC-V_Decoder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242150816,"owners_count":20080007,"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":["assembly","react","risc-v","tailwindcss","typescript"],"created_at":"2025-03-06T05:18:08.093Z","updated_at":"2026-04-15T14:33:10.227Z","avatar_url":"https://github.com/NateLapak.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RISC-V Decoder Website\nThis website converts a hexadecimal or binary number into a RISC-V Assembly instruction. \n\u003cbr/\u003e\nAfter taking CMPUT 229, I thought this would be\na good project to practice Typescript and RISC-V instruction conversion.\n\n## Algorithm to decode instruction\nHere is the algorithm I used to convert a binary or hex number to its RISC-V Instruction\n\n1. Extract binary or hex number inputted by user\n2. Determine opcode by extracting the lowest 6 bits of the 32-bit instruction\n3. Using the opcode, determine the instruction type (I-Type, R-Type, S-type, etc)\n4. Determine mnemonic of instruction by using funct3 and funct7 of instruction\n5. Translate decimal representation of registers to register name\n6. If instruction uses an immediate, combine parts to form the full immediate\n7. If immediate is negative, use Two's complement to convert\n8. Return resulting RISC-V Instruction and output it to user\n\n\n## Algorithm to encode instruction\nHere is the algorithm I used to convert a RISC-V instruction into its hexadecimal number\n\n1. Extract RISC-V Instruction inputted by user\n2. Split user input into 3 parts: The mnemonic, the registers, and the immediate (if applicable)\n2. Using the instruction's mnemonic, determine its opcode, funct3 and funct7.\n3. Translate the register name to its decimal representation\n4. Convert the immediate of instruction to binary\n5. If immediate is negative, use two's complement.\n6. Combine the opcode, funct3, funct7, registers, and immediate into 8 hexadecimal characters.\n7. Return resulting hexadecimal number and output it to user\n\n## Testing decode and encode functions\nUnit tests were done to ensure the correctness of the encode and decode functions in convert.ts. This was done using ts-jest, a Javascript or Typescript testing framework.\nTests are saved in the tests folder, found in /src/tests. \n\u003cbr/\u003e\nTo run the unit test, use npm test.\n\n## Tech stack\nList of programming languages and technolgies used\n\n    - HTML/CSS\n    - Typescript \n    - NextJS \n    - TailwindCSS\n    - Jest\n\nI decided to use Typescript to make translating assembly instructions type consistent.\n\n## Deploy on Vercel\n\nThe easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template\u0026filter=next.js\u0026utm_source=create-next-app\u0026utm_campaign=create-next-app-readme) from the creators of Next.js.\n\nCheck out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatelapak%2Frisc-v_decoder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnatelapak%2Frisc-v_decoder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnatelapak%2Frisc-v_decoder/lists"}