--- tags: computer-arch --- # Quiz 3 of Computer Architecture (2024 Fall) :::info :information_source: General Information * You are allowed to read **[lecture materials](https://wiki.csie.ncku.edu.tw/arch/schedule)** and run RISC-V code inside the [Ripes simulator](https://github.com/mortbopet/Ripes). > That is, an open book exam. * We are using the honor system during this quiz, and would like you to accept the following: 1. You will not share the quiz with anyone. 2. You will not discuss the material on the quiz with anyone until after solutions are released. * Download the PDF document at the bottom of this page, which contains the problem set for Quiz 3. You will be prompted to enter a password. Ensure that you have read the notice at the end of this page. * Each answer has 5 points. * You must answer in valid numeric representation and/or English alphabet except your formal name. * Always provide your answer in the shortest form. For example, use `ptr->member` instead of `(*ptr).member`. * Assume that each C program already includes the headers `<stdint.h>`, `<stdbool.h>`, `<stddef.h>`, `<stdlib.h>`, and `<stdio.h>`. * The C standard referenced in this quiz is C99, officially known as ISO/IEC 9899:2018. * Message **[the instructor via Facebook](https://www.facebook.com/JservFans)** if you found something wrong. * :timer_clock: 09:10 ~ 10:30AM on Oct 22, 2024 ::: [Problem set for Quiz 3](https://drive.google.com/file/d/1fhYFMT2oPPXW-PFlOKWBFf84NW9YSp27/view?usp=sharing) $\to$ The password for the PDF document is the most frequent RISC-V instruction displayed by [rv32emu](https://github.com/sysprog21/rv32emu)'s instruction histogram tool. Use lowercase letters. ## Correction - [ ] Problem A ```c static uint32_t ram_load16(ram_t *mem, uint32_t addr) { size_t index = addr - RAM_BASE; return ((uint32_t) mem->mem[index] | ((uint32_t) mem->mem[index + 1] << 8)); } static uint32_t ram_load32(ram_t *mem, uint32_t addr) { size_t index = addr - RAM_BASE; return ((uint32_t) mem->mem[index] | ((uint32_t) mem->mem[index + 1] << 8) | ((uint32_t) mem->mem[index + 2] << 16) | ((uint32_t) mem->mem[index + 3] << 24)); } ``` - [ ] Problem C ```c // Lookup table for reciprocal square root approximations. rsqrtapp: .byte 0xf1, 0xda, 0xc9, 0xbb, 0xb0, 0xa6, 0x9e, 0x97, 0x91, 0x8b, 0x86, 0x82 ```