--- tags: computer-arch --- # Quiz2 of Computer Architecture (2025 Fall) :::info :information_source: General Information * The quiz questions are detailed because the instructor found that students often struggle not with ability, but with **attention to detail** -- a skill essential in system design and implementation. These questions are meant to help students build and strengthen that skill step by step. * You may consult the **[lecture materials](https://wiki.csie.ncku.edu.tw/arch/schedule)** during the quiz. * In other words, this is an open-book exam. * Ensure that you adhere closely to the rules specified in [Computer Architecture: Guidelines for Student Use of AI Tools](https://hackmd.io/@sysprog/arch2025-ai-guidelines). * This quiz follows the honor system. By participating, you agree to the following: 1. You will not share or discuss quiz content with anyone until the official solutions are released. 2. **Screenshots and the use of any image processing tools are strictly prohibited.** 3. For proofreading, you may use tools such as [QuillBot](https://quillbot.com/) or [Grammarly](https://www.grammarly.com/). * **You are not allowed to use AI tools to solve the problems during the quiz**. AI tools may only be used to help you understand the descriptions and for proofreading. * Download the PDF document at the bottom of this page, which contains the problem set for Quiz 2. You will be prompted to enter a password. Ensure that you have read the notice at the end of this page. * Each question is worth **2 points**. * Answers must be given in valid numeric form and/or English alphabet, except when writing your formal name. * Always provide the shortest correct form. For example, write `ptr->member` instead of `(*ptr).member`. * Assume that every C program in this quiz already includes the following headers: `<assert.h>`, `<stdint.h>`, `<stddef.h>`, `<stdlib.h>`, `<stdio.h>`, `<stdbool.h>`, and `<string.h>`. * The C standard for reference is C99, formally specified as [ISO/IEC 9899:2018](https://www.iso.org/standard/74528.html). * ==Bonus Opportunity==: After class resumes at 10:25 AM, if you voluntarily participate in the class discussion, please email the instructor with your responses to the questions and any follow-up contributions. Doing so will earn you an additional ==40 points== on this quiz. * :timer_clock: 09:15 ~ 10:10AM on Sep 30, 2025 ::: :zap: **[Problem set for Quiz2](https://drive.google.com/file/d/1lgxMBbBxSAxhbr3a5WBIAW4IhSv3Mvhi/view?usp=sharing)** $\to$ To access the problem set, you will need a password. The password consists of two parts, combined and written entirely in lowercase: 1. An **emotion** represented by an [emoticon](https://en.wikipedia.org/wiki/List_of_emoticons), which is rendered by the RISC-V program below. 2. An **Arabic numeral** corresponding to the execution cycle count of the same program. The final password should be entered in the format `emotionYYYY` (for example, `angry1989`, which is not the correct password). The following RISC-V assembly code is designed to be executed using the Ripes simulator. It will display an image on the simulator's 35×25 LED matrix, which was introduced in [Lab 1: RV32I Assembly](https://hackmd.io/@sysprog/H1TpVYMdB). Technical Details * LED Matrix: The display is a 35×25 grid of pixels arranged in row-major order. * Memory Map: The matrix is mapped to the base address `0xF0000000`. * Pixel Format: Each pixel is represented by a 32-bit value. Assembly Code ```c .text .globl main main: lui a0, 0xF0000 la a1, D lui a2, 1 addi a2, a2, -596 add a3, a0, a2 lui a2, 0xFFFF L0: addi a3, a3, -4 sw a2, 0(a3) bne a3, a0, L0 addi a3, a1, IU # You need to replace "IU" with the correct value L1: lw a4, 0(a1) add a5, a0, a4 sw x0, 0(a5) addi a1, a1, 4 bne a1, a3, L1 addi a7, x0, 10 ecall .data .align 2 D: .word 1024,1028,1068,1072,1164,1168,1208,1212 .word 1856,1860,1916,1920,2000,2004,2052,2056 .word 2144,2148,2152,2188,2192,2196,2292,2296 .word 2300,2304,2308,2312,2316,2320,2324,1992 ``` In the RISC-V assembly listing above, "IU" is defined as the product of (the decimal count of [Kirby](https://en.wikipedia.org/wiki/Kirby_(series)) characters found in [Quiz 1](https://hackmd.io/@sysprog/arch2025-quiz1)) and (the expected line number of the statement ==`} else if (exp_diff < 0) {`== shown on page 4 of [Quiz 1](https://hackmd.io/@sysprog/arch2025-quiz1)), minus 1. For example, with 4 Kirby characters and line number 20, the calculation is $4 \times 20 - 1 = 79$. However, this example does not represent the actual value of "IU". To find the PDF password, you must complete the following steps: 1. Run the Program: Execute the provided RISC-V assembly code in the Ripes simulator to display the image on the LED matrix. 2. Identify the Emoticon: * Observe the image and identify the emotion it conveys. * Your answer must be a single English word (e.g., "laughing" and "crying") that describes this emotion. * Crucially, this word must be a term used on the Wikipedia page, [List of emoticons](https://en.wikipedia.org/wiki/List_of_emoticons), to describe a specific type of facial expression, namely Angel, Embarrassed, Wink, Kiss, Smirk, Smiley, Surprise, Shock, Horror, Disgust, Crying, Frown, Laughing, and Grin. 3. Get the Cycle Count: After the program finishes, record the total cycle count displayed in the simulator. Ensure the processor is configured as a single-cycle RISC-V core. 4. Form the Password: Combine your findings to create the password in the format `emotionYYYY`, where emotion is the word you identified and YYYY is the cycle count. $\to$ You are expected to answer A01 through A42 and B01 through B23.