RISC-V, a term that sounds very technical, makes you wonder what it would be like if there were a chip architecture that is completely free, allowing you to modify and customize it freely, while also offering great performance.
What is RISC-V?
Think of RISC-V as a “building block toy”
Imagine the building block toys you played with as a child. RISC-V is like a completely open building block system:
- • Completely Free: You don’t have to pay for the “copyright of the blocks”
- • Freely Modifiable: You can design new block shapes yourself
- • Simple and Understandable: The basic blocks have only a few shapes, making them easy to learn
- • Expandable: You can add more features as needed
RISC-V is like building block toys
Basic blocks
Expandable blocks
Custom blocks
Addition, subtraction, multiplication, and division are like basic blocks
Comparison and judgment are like connectors
Jump instructions are like directional indicators
Floating-point operations are like special shapes
Compressed instructions are like small blocks
Atomic operations are like locked blocks
You can design any blocks you need
For example, AI acceleration or encryption features
Core Features of RISC-V
1. Simplicity – “Less is More”
The basic instruction set of RISC-V has only over 40 instructions, similar to mastering the most commonly used words when learning English.
// The basic instructions of RISC-V are like these simple operations
int a = 10; // Load number
int b = 20; // Load number
int c = a + b; // Addition operation
if (c > 25) { // Comparison and judgment
// Do something
}
2. Openness – “Completely Free”
This is the biggest advantage of RISC-V! You don’t have to pay licensing fees to anyone to:
- • Design your own chip
- • Modify the instruction set
- • Use it for commercial products
- • Share it with others
3. Scalability – “Customizable on Demand”
RISC-V is like a modular system where you can add features as needed:
Basic RISC-V
Need floating-point operations?
Need vector processing?
Need AI acceleration?
Add F extension
Add V extension
Add custom instructions
RISC-V vs ARM
Comparison
Imagine you need to choose a car:
- • ARM is like buying a ready-made car: Fully functional, but you can’t modify it at will, and you have to pay an annual “usage fee”
- • RISC-V is like buying a car that can be freely modified: You can modify it according to your needs, and it’s completely free
Choosing a chip architecture is like choosing a car
ARM - Ready-made car
RISC-V - Modifiable car
Fully functional but limited customization
Licensing fees are like annual inspection fees
Mature and stable but limited innovation
Completely free with no licensing fees
Can be freely modified and customized as needed
Rapidly developing ecosystem
When to Choose RISC-V?
Choose RISC-V if:
- • ✅ You have a limited budget and don’t want to pay licensing fees
- • ✅ You need highly customized solutions
- • ✅ You want to learn about the latest technology trends
- • ✅ You have requirements for supply chain security
- • ✅ You are developing IoT or edge computing devices
When to Choose ARM?
Choose ARM if:
- • ✅ You need the most mature and stable ecosystem
- • ✅ You have a sufficient budget to pay licensing fees
- • ✅ You need extensive third-party support
- • ✅ Your project timeline is tight and requires rapid development
- • ✅ You need complex floating-point operation performance
Building RISC-V Programs
Installing Development Tools
Windows Users (Recommended to use WSL)
# 1. Open the WSL terminal and enter the following commands
sudo apt update
# 2. Install the RISC-V toolchain (like installing a software package)
sudo apt install gcc-riscv64-unknown-elf gdb-multiarch
# 3. Verify if the installation was successful
riscv64-unknown-elf-gcc --version
Linux Users
# Just install directly
sudo apt install gcc-riscv64-unknown-elf gdb-multiarch
macOS Users
# Install using Homebrew
brew install riscv-gnu-toolchain
Creating a Project
# 1. Create a folder (like creating a game save folder)
mkdir my_first_riscv_project
cd my_first_riscv_project
# 2. Create your first C program
cat > hello_riscv.c << 'EOF'
#include <stdio.h>
int main() {
printf("Hello, RISC-V World!\n");
printf("This is my first RISC-V program!\n");
return 0;
}
EOF
Compiling and Running
# Compile the program (convert C code into machine code that RISC-V can understand)
riscv64-unknown-elf-gcc -march=rv64imac -mabi=lp64 hello_riscv.c -o hello_riscv
# View the generated file
ls -la hello_riscv
# Run the program (in the emulator)
qemu-riscv64 hello_riscv
Recommended Resources
1. Online Resources
- • RISC-V Official Documentation: https://riscv.org/
- • RISC-V Foundation: https://riscv.org/about/
2. Recommended Development Boards
- • HiFive1 Rev B: A RISC-V development board suitable for beginners
- • Nuclei Development Board: A domestic RISC-V development board
- • SiFive Development Board: The officially recommended development board
3. Learning Communities
- • RISC-V Chinese Community: https://www.riscv-mcu.com/
- • GitHub RISC-V Organization: https://github.com/riscv