RISC-V Assembly Programming

This can be used as a short tutorial with links and resources for learning assembly programming using RISC-V.

1. Have simulator or systems that can run RISC-V program

I recommend you to use RARS simulator. Download the release jar file and launch it. You can use more complicated simulator such as Qemu which can provide a full system simulation.

2. Hello world program

As usual, start with Hello World program, and instruction can be found from Risc-V Assembly Language Hello World, or you can find similar program from RARS Wiki. The program should be able to run on both RARS simulator and a real system.

3. Try more of the examples from RARS tests code.

RARS Wiki provides more information about what instructions and environment call you can use to create a full-featured application. Similar information can be found from the one page RISC-V Assembly Programmer's Manual . The ITSC3181 lab 04/05 has some examples to program RISC-V assembly.

4. Programming with more complicated examples and for embedded systems

From here programming with RISC-V assembly are very similar for programming with other assembly languages such as x86 and for embedded applications such as using ARM. The resources for those topics can be used with RISC-V.

  1. X86 Assembly Programming and other books about x86 assmebly programming. RISC-V is much simpler ISA than x86, so it should be much easier to programming with RISC-V
  2. For programming embedded system with RISC-V, Youtube has video series for hand-on instructions of Programming a microcontroller with RISC-V

5. Refer to the following book and GNU assembler manual to write a full-featured assembly program.

  1. Book: The RISC-V Reader: An Open Architecture Atlas 1st Edition
  2. GNU assembler manual

6. RVfpga: Understanding Computer Architecture

A 1 or 2-semester courses dedicated on lecture and labs for a comprehensive and complete RISC-V course and hands-on to learn about RISC-V processors and the RISC-V ecosystem. This is a Computer Architecture design courses and after completing the RVfpga Course, users will walk away with a working RISC-V processor, SoC, and ecosystem that they understand and know how to use and modify.

Resources

  1. RISC-V overview slide, RISC-V ISA Reference Card. Resources from RISC-V official website including the RISC-V ISA specification itself.

  2. The ITSC3181 course lecture, the Computer Organization and Design RISC-V Edition: The Hardware/Software Interface textbook

  3. RARS simulator provides materials for you get started, and Video for Introducing RARS

  4. GNU assembler manual

  5. Book: The RISC-V Reader: An Open Architecture Atlas 1st Edition

  6. Book: Computer Organization and Design RISC-V Edition: The Hardware/Software Interface, Amazon, Publisher website

  7. Book: Computer Architecture A Quantitative Approach, 5th Edition, John L. Hennessy and David A. Patterson, bible of computer architecture: Amazon, Publisher website