# RISC-V Architecture

## Summary


When computers "compute", they're in fact executing instructions that are defined by what's known as **Instruction Set Architecture (ISA)**. Each computer hardware will support a particular ISA. RISC-V is a free, open ISA that can be extended or customized for a variety of hardware or application requirements. 

Apart from defining the instructions themselves, to be a success, any ISA requires broad industry support from chip manufacturers, hardware designers, tool vendors, compiler writers, software engineers, and more. While RISC-V is still new, progress has been made in building a healthy ecosystem and first RISC-V chips have been released.

It's been said that, 

> The real value of RISC-V is enabling the software and tools community to develop around a single common hardware specification.

## Discussion

### What's the motivation for creating RISC-V?

Many of the world's PCs and laptops are based Intel's x86 architecture. Many of the world's smartphones and embedded devices are based on ARM architecture. Both are proprietary and any use of these architectures involve licensing cost and may involve royalty fees. Moreover, companies may lack full competency to design their proprietary ISA. Another problem is long-time support. For example, when DEC died, there was no one to support their proprietary ISAs Alpha or VAX. 

One researcher claimed that security flaws such as Meltdown and Spectre are down to flaws in Intel's instruction sets. This is less likely when ISAs are open to inspection by a wide engineering community. 

RISC-V is an open ISA. It uses **BSD Open Source License**. This license does not restrict even commercial use of the ISA. Anyone implementing RISC-V are not required to release the source code of their RISC-V cores. The license only requires that authors of RISC-V must be acknowledged. An open ISA will permit software reuse, greater innovation and reduced cost. 


### Do we need RISC-V when there are other open ISAs?

Creators of RISC-V considered and dismissed other open ISAs. OpenRISC has technical shortcomings and little industry adoption. OpenSPARC is suitable for servers but not for embedded devices and smartphones. OpenSPARC is also licensed under GPLv2, which may not attract support from commercial players. 

RISC-V benefits from the mistakes of the past. It has no burden to support legacy instructions. It adopts RISC for its simplicity. By leaving out delayed branches, RISC-V is kept simple and clean. Other open ISAs are not modular. RISC-V is modular so that the right balance of cost and efficiency can be attained for a particular application. In particular, it can be customized for constrained IoT devices, smartphones/tablets or servers. 

One claim states that LatticeMico32 is an open source RISC processor that's some are already using and questions the need for RISC-V. They also state that the ecosystem is more important than having a perfect ISA. 


### What are some possible benefits of using RISC-V?

Beyond saving on licensing or royalty fees, RISC-V has many benefits:

    + **Universal**: As one of its goals, RISC-V should suit all sizes of processors, all types of implementations (FPGA/ASIC/SoC), various software stacks, and various programming languages.
    + **Modular**: The ISA has a base specification plus optional extensions. This means designers can leave out stuff they don't need for their application.
    + **Extensible**: Designers can add custom instructions for specialized functions such as machine learning or security. This is particularly important when Moore's Law is ending.
    + **Freedom**: Designers have the freedom to work on their own optimized implementations and retain the choice to make their IP open.
    + **Frozen**: By freezing the ISA specifications, we can be certain that today's software and tools will work on RISC-V systems many decades from now.
    + **Adoption & Reuse**: By being open, RISC-V will encourage wider adoption because of compatibility. This enables reuse.

### Could you compare RISC-V with alternative architectures?

In terms of code sizes, one study found RISC-V compressed ISA (RV32C) is similar to Thumb-2, while RV64C has better code density than its alternatives. 

In terms of performance (speed and power), there's no reason to believe that RISC-V processors will fare worse than ARM or x86 processors. It will be dependent on implementation: microarchitectural design, circuit design and processing technology. 


### Could you name some processors based on RISC-V?

Because RISC-V is open, anyone can design and develop their own processors without licensing fees. However, design and engineering costs can run into millions of dollars plus a delayed time to market. It therefore makes sense to use IP cores or processors developed by others. 

Some offer RISC-V **IP cores** that chip makers can license. Among them are Andes Technology, Codasip, Bluespec, Cortus, and SiFive. There are others who offer **soft cores** that can run in FPGAs: Microsemi, Rumble Development, and VectorBlox. 

SiFive has two families of licensable cores: E Series and U Series. They also offer these in silicon plus their development boards. Freedom E310 (FE310) is the first member of the Freedom Everywhere family. 

India's Shakti is a RISC-V chip developed at IIT Madras.

lowRISC is a fully open-sourced, Linux-capable, RISC-V-based SoC currently being developed. Their Rocket core currently runs on an FPGA. 

RISC-V Foundation maintains a list of RISC-V cores and SoCs.


### What tools are available for developers who wish to work on RISC-V?

Basic tools include compiler, assembler, disassembler, profiler, debugger, and linker. Beyond these are IDEs, SDKs, simulators, and many more.

Tools are being developed and maintained by the team at UC Berkeley plus the wider community outside. RISC-V supports GNU/GCC, GNU/GDB and LLVM. Instruction Set Simulators (ISS) are available from Antmicro and QEMU. Full IDEs are available from Imperas, Microsemi and SiFive. SiFive's Eclipse-based IDE is called Freedom Studio. Tools are available to design your own RISC-V subsystem for FPGAs. 

RISC-V Foundation maintains the state of the current RISC-V software ecosystem.


### Which operating systems have been ported to run on RISC-V?

Different flavours of Linux have been ported to RISC-V, including Yocto. In January 2018, kernel version 4.6 was being used. Researchers at the University of Cambridge have ported FreeBSD. As on August 2018, 80% of Debian software library has been compiled for RISC-V. Fedora/RISC-V project aims to bring the Fedora experience on RV64GC architecture. 

Among the RTOS, Zephyr is planning a port as of August 2018. A port of FreeRTOS is also available.

## Milestones

2010

Researchers at the University of California, Berkeley conceive RISC-V (pronounced "risk five") as an ISA for research and education at Berkeley. Previously, they used SPARC ISA and a modified MIPS ISA but want a unified ISA for future projects. This is the fifth generation, following in the steps of four earlier generations in the 1980s. 

May  
2011

Version 1.0 of the RISC-V base user-level ISA is published as volume 1. This version is not frozen. Volume 2 is for supervisor-level ISA. About this time, Raven-1 testchip is taped out using ST 28nm FDSOI process node. 

May  
2014

Version 2.0 of the user-level ISA is published. This is a final frozen version. 

2015

In January, the 1st RISC-V Workshop is organized in Monterey, CA. To drive the future development and adoption of RISC-V, **RISC-V Foundation** is established. With more than 100 member organizations, this is an open collaborative community including both hardware and software innovators. 

Dec  
2016

SiFive releases Freedom E310 32-bit microcontroller at 320 MHz. This is the first commercial RISC-V chip. The CPU core is SiFive E31 and its ISA is RV32IMAC. 

Oct  
2017

SiFive releases U54-MC Coreplex, the first RISC-V-based chip that supports Linux, Unix, and FreeBSD. It has 5 CPU cores: 4xU54 + 1xE51. This enables RISC-V processors to compete against ARM cores. In February 2018, SiFive releases a development board named HiFive Unleashed for this chip. 

Jan  
2018

It's reported that commercial players including Western Digital and Nvdia plan to use RISC-V ISA for their next generation of products. 

Jul  
2018

India's Shakti RISC-V processor at 400 MHz boots up Linux. The processor is based on Intel's 22nm FinFET process node.