Try   HackMD

Assignment2: RISC-V Toolchain

Due: Oct 26, 2020

Requirements

  1. Following the instructions of Lab2: RISC-V RV32I[MA] emulator with ELF support, pick up two assembly programs from Assignment1: RISC-V Assembly and Instruction Pipeline and rewrite into C implementations which can execute with rv32emu.
    • You shall not pick up the program(s) submitted by youself already.
    • You may pick up the same topic as other students did, but you shall figure out something by your own.
  2. Disassemble the ELF files generated by C compiler and compare the assembly listing between handwritten and compiler optimized one.
    • You can modify the arguments specified by RV32I_CFLAGS to experiment. e.g. Change -O3 (optimized for speed) to -Os (optimized for size).
    • Describe your obserations and explain.
    • Function calls and ecall shall be taken into considerations.
  3. Check the results of emu-rv32i for the statistics of execution flow and explain the internal counters such as true_counter, true_counter (crucial for branch prediction), jump_counter, etc. Then, try to optimize the generated assembly. You shall read RISC-V Assembly Programmer's Manual carefully and modify Makefile in order to append new assembly targets.
  4. Can you improve the assembly code generated by gcc with optimizations? Or, can you write even faster/smaller programs in RISC-V assembly?
  5. Write down your thoughts and progress in HackMD notes.
    • Example page

      Image Not Showing Possible Reasons
      • The image file may be corrupted
      • The server hosting the image is unavailable
      • The image path is incorrect
      • The image format is not supported
      Learn More →
      Do not modify this note.

    • Insert your HackMD notes and programs in the following table.
    • 2 entries as expected.
    • Of course, you MUST write in English.
  6. BONUS: figure out the bugs inside rv32emu and send pull requests to improve it!

Fill in the table for your homework

Formal given name Descriptions HackMD note Program (GitHub link)
Sample1 prime number Homework2-1 -
Sample1 pow function Homework2-2 -
Sample2 bit reversal Homework2 -
Sample3 bubble sort, binary search Homework2 -
Sample4 Tower of Hanoi Homework2 -
呂紹樺 GCD (Greatest Common Divisor) Homework2 -
呂紹樺 Insertion Sort Homework2 -
許龍君 Bubble Sort Homework2-1 -
許龍君 Count Leading Zero Homework2-2 -
段雅培 Linear Search Homework2-1 -
汪宗諺 Fibonacci number Homework2-1 -
汪宗諺 Factorial number Homework2-2 -
洪邵澤 Power Function Homework2-1 -
洪邵澤 Find Largest Element Homework2-2 -
曾紹銘 Count Leading Zero Homework2-1 -
曾紹銘 Bubble Sort Homework2-2 -
林霆寬 Factorial Homework2-1 -
林霆寬 GCD (Greatest Common Divisor) Homework2-2 -
魏晉成 Convolution Sum Homework2-1 -
魏晉成 Count Leading Zeros Homework2-2 -
鄭惟 Binary Search Homework2-1 -
鄭惟 Single number Homework2-2 -
鄭育丞 Fibonacci Homework2-1 -
楊承翰 Fibonacci number Homework2-1 -
楊承翰 Bubble Sort Homework2-2 -
陳冠宇 Format printer Homework2-1 -
陳冠宇 MergeSort Homework2-2 -
王傑世 GCD Homework2-1 -
王傑世 Print Square Homework2-2 -
王廣達 Insertion Sort Homework2-1 -
王廣達 Isoceles triangle Homework2-2 -
施丞宥 Bubble sort Homework2-1 -
施丞宥 Homework2-2 -
陳柏廷 Find Largest Element Homework2-1 -
陳柏廷 Insertion Sort Homework2-2 -
謝宜紘 Count Leading Zeros Homework2-1 -
謝宜紘 Bubble Sort Homework2-2 -
江承緯 Bubble Sort Homework2-1 -
江承緯 power function Homework2-2 -
林楷倫 Insertion Sort Homework2-1 -
林楷倫 GCD Homework2-2 -
吳昱宗 Fibonacci number Homework2-1 -
吳昱宗 Print Square Homework2-2 -
林柏維 Dot Product Homework2-1 Github
林柏維 Format printer Homework2-2 Github
曾鈜寬 Factorial Number Homework2-1 [Github]
徐郁淞 Binary Search Homework2-1
徐郁淞 Power function Homework2-2
江松穎 Bubble Sort Homework 2-1 -
江松穎 Two Sum Homework 2-2 -