sysprog
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Assignment2: RISC-V Toolchain ( Due: Oct 30, 2019 ) ## Requirements 1. Following the instructions of [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/@sysprog/rJAufgHYS), pick up two assembly programs from [Assignment1: RISC-V Assembly and Instruction Pipeline](https://hackmd.io/@jserv/By5OE6fOr) and rewrite into C implementations which can execute with [rv32emu](https://github.com/sysprog21/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](https://en.wikipedia.org/wiki/Branch_predictor)), `jump_counter`, etc. Then, try to optimize the generated assembly. You shall read [RISC-V Assembly Programmer's Manual](https://github.com/riscv/riscv-asm-manual/blob/master/riscv-asm.md) carefully and modify Makefile in order to append new assembly targets. * Would you encounter data hazards? Can you do [instruction scheduling](https://en.wikipedia.org/wiki/Instruction_scheduling) manually? 4. Write down your thoughts and progress in [HackMD notes](https://hackmd.io/s/features). * [Example page](https://hackmd.io/@kksweet8845/2019q3homworkquiz2): Do not modify this note. * Insert your HackMD notes and programs in the following table. * 2 entries as expected. ## Fill in the table for your homework | Name (Chinese/English) | Descriptions | HackMD note | Program (GitHub link) | | ---------------------- | ------------ | ------------ | --------------------- | |張家銘 | prime number| [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/PV_zFTfQR9Gxb7eap7ME-w?view) | [link]() | |張家銘 | POW function| [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/S8ra4N2UQx2qCEee_Z5nHQ) | [link]() | |戴宏諺| 9*9 multiplication table | [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/@kksweet8845/rsicvlab299multitable)| [github](https://github.com/kksweet8845/adv_CO_lab2)| |戴宏諺| Recursive binary search| [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/@kksweet8845/riscvlab2binarysearchtree)|[github](https://github.com/kksweet8845/adv_CO_lab2)| | 黃瀚群 | Bubble Sort | [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/acLWhdFkT5KUGOylwZDrRQ) | 黃瀚群 | Permutations(nCk) with recursion |[Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/acLWhdFkT5KUGOylwZDrRQ) |潘家瑞|POW function| [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/mKb05niNQz6-ycOvIbSjxA) | [Github](https://github.com/surajpakhi/ComputerArchitecture/blob/master/MyPowFunction.c) |潘家瑞|Tower of Hanoi | [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/dghEWx3-TuqYzK0dhI-cOw) | [Github](https://github.com/surajpakhi/ComputerArchitecture/blob/master/TowerOFHanoi.c) | 周沛辰 | Multiplier | [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/bl9PKrP0TxivyfOiR-tRtw?view) |[Link](https://github.com/sq0332ppps/Computer-architecture/blob/master/HW2/multiplier.c) | 周沛辰 | Sort 1~5 With Bubble Sort |[Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/_NbeweMIT2qK92rlAAxfPQ?view)| [Link](https://github.com/sq0332ppps/Computer-architecture/blob/master/HW2/bubblesort.c) |林家葦|Sum of First N Natural Numbers|[Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/9O3vzqfISvuGDKFqxnwbyQ)|[github](https://github.com/CCUWayen/Computer-Architecture/blob/master/assignment3/test.c)| 林家葦|Multiplier|[Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/u9r9zWxtQ9C5oudDyqRGtA?view)|[github](https://github.com/CCUWayen/Computer-Architecture/blob/master/assignment2/test.c) |黃俞紘| 9*9 multiplication table| [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/YUnbbcqeQI6QTt3_7iT3Cw?view)|[github](https://github.com/YuuuuH/NCKU_computer_architecture/tree/master/hw2) | 黃偉宸 | Multiplier | [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/UiIYXMlKRZmUlCrQQY0Gww) |[github](https://github.com/murumura/risc-v/tree/master/lab2) | 黃偉宸 | bit reverse |[Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/UiIYXMlKRZmUlCrQQY0Gww) |[github](https://github.com/murumura/risc-v/tree/master/lab2) | Soonmyun Jang | Catalan number/Multiplier | [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/0gUA2-ogTXO4GlCiywknhA) | [Link](https://github.com/JANGSOONMYUN/ComputerArchitecture/tree/master/Assignment2_RISC-V/rv32emu) | 林聖堯| Bit_reverse, Prime Number | [Assignment2: RISC-V Toolchain](/@_01X9rimQmWH33Djf8QhoA/BJGjBWS9r)| |王昱翔| bubble sort/binarySearch| [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/dv6rfki_SP6h7JCRr49oMA?view)| |黃俞紘| Hanoi Tower| [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/EoDSavA_QNa2aUnzz5kWtg)|[github](https://github.com/YuuuuH/NCKU_computer_architecture/tree/master/hw2)| |曾士峰| Lucas Number | [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/@xl86305955/rv32i_lucas_number)| [github](https://github.com/xl86305955/rv32emu_C_program/blob/master/lucas.c) | |曾士峰| Fraction `!` | [Lab2: RISC-V RV32I[MA] emulator with ELF support](https://hackmd.io/@xl86305955/rv32i_frac)| [github](https://github.com/xl86305955/rv32emu_C_program/blob/master/frac.c) |

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully