--- tags: computer-arch --- # Assignment3: single-cycle RISC-V CPU > Due: ==Dec 1, 2023== :::danger :warning: This assignment is quite challenging, and it is recommended that you dedicate a minimum of **3 full days** to complete it. Otherwise, it may be difficult to produce a meaningful outcome. ::: ## Requirements 1. Following the instructions in [Lab3: Construct a single-cycle RISC-V CPU with Chisel](https://hackmd.io/@sysprog/r1mlr3I7p), engage with the [Chisel Tutorial](https://github.com/ucb-bar/chisel-tutorial) by completing the provided exercises. * Make sure you have already completed the exercises from Part 1 to Part 3.6 and are familiar with Chisel/Scala. * **Avoid frequent Google searches**, as the provided materials on the lab page are curated to facilitate your learning experience. Simply focus on learning by actively engaging with the prepared materials. * You may encounter various challenges during this process. Please review the [GitHub issues](https://github.com/freechipsproject/chisel-bootcamp/issues) and make note of your observations. * Describe the operation of 'Hello World in Chisel' and enhance it by incorporating logic circuit. 2. Adhering to the guidance provided in [Lab3: Construct a single-cycle RISC-V CPU with Chisel](https://hackmd.io/@sysprog/r1mlr3I7p), incorporate the code within the `// lab3` section in `src/main/scala/riscv/core/*.scala` to pass the corresponding unit tests. This hands-on approach encourages you to learn by actively participating in the process, enhancing your understanding of the subject matter. * **Refrain from copying and pasting your solution directly into the HackMD note**. Instead, provide a concise summary of the various test cases, outlining the aspects of the CPU they evaluate, the techniques employed for loading test program instructions, and the outcomes of these test cases. * For signals involved in filling in the blanks, use the testing framework to output waveform diagrams and describe the changes in key signals of corresponding components when executing different instructions. * Fork the GitHub repository [ca2023-lab3](https://github.com/sysprog21/ca2023-lab3) and make commits that correspond to your ongoing efforts accordingly. The progress should always be publicly visible and transparent. $\to$ Read the GitHub documentation, such as [Fork a repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo). 3. Modify the handwritten RISC-V assembly code in [Homework2](https://hackmd.io/@sysprog/2023-arch-homework2) to ensure it functions correctly on the single-cycle RISC-V CPU aka "MyCPU" designed during [Lab3: Construct a single-cycle RISC-V CPU with Chisel](https://hackmd.io/@sysprog/r1mlr3I7p). Keep the modified code in the `csrc` directory. * Extend the Scala code in `src/test/scala/riscv/singlecycle/CPUTest.scala` to include additional test items related to your modified RISC-V assembly program. Ensure you compile it into an ELF file, which will later be converted into a binary file using the objcopy utility. Refer to the `FibonacciTest` as an example to see how to extend the [ChiselScalatestTester](https://index.scala-lang.org/ucb-bar/chiseltest) for testing the `src/main/resources/fibonacci.asmbin` program. * Execute your program using Verilator and analyze the signals by examining the waveform diagrams. Describe the variations in key signals of the respective components when different instructions are executed. * To ensure compatibility between the programs used in [Homework2](https://hackmd.io/@sysprog/2023-arch-homework2) and MyCPU, you should remove the `RDCYCLE`/`RDCYCLEH` instructions. Alternatively, you can expand the CPU's functionality by implementing the relevant CSR instructions, which would enable the execution of `RDCYCLE`/`RDCYCLEH` instructions on MyCPU. 5. Write down your thoughts and progress in [HackMD notes](https://hackmd.io/s/features). - Of course, you MUST write in English. - **Avoid using screenshots that solely contain plain text**. Here are the reasons why: * Text-based content is more efficiently searchable than having to browse through images iteratively. * The rendering engine of HackMD can consistently generate well-structured layouts with annotated text instead of relying on arbitrary pictures. * It provides a more accessible and user-friendly experience for individuals with visual impairments. 6. BONUS: Enhance MyCPU to provide improved ecall/break support, enabling RISC-V programs to make system calls similar to the functionalities available in [rv32emu](https://github.com/sysprog21/rv32emu). ## Fill in the table for your homework > :warning: Pay attention to spacing: separate each item with ==`|`==. This means there should be exactly two single space characters both before and after the `|` character. | Formal <br>(given) name | HackMD note | | ----------------- |-------------| | 廖泓博 | [Homework3](https://hackmd.io/@kc71486/computer_architecture_hw3) | | 黃柏叡 | [Homework3](https://hackmd.io/@coding-ray/2023-ca-hw-3) | | 陳金諄 | [Homework3](https://hackmd.io/@david96514/rkR8pOj4a) | | 張澤家 | [Homework3](https://hackmd.io/@NeedSleep/single_cycle_CPU) | | 洪胤勛 | [Homework3](https://hackmd.io/@KXkA4u0LQuyNTwOorDw2RA/HyNM1bP4p) | | 洪佑杭 | [Homework3](https://hackmd.io/@hungyuhang/risc-v-hw3) | | 侯廷翰 | [Homework3](https://hackmd.io/@M1Il4baLQwe1hoqHMQez_g/ry4AoCF4a) | | 盧俊銘 | [Homework3](https://hackmd.io/@jimmylu0303/assignment3) | | 李冠澄 | [Homework3](https://hackmd.io/@Kuanch/computer_architecture_hw3) | | 鍾沅熹 | [Homework3](https://hackmd.io/@freshLiver/2023-arch-hw3) | | 洪碩星 | [Homework3](https://hackmd.io/@shhung/rkSkyLDmT) | | 魏泳禎 | [Homework3](https://hackmd.io/@qOvjgDvTQrGZGAlv5oHqsA/Hyx4kg6E6) | | 楊宇翔 | [Homework3](https://hackmd.io/@5HlvW0J1QTmqg6azf_URYQ/SyFgZCZB6) | | 林柏全 | [Homework3](https://hackmd.io/@c3qLIGuDRtWykAmg5L50Ww/HJPmqdEEp) | | 倪英智 | [Homework3](https://hackmd.io/@NIYINGCHIH/Byj_kagST) | | 劉智恩 | [Homework3](https://hackmd.io/@chihenliu/ry1gyfzSa) | | 蕭明祥 | [Homework3](https://hackmd.io/@TXKjP2SFR8O-nS9pbDQAjw/rJGRLi646) | | 陳彥佑 | [Homework3](https://hackmd.io/@yAB_kQtlST6mqZV2uCHm3Q/Sy8s5fYEa) | | 陳燦仁 | [Homework3](https://hackmd.io/@TRChen/r1l9vksV6) | | 戴鈞彥 | [Homework3](https://hackmd.io/@ranvd/computer-arch-hw3)| | 廖華鑫 | [Homework3](https://hackmd.io/@bTrULUl4Q3OpYASGDynLwg/rkudQCTVT) | | 李承泰 | [Homework3](https://hackmd.io/@Iann2000/hw3-single-cycle-CPU) | | 林子勝 | [Homework3](https://hackmd.io/@zisheng/Bk5Gg_7Sa) | | 簡志耀 | [Homework3](https://hackmd.io/@RayqVUcSSOiX_pVJKh0DLg/H1ys_2lSa) | | 林允顥 | [Homework3](https://hackmd.io/@fewletter/single_cycle_riscvcpu) | | 蔡忠翰 | [Homework3](https://hackmd.io/@jeremytsai/computer_architecture_hw3) $\to$ [Publish a Note with Permalink](https://hackmd.io/c/tutorials/%2Fs%2Fhow-to-publish-note).<br> Check the URL carefully. | | 施柏安 | [Homework3](https://hackmd.io/@brianPA/S1mCIJbEp) | | 高紹捷 | [Homework3](https://hackmd.io/@kkkkk1109/Assignment_3) | | 李熙堃 | [Homework3](https://hackmd.io/@JoshuaLee0321/ca2023-lab3) | | 鄭吉廷 | [Homework3](https://hackmd.io/@2ytPc3wiSXuOhkj2eWyplA/HkMEtvGr6) | | 林勁羽 | [Homework3](https://hackmd.io/@edenlin/Construct_a_Single-Cycle_RISC-V_CPU_with_Chisel) | | 陳川曜 | [Homework3](https://hackmd.io/@cychen/computer_architecture_hw3) | | 吳堉銨 | [Homework3](https://hackmd.io/@c3WNnG7RRK2J17ifSiezZA/BJbbk9T46) | | 邱德昌 | [Homework3](https://hackmd.io/GNefo_sTRCKr4sX7K5Cb9A) | | 鄭朝駿 | [Homework3](https://hackmd.io/@J7GZnFx3Qe-HPvOgHWEQsg/ByBhD_fr6) | | 李晨瑞 | [Homework3](https://hackmd.io/@terry23304/assignment3) | | 江冠霆 | [Homework3](https://hackmd.io/@VBHMCAcXSo2j5UzcTBAQZQ/Bkfesgmr6) | | 鄭博文 | [Homework3](https://hackmd.io/@PWCheng/CAHW03) | | 李亮穎 | [Homework3](https://hackmd.io/@LLL00/Computer_Architecture_HW3) | | 陸品潔 | [Homework3](https://hackmd.io/@GliAmanti/rk1-p5xrp) | | 丁竟烽 | [Homework3](https://hackmd.io/@Paintako/single_cycle_riscvcpu) | | 王豊惟 | [Homework3](https://hackmd.io/@mlFpoYoxSjevnbdVLdrijw/BkhChfsE6) | | 陳浩文 | [Homework3](https://hackmd.io/@K7_Ko_hwTnC73N7fg9U_xQ/Hy_LwYmSp) | | 唐飴苹 | [Homework3](https://hackmd.io/@O6C2C3zQQBanDM55QRZ7DQ/Hw3_single_cycle_RISCV_CPU) | | 張偉治 | [Homework3](https://hackmd.io/@nfUUgsYRTGy81y5d9AYOyg/SkeLZYWra) | | 林昊霆 | [Homework3](https://hackmd.io/NF8UbrB0Qwm_GBIbHzepAg) | | 黃于睿 | [Homework3](https://hackmd.io/@DarrenHuang0411/DH_Assignment3) | | 周育晨 | [Homework3](https://hackmd.io/@8G9q08Y6Tnq9OJMgzCV1TA/SJpIlevrT) | | 許唯萱 | [Homework3](https://hackmd.io/@weishiuan/computer_architecture_hw3)| | 張正德 | [Homework3](https://hackmd.io/@gofzKoaiTI6mFzp4FTuenw/BJ0FkPvB6) | | 林晉宇 | [Homework3](https://hackmd.io/@linyu0425/ByFxEwvHT) | | 黃定山 | [Homework3](https://hackmd.io/@ShanHuang/r1JWMuVHp) | | 范紘維 | [Homework3](https://hackmd.io/@gV8IONkMS_a6aHt20QNuAg/ry5MwzfrT) | | 陳冠元 | [Homework3](https://hackmd.io/@K1NCVjKnTCmNaikFb4gt-A/H1JhBjESp) | | 顏伯丞 | [Homework3](https://hackmd.io/@QtzWvn_wQCicLQ65E_OREQ/2023-arch-hw3) | | 曾鼎棊 | [Homework3](https://hackmd.io/@NdB0NahsRSSnwZagYYcL6g/ryMi2hLBp) | | 彭煜博 | [Homework3](https://hackmd.io/@normal/MyCPU) | | 謝維倫 | [Homework3](https://hackmd.io/@VCNgJgo3RCyrEhvI9NKLUQ/rJDv6w_Sp) | | 魏彥庭 | [Homework3](https://hackmd.io/@Terry7Wei7/SINGLE-CYCLE-RISC-V-CPU) $\to$ [Publish a Note with Permalink](https://hackmd.io/c/tutorials/%2Fs%2Fhow-to-publish-note).<br> Check the URL carefully. | | 施宇庭 | [Homework3](https://hackmd.io/@yutingshih/arch2023-homework3) | | 張智惟| [Homework3](https://hackmd.io/@scottgood333/Hy5PKJzNT) | > :warning: Be aware of spaces. Separate each item with ==` | `==