|Designer||University of California, Berkeley|
|Bits||32, 64, 128|
|Extensions||M, A, F, D, Q, C, P|
|General purpose||16, 32 (including one always-zero register)|
In contrast to most ISAs, the RISC-V ISA can be freely used for any purpose, permitting anyone to design, manufacture and sell RISC-V chips and software. While not the first open ISA, it is significant because it is designed to be useful in modern computerized devices such as warehouse-scale cloud computers, high-end mobile phones and the smallest embedded systems. Such uses demand that the designers consider both performance and power efficiency. The instruction set also has a substantial body of supporting software, which fixes a usual weakness of new instruction sets.
As of May 2017, version 2.2 of the userspace ISA is fixed and the privileged ISA is available as draft version 1.10.
- 1 Significance
- 2 History
- 3 Motivating requirements
- 4 Software
- 5 Adopters
- 6 Design
- 7 See also
- 8 References
- 9 Further reading
- 10 External links
The RISC-V authors aim to provide several CPU designs freely available under a BSD license. Such licenses allow derivative works, such as RISC-V chip designs, to be either open and free, like RISC-V itself, or closed and proprietary.
By contrast, commercial chip vendors such as ARM Holdings and MIPS Technologies charge substantial license fees for the use of their patents. They also require non-disclosure agreements before releasing documents that describe their designs' advantages and instruction set. Many design advances are completely proprietary, never described even to customers. The secrecy prevents public educational use, security auditing, and the development of public, low–cost free and open-source software compilers, and operating systems.
Developing a CPU requires design expertise in several specialties: electronic logic, compilers, and operating systems. It's rare to find this outside of a professional engineering team. The result is that modern, high-quality general-purpose computer instruction sets have not recently been widely available anywhere, or even explained, except in academic settings. Because of this, many RISC-V contributors see it as a unified community effort. This need for a large base of contributors is part of the reason why RISC-V was engineered to fit so many uses.
The RISC-V authors also have substantial research and user-experience validating their designs in silicon and simulation. The RISC-V ISA is a direct development from a series of academic computer-design projects. It was originated in part to aid such projects.
The term "RISC" dates from about 1980. Before this, there was some knowledge that simpler computers could be effective, but the design principles were not widely described. Simple, effective computers have always been of academic interest.
Academics created the RISC instruction set DLX for the first edition of Computer Architecture: A Quantitative Approach in 1990. David Patterson was an author, and later assisted RISC-V. However DLX was for educational use. Academics and hobbyists implemented it using field-programmable gate arrays, but it was not a commercial success.
ARM CPUs, version 2 and earlier, had a public-domain instruction set, and it is still supported by the GCC, a popular free software compiler. This helped promote acceptance of the ARM architecture. Three open-source cores exist for this ISA, but they have not been manufactured.
Krste Asanović at University of California, Berkeley, found many uses for an open-source computer system. In 2010 he decided to develop and publish one in a "short, three-month project over the summer." The plan was to help both academic and industrial users. David Patterson at Berkeley also aided the effort. Patterson originally identified the properties of Berkeley RISC, and RISC-V is one of his long series of cooperative RISC research projects. Early funding was from DARPA.
A partial list of organizations that support the RISC-V Foundation includes: AMD, BAE, Berkeley Architecture Research, Bluespec, Inc., Cortus, Draper, Google, Hewlett Packard Enterprise (HPE), Huawei, IBM, ICT, IIT Madras, Lattice Semiconductor, Mellanox Technologies, Microsemi, Micron, Microsoft, Nvidia, NXP, Oracle, Qualcomm, Rambus Cryptography Research, Western Digital.
- 2017: The Linley Group's Analyst's Choice Award for Best Technology (for the instruction set)
The designers claim that the instruction set is the main interface in a computer, because it lies between the hardware and the software. If a good instruction set were open, available for use by all, it should dramatically reduce the cost of software by permitting far more reuse. It should also increase competition among hardware providers, who can use more resources for design and less for software support.
The designers claim that new principles are becoming rare in instruction set design, as the most successful designs of the last forty years have become increasingly similar. Of those that failed, most did so because their sponsoring companies failed commercially, not because the instruction sets were poor technically. So, a well-designed open instruction set designed using well-established principles should attract long-term support by many vendors.
Most prior open ISAs used a GNU General Public License (GPL), encouraging users to open their implementations to copying and use by others, including competitors. This can be very unprofitable for vendors. So, an ISA for the widest use needs a license that legally permits proprietary designs. For example, it could use one of the BSD licenses.
Unlike other academic designs which are optimized only for simplicity of exposition, the designers claim that the RISC-V instruction set is for practical computers. It is said to have features to increase computer speed, yet reduce cost and power use. These include a load/store architecture, bit patterns to simplify the multiplexers in a CPU, simplified standards-based floating-point, a design that is architecturally neutral, and placing most-significant bits at a fixed location to speed sign-extension. Sign extension is said to often be on the critical timing path.
The designers claim that RISC-V CPUs can achieve higher speeds, and smaller, lower power and cost electronics, than some comparable commercial CPUs.
The instruction set is designed for a wide range of uses. It supports three word-widths, 32-, 64-, and 128-bits, and a variety of subsets. The definitions of each subset vary slightly for the three word-widths. The subsets support small embedded systems, personal computers, supercomputers with vector processors, and warehouse-scale rack-mounted parallel computers.
The instruction set is variable-width and extensible, so that more encoding bits can always be added. Space for the 128-bit stretched version of the ISA was reserved, because 60 years of industry experience has shown that the most unrecoverable error in instruction set design is a lack of memory address space. As of 2016[update], the 128-bit ISA remains undefined intentionally, because there is yet so little practical experience with such large memory systems.
However, RISC-V also supports the designers' academic uses. The simplicity of the integer subset permits basic student exercises. The integer subset is a simple ISA enabling software to control research machines. The variable-length ISA enables extensions for both student exercises and research. The separated privileged instruction set permits research in operating system support, without redesigning compilers. RISC-V's open intellectual property allows its designs to be published, reused, and modified.
A normal problem for a new instruction set is a lack of CPU designs and software.
The RISC-V website has a specification for user-mode instructions, and a preliminary specification for a general-purpose privileged instruction set, to support operating systems.
There are several open-sourced CPU designs, including the 64-bit Berkeley Out of Order Machine (BOOM), 64-bit Rocket, five 32-bit Sodor CPUs from Berkeley, picorv32 by Clifford Wolf, scr1 from Syntacore, and others. The three-stage Sodor CPU appears apt for a small embedded CPU. Rocket may suit compact, low-power intermediate computers such as personal devices. BOOM utilizes much of the infrastructure created for Rocket, and may be usable for personal, supercomputer and warehouse-scale computers. Both picorv and scr1 are 32bit MCU class RV32IMC implementations in Verilog.
- SiFive has developed an embedded system on chip, compatible with Arduino, for sale at $59 that began selling in May 2017.
- Codasip and UltraSoC have developed fully supported intellectual property for RISC-V embedded SOCs that combine Codasip's RISC-V cores and other IP with UltraSoC's debug, optimization and analytics.
- Imperas has developed a family of fast processor models for the different subsets of RV32G and RV64G ISA variants that are part of the OVPsim instruction accurate simulator distributions used for embedded software development.
- The Indian Institute of Technology Madras is developing six RISC-V open-source CPU designs for six distinct uses, from a small 32-bit CPU for the internet of things (IoT) to large, 64-bit CPUs designed for warehouse-scale computers such as server farms based on RapidIO and Hybrid Memory Cube technologies.
- Nvidia plans to use RISC-V to replace their Falcon processor on their GeForce graphics cards.
- ASTC in Adelaide developed a RISC-V CPU for embedded ICs.
- A founder of Adapteva plans to use RISC-V, in a successor to their manycore accelerator product
- lowRISC is a non profit project that aims to implement a fully open-source system on a chip (SoC) based on the 64-bit RISC-V ISA.
- The Computer Laboratory, University of Cambridge, in collaboration with the FreeBSD Project, has ported the FreeBSD operating system to 64-bit RISC-V to use as a hardware-software research platform.
- ETH Zurich and the University of Bologna have cooperatively developed the PULPino processor as part of the PULP (Parallel Ultra-Low Power) project using RISC-V
The minimum, mandatory set of RISC-V instructions is the integer instruction set. (Indicated with a letter "I".) This set by itself can implement a simplified general-purpose computer, with full software support, including a general-purpose compiler.
A computer design may add further subsets: Integer multiplication and division (set "M"), Atomic instructions for handling real-time concurrency ("A"), IEEE Floating point ("F") with Double-precision ("D") and Quad-precision ("Q") options. A "privileged" instruction set defines instructions to support a UNIX-style operating system. There are plans for it to support hypervisors, to support virtualization. A computer with all of these instruction sets, an "RVIMAFD", is said to be "general-purpose", summarized as "G".
There's an optional "compact" subset to reduce code size (set "C"). Many RISC-V computers might add this ISA to reduce power, code size, and memory. There's also a 32-bit embedded subset ("E") that supports only 16 registers, to reduce the cost of the smallest CPUs.
These sets are further described by the size of the registers, i.e. 32 or 64 bits. There are small differences in each subset for different register sizes.
Subsets are also planned for 128-bit computers, bit-manipulation ("B"), decimal floating-point ("L"), Packed SIMD (i.e. budget multimedia, "P"), vector processing ("V") and transactional memory ("T").
RISC-V has a constant 0 in place of register zero, 31 integer registers and optionally, 32 floating-point registers. All arithmetic, bitwise-logic and subroutine calls reference only registers to avoid delays from accessing memory.
A constant 0 is accessed as register 0. The assembler uses register 0 as a placeholder to make any of several human-readable instructions into one machine instruction, e.g.,
move rx to ry becomes
add r0 to rx and store in ry.
Control and status registers exist, but user-mode programs can access only those used for performance-measurement.
There are no instructions to save and restore multiple registers. Those were thought to be unnecessary, too complex and perhaps too slow.
Memory is addressed as 8-bit bytes. Loads and stores support data sizes from 8 bits to the computer's word size. Loads and stores larger than a byte need not be aligned to their natural word-width, but alignment may increase performance. (E.g. 16-bit, 2-byte data may fetch and store in less time if it is always aligned to start only on even addresses.) This feature reduces code size, and can be supported on simple CPUs with software emulation driven by an alignment failure interrupt.
Loads and stores can access constants in code, local variables in the stack, or items in a data structure. They calculate the address by adding a 12-bit signed offset to a base register. If the base register is zero, the data or constants can be in low memory, or high (negative offset) memory, such as ROM.
RISC-V handles 32-bit constants and addresses with instructions that set the upper 20 bits of a 32-bit register. Load upper immediate
lui stores 20 bits to bits 31 through 12. Another instruction,
auipc generates the same 20 upper address bits by adding an offset to the program counter and storing the result into a base register. This permits position-independent code to have 32-bit addresses relative to the program counter. The base register can be used as-is with the 12-bit offsets of the loads and stores. If needed,
addi can set the lower 12-bits of a register. In 64-bit ISAs,
auipc sign-extend the result to 64 bits.
Some fast CPUs may interpret combinations of instructions as single "fused" instructions.
auipc may be good candidates to fuse with loads or stores.
So, how does RISC-V manage memory systems that are shared between CPUs or threads? A thread of execution always sees its memory operations in the programmed order. But between threads and I/O devices, RISC-V is simplified: It doesn't guarantee the order of memory operations, except by specific instructions, such as
fence instruction guarantees that the results of predecessor operations are visible to successor operations of other threads or I/O devices.
fence can guarantee the order of combinations of both memory and memory-mapped I/O operations. E.g. it can separate memory read and write operations, without affecting I/O operations. Or, if a system can operate I/O devices in parallel with memory,
fence doesn't force them to wait for each other. A single CPU with one thread may decode
Like many RISC CPUs, RISC-V lacks address-modes that "write back" to the registers. For example, it does not do auto-incrementing.
RISC-V is little-endian to resemble other familiar, successful computers. This also reduces a CPU's complexity and costs slightly because it reads all sizes of words in the same order. For example, the RISC-V instruction set decodes starting at the lowest-addressed byte of the instruction. The specification leaves open the possibility of non-standard big-endian or bi-endian systems.
Some RISC CPUs (such as MIPS, PowerPC, DLX, and Berkeley's RISC-I) place 16-bits of offset in the loads and stores. They set the upper 16 bits by a "load upper word" instruction. This permits upper-halfword values to be set easily, without shifting bits. However, most use of the upper half-word instruction makes 32-bit constants, like addresses. RISC-V uses a SPARC-like combination of 12-bit offsets and 20-bit "set upper" instructions. The smaller 12-bit offset helps compact, 32-bit load and store instructions select two of 32 registers yet still have enough bits to support RISC-V's variable-length instruction coding.
Subroutine calls, jumps, and branches
RISC-V's subroutine call
jal (jump and link) places its return address in a register. This is faster in many computer designs, because it saves a memory access compared to systems that push a return address directly on a stack in memory.
jal has a 20-bit signed (2's complement) offset. The offset is multiplied by 2, then added to the PC to generate a relative address to a 32-bit instruction. If the result is not at a 32-bit address (i.e. evenly divisible by 4), the CPU may force an exception.
RISC-V CPUs jump to calculated addresses using a "jump and link-register,"
jalr is similar to
jal, but gets its destination address by adding a 12-bit offset to a base register. (In contrast,
jal adds a larger 20-bit offset to the PC.)
jalr's bit format is like the register-relative loads and stores. Like them,
jalr can be used with the instructions which set the upper 20 bits of a base register in order to make 32-bit branches, either to an absolute address (using
lui) or a PC-relative one (using
auipc for position-independent code). (Using a constant zero base address allows single-instruction calls to a small (the offset), fixed positive or negative address.)
jalr to get unconditional 20-bit PC-relative jumps and unconditional register-based 12-bit jumps. Jumps just make the linkage register 0 so that no return address is saved.
RISC-V also recycles
jalr to return from a subroutine: To do this,
jalr's base register is set to be the linkage register saved by
jalr's offset is zero and the linkage register is zero, so that there is no offset, and no return address is saved.
Like many RISC designs, in a subroutine call, a RISC-V compiler must use individual instructions to save registers to the stack at the start, and then restore these from the stack on exit. RISC-V has no "save multiple" or "restore multiple" register instructions. These were thought to make the CPU too complex, and possibly slow, as well. This can take more code space. Designers planned to reduce code size with library routines to save and restore registers.
RISC-V has no condition code register or carry bit. The designers believed that condition codes make fast CPUs more complex by forcing interactions between instructions in different stages of execution. This choice makes multiple-precision arithmetic more complex. Also, a few numerical tasks need more energy.
Instead, RISC-V has short branches that perform comparisons: equal, not-equal, less-than, unsigned less-than, greater-than and unsigned greater-than. Ten comparison-branch operations are implemented with only six instructions, by reversing the order of operands in the assembler. For example, "branch if greater than" can be done by "less than" with a reversed order of operands.
The comparing branches have a twelve-bit signed range, and jump relative to the PC.
RISC-V's ISA requires default branch predictions for CPUs: Backward conditional branches should be predicted "taken." Forward conditional branches predict "not taken." The predictions are easy to decode in a pipelined CPU: Branch addresses are signed numbers added to the PC. Backward branches have negative two's complement addresses, and therefore have a one in the most significant bit of the address. Forward branches have a zero. The most significant bit is in a fixed location in the operation code in order to speed up the pipeline. Complex CPUs can add branch predictors to work well even with unusual data or situations.
The ISA manual recommends that software be optimized to avoid branch stalls by using the default branch predictions. This reuses the most significant bit of the signed relative address as a "hint bit" to tell whether the conditional branch will be taken or not. So, no other hint bits are needed in the operation codes of RISC-V branches. This makes more bits available in the branch operation codes. Simple, inexpensive CPUs can merely follow the default predictions and still perform well with optimizing compilers. Compilers can still perform statistical path optimization, if desired.
To avoid unnecessary loading of branch prediction electronics, (and therefore unnecessary pipeline stalls) the comparing branch codes should never be used for unconditional jumps.
RISC-V does not support predication (the conditional execution of instructions) as its designers claim that CPUs without predication are easier to design, and optimizing compilers are less likely to mistakenly use predication where it should not be used. The designers claim that very fast, out-of-order CPU designs do predication anyway, by doing the comparison branch and conditional code in parallel, then discarding the unused path's effects. They also claim that even in simpler CPUs, predication is less valuable than branch prediction, which can prevent most stalls associated with conditional branches. Code without predication is larger, with more branches, but they also claim that a compressed instruction set (such as RISC-V's set "C") solves that problem in most cases.
Many RISC designs have included a branch delay slot, a position after a branch instruction that can be filled with an instruction which is executed whether or not the branch is taken. This feature can improve the performance of pipelined CPUs by absorbing some of the time wasted if a CPU mispredicts the operation of a conditional branch, and the CPU's pipeline stalls. RISC-V omits a branch delay slot because it complicates multicycle CPUs, superscalar CPUs, and long pipelines. Dynamic branch predictors have succeeded well enough to reduce the need for delayed branches.
Arithmetic and logic sets
RISC-V segregates math into a minimal set of integer instructions (set "I") with add, subtract, shift, bit-wise logic and comparing-branches. These can simulate most of the other RISC-V instruction sets with software. (The atomic instructions are a notable exception.) RISC-V currently lacks the "count leading zero" and bit-field operations normally used to speed software floating-point in a pure-integer processor.
The integer multiplication instructions (set "M") includes signed and unsigned multiply and divide. Double-precision integer multiplies and divides are included, as multiplies and divides that produce the "high word" of the result. The ISA document recommends that implementors of CPUs and compilers "fuse" a standardized sequence of high and low multiply and divide instructions to a single operation if possible. RISC-V's ISA document also recommends fusing a multiply-accumulate operation. (Multiply-accumulate is a core primitive of both digital signal processing and numerical linear algebra, and so is incorporated as part of a common benchmark, Coremark.)
The floating-point instructions (set "F") includes single-precision arithmetic and also comparison-branches similar to the integer arithmetic. It requires an additional 32 floating-point registers. These are separate from the integer registers. The double-precision floating point instructions (set "D") generally assume that the floating-point registers are 64-bit (i.e. double-width), and the "F" subset is coordinated with the "D" set. A quad-precision 128-bit floating-point ISA ("Q") is also defined. RISC-V computers without floating-point can use a floating-point software library.
RISC-V does not cause exceptions on arithmetic errors, including overflow, underflow, subnormal and divide by zero. Instead, both integer and floating-point arithmetic produce reasonable default values and set status bits. Divide-by-zero can be discovered by a single branch after the division. The status bits can be tested by an operating system or periodic interrupt.
Atomic memory operations
RISC-V supports computers that share memory between multiple CPUs and threads. RISC-V's standard memory consistency model is release consistency. That is, loads and stores may generally be reordered, but some loads are "acquire" operations which must precede later memory accesses, and some stores are "release" operations which must follow earlier memory accesses.
The base instruction set includes minimal support in the form of a
fence instruction to enforce memory ordering. Although this is sufficient (
fence r, rw provides "acquire" and
fence rw, w provides "release"), combined operations can be more efficient.
The atomic memory operation extension supports two types of atomic memory operations for release consistency. First, it provides general purpose "load-reserved"
lr and "store-conditional"
lr performs a load, and tries to reserve that address for its thread. A later store-conditional
sc to the reserved address will be performed only if the reservation is not broken by an intervening store from another source. If the store succeeds, a zero is placed in a register. If it failed, a non-zero value indicates that software needs to retry the operation. In either case, the reservation is released.
The second group of atomic instructions perform read-modify-write sequences: a load (which is optionally a load-acquire) to a destination register, then an operation between the loaded value and a source register, then a store of the result (which may optionally be a store-release). Making the memory barriers optional permits combining the operations. The optional operations are enabled by "acquire" and "release" bits which are present in every atomic instruction. RISC-V defines nine possible operations: swap (use source register value directly); add; bitwise and, or, and exclusive-or; and signed and unsigned minimum and maximum.
A system design may optimize these combined operations more than
sc. For example, if the destination register for a swap is the constant zero, the load may be skipped. If the value stored is unmodified since the load, the write may be skipped.
Release consistency is also an unusual choice. The IBM System/370 and its successors including z/Architecture, and x86, both implement a compare-and-swap (
cas guarantees that all threads will progress. Also
cas tests data, not bus access, simplifying the bus logic. The classic problem with
cas is that a thread "A" can read the data, followed by a read by thread B, and a write by A, causing failure in which both thread A and B appear to have access. In general, this is solved with a complex lock structure. However, a complex lock slows and complicates the computer. For example, the x86's "double-wide
cas" requires a special instruction format to specify multiple registers, performs several reads and writes, and can have complex bus operation.
However, release consistency is more efficient: It usually requires only one memory load, and minimizing slow memory operations is desirable. It's also exact: It controls all accesses to the memory cell, rather than just assuring a bit pattern. However, unlike
cas, it can permit a livelock, in which two or more threads hang waiting for each other. RISC-V guarantees forward progress (no live-lock) if the code follows rules on the timing and sequence of instructions: 1) It must use only the "I" subset. 2) To prevent repetitive cache misses, the code (including the retry loop) must occupy no more than 16 consecutive instructions. 3) It must not include any system or fence instructions, or taken backward branches between the
sc. 4) The backward branch to the retry loop must be to the original sequence.
The specification gives examples of how to use this subset to lock a data structure.
The compressed set
The standard RISC-V ISA specifies that all instructions are 32 bits. This makes for a particularly simple implementation, but like other RISC processors with such an instruction encoding, results in larger code size than in other instruction sets. To compensate, RISC-V's "32-bit" instructions are actually 30 bits; 3⁄4 of the opcode space is reserved for an optional (but recommended) variable-length "compressed" instruction set, RVC, that includes 16-bit instructions. Like ARM's Thumb and the MIPS16, the compressed instructions are simply aliases for a subset of the larger instructions. Unlike ARM's Thumb or the MIPS compressed set, space was reserved from the beginning so there is no separate operating mode. Standard and compressed instructions may be intermixed freely. (letter "C")
Because (like Thumb-1 and MIPS16) the compressed instructions are simply alternate encodings (aliases) for a selected subset of larger instructions, the compression can be implemented in the assembler, and it is not essential for the compiler to even know about it.
A prototype of RVC was tested. The prototype code was 20% smaller than an x86 PC and MIPS compressed code, and 2% larger than ARM Thumb-2 code. It also substantially reduced both the needed cache memory and the estimated power usage of the memory system.
The researcher intended to reduce the code's binary size for small computers, especially embedded computer systems. The prototype included 33 of the most frequently used instructions, recoded as compact 16-bit formats using operation codes previously reserved for the compressed set. The compression was done in the assembler, with no changes to the compiler. Compressed instructions omitted fields that are often zero, used small immediate values or accessed subsets (16 or 8) of the registers.
addi is very common and often compressible.
Much of the difference in size compared to Arm's Thumb set occurred because RISC-V, and the prototype, have no instructions to save and restore multiple registers. Instead, the compiler generated conventional instructions that access the stack. The prototype RVC assembler then often converted these to compressed forms that were half the size. However, this still took more code space than the ARM instructions that save and restore multiple registers. The researcher proposed to modify the compiler to call library routines to save and restore registers. These routines would tend to remain in a code cache and therefore run fast, though probably not as fast as a save-multiple instruction.
The embedded subset
An instruction set for the smallest "embedded" CPUs (set "E") is reduced in other ways: Only 16 of the 32-bit integer registers are supported. Floating-point instructions should not be supported (the specification forbids it as uneconomical), so a floating-point software library must be used. The compressed set "C" is recommended. The privileged instruction set supports only machine mode, user mode and memory schemes that use base-and-bound address relocation.
Correspondents have proposed even smaller, nonstandard, 16-bit "RV16E" ISAs: One would use a 16x16-bit integer register file, using the standard "EIMC" ISAs (including 32-bit instructions.) Another proposal would only use the 16-bit "C" instructions with an 8x16-bit register file. A full RV16EG was said to be possible with a completely recoded ISA.
Privileged instruction set
The privileged instruction set specification of RISC-V is currently (July 2017) preliminary.
RISC-V's ISA includes a separate privileged instruction set specification.
Version 1.10 of the specification supports several types of computer systems:
- Systems that have only "machine mode," perhaps for embedded systems,
- Systems with both machine mode (for the supervisor) and user-mode, perhaps to implement Linux.
- Systems with machine-mode, hypervisors, multiple supervisors, and user-modes under each supervisor.
These correspond roughly to systems with up to four "rings" of privilege and security, at most: machine, hypervisor, supervisor and user. Each layer also is expected to have a thin layer of standardized supporting software that communicates to a more-privileged layer, or hardware.
The overall plan for this ISA is to make the hypervisor mode orthogonal to the user and supervisor modes. The basic feature is a configuration bit that either permits supervisor-level code to access hypervisor registers, or causes an interrupt on accesses. This bit lets supervisor mode directly handle the hardware needed by a hypervisor. This simplifies a type 2 hypervisor, hosted by an operating system. This is a popular mode to run warehouse-scale computers. To support type 1, unhosted hypervisors, the bit can cause these accesses to interrupt to a hypervisor. The bit simplifies nesting of hypervisors, in which a hypervisor runs under a hypervisor. It's also said to simplify supervisor code by letting the kernel use its own hypervisor features with its own kernel code. As a result, the hypervisor form of the ISA supports five modes: machine, supervisor, user, supervisor-under-hypervisor and user-under-hypervisor.
The privileged instruction set specification explicitly defines "hardware threads," or "harts." Multiple hardware threads are a common practice in larger, more powerful computers. When one thread is stalled, waiting for memory, others can often proceed. Hardware threads can help make better use of the large number of registers and execution units in large CPUs. Finally, hardware threads can be a simple, powerful way to handle interrupts: No saving or restoring of registers is required, simply executing a different hardware thread. The only hardware thread required in a RISC-V computer is thread zero.
The existing control and status register definitions support RISC-V's error and memory exceptions, and a small number of interrupts. For larger systems, the specification also defines an interrupt controller. Interrupts always start at the highest-privileged machine level, and the control registers of each level have explicit "forwarding" bits to route interrupts to less-privileged code. For example, the hypervisor need not include software that executes on each interrupt to forward an interrupt to an operating system. Instead, on set-up, it can set bits to forward the interrupt.
Several memory systems are supported in the specification. Physical-only is suited to the smallest embedded systems. Hardware address relocation using a single set of base-and-bound registers permits different code to run at the same address. Hardware relocation for two separate sets of base and bound registers permits processes with different RAM to share the same code, or permits a system to run code from read-only memory. These options are suitable for systems that keep all code and data in memory. Applications include intermediate-sized embedded systems, and fast supercomputers that operate from memory. There are also three UNIX-style virtual memory systems for memory cached in mass-storage systems.
The virtual memory systems have three sizes, with addresses sized 32, 39 and 48-bits. All virtual memory systems support 4 KiB pages, multilevel page-table trees and use very similar algorithms to walk the page table trees. All are designed for either hardware or software page-table walking. To optionally reduce the cost of page table walks, super-sized pages may be leaf pages in higher levels of a system's page table tree. SV32 has a two layer page table tree and supports 4 MiB superpages. SV39 has a three level page table, and supports 2 MiB superpages and 1 GiB gigapages. SV48 is required to support SV39. It also has a 4-level page table and supports 2 MiB super pages, 1 GiB gigapages, and 1 TiB terapages. Superpages are aligned on the page boundaries for the next-lowest size of page.
For simple, cost-reduced RISC-V systems, there is a proposal to use the floating-point registers' bits to perform parallel SIMD sub-word arithmetic. This is widely used to accelerate multimedia and other digital signal processing. This ISA is (as of 2016) undefined, but could resemble PA-RISC's multimedia instructions. Besides its native 64-bit math, the PA-RISC MAX2 CPU could do arithmetic on four 16-bit subwords at a time, with several overflow methods. It also could move subwords to different positions. PA-RISC's MAX2 was intentionally simplified. It lacked support for 8-bit or 32-bit subwords. The 16-bit subword size was chosen to support most digital signal processing tasks. These instructions were inexpensive to design and build. However, they increased the CPU's performance on digital signal processing tasks by 48-fold or more, enabling practical real-time video Codecs in 1995.
The proposed vector processing instruction set may make the packed SIMD set obsolete. The designers hope to have enough flexibility so that a CPU can implement vector instructions in a standard processor's registers. This would enable minimal implementations with similar performance to a multimedia ISA, (as above.) However, a true vector coprocessor could execute the same code with higher performance.
The vector processing proposal is currently (29 June 2015) a conservative, flexible design of a general-purpose mixed-precision vector processor (suitable for executing compute kernels). Code would port easily to CPUs with differing vector lengths, ideally without recompiling.
In contrast, short-vector SIMD extensions are less convenient. These are used in x86, ARM and PA-RISC. In these, a change in word-width forces a change to the instruction set to expand the vector registers (in the case of x86, from 64-bit MMX registers to 128-bit SSE, to 256-bit AVX, and AVX-512). The result is not only a growing instruction set, but also a need to port working code to the new instructions.
In the RISC-V vector ISA, rather than fix the vector length in the architecture, an instruction (
setvl) is available which takes a requested size and sets the vector length to the minimum of the hardware limit and the requested size. So, the RISC-V proposal is more like a Cray's long-vector design. That is, each vector in up to 32 vectors is the same length.
The application specifies the total vector width it requires, and the processor determines the vector length it can provide with available on-chip resources. This takes the form of an instruction (
vsetcfg) with four immediate operands, specifying the number of vector registers of each available width needed. The total must be no more than the addressable limit of 32, but may be less if the application does not require them all. The vector length is limited by the available on-chip storage divided by the number of bytes of storage needed for each entry. (Added hardware limits may also exist, which in turn may permit SIMD-style implementations.)
The vector length is not only architecturally variable, but designed to vary at run time also. To achieve this flexibility, the instruction set is likely to use variable-width data paths and variable-type operations using polymorphic overloading. The plan is that these can reduce the size and complexity of the ISA and compiler.
Recent experimental vector processors with variable-width data paths also show profitable increases in operations per: second (speed), area (lower cost), and watt (longer battery life).
External debug system
There is a preliminary specification for RISC-V's hardware-assisted debugger. The debugger will use a transport system such as Joint Test Action Group (JTAG) or Universal Serial Bus (USB) to access debug registers. A standard hardware debug interface may support either a "standardized abstract interface" or "instruction feeding."
The exact form of the "abstract interface" remains undefined (January 2017), but proposals include a memory mapped system with standardized addresses for the registers of debug devices or a command register and a data register accessible to the communication system. Correspondents claim that similar systems are used by Freescale's BDM for some CPUs, ARM, OpenRISC and Aeroflex's Leon/SPARC.
In "instruction feeding," the CPU will process a debug exception to execute individual instructions written to a register. This may be supplemented with a data-passing register and a module to directly access the memory. Instruction feeding lets the debugger access the computer exactly as software would. It also minimizes changes in the CPU, and adapts to many types of CPU. This was said to be especially apt for RISC-V because RISC-V is explicitly designed for many types of computers. The data-passing register allows a debugger to write a data-movement loop to RAM, and then execute the loop to move data into or out of the computer at a speed near the maximum speed of the debug system's data channel. Correspondents claim that similar systems are used by MIPs, Intel Quark, Tensilica's Xtensa and for Freescale Power CPUs' BDM.
- OpenRISC, licensed under the GNU General Public License
- Reduced instruction set computing
- Open-source computing hardware
- OVPsim, instruction accurate simulator of RISC-V processor instruction subsets, cores, and systems. Freely available for non-commercial usage.
- "Contributors". riscv.org. Regents of the University of California. Retrieved 25 August 2014.
- "Rocket Core Generator". RISC-V. Regents of the University of California. Retrieved 1 October 2014.
- Waterman, Andrew; Asanović, Krste. "The RISC-V Instruction Set Manual, Volume I: Base User-Level ISA version 2.2". University of California, Berkeley. EECS-2016-118. Retrieved 25 May 2017.
- Celio, Christopher; Love, Eric. "ucb-bar/riscv-sodor". GitHub Inc. Regents of the University of California. Retrieved 12 February 2015.
- "SHAKTI Processor Project". Indian Institute of Technology Madras. Retrieved 15 September 2014.
- Celio, Christopher. "CS 152 Laboratory Exercise 3" (PDF). UC Berkeley. Regents of the University of California. Retrieved 12 February 2015.
- Demerjian, C. (2013). "A long look at how ARM licenses chips: Part 1". SemiAccurate."How ARM licenses it’s IP for production: Part 2".
- Asanovic, Krste. "Instruction Sets Should be Free" (PDF). U.C. Berkeley Technical Reports. Regents of the University of California. Retrieved 15 November 2016.
- Patterson, David A; Ditzel, David R. (October 1980). "The Case for the Reduced Instruction Set Computer". ACM SIGARCH Computer Architecture News. 8 (6): 25. doi:10.1145/641914.641917.
- "Amber ARM-compatible core". OpenCores. OpenCores. Retrieved 26 August 2014.
- "ARM4U". OpenCores. OpenCores. Retrieved 26 August 2014.
- Merritt, Rick. "Google, Oracle and HP Join RISC-V". EE Times. UBM. Retrieved 11 February 2016.
- Waterman, Andrew; Lee, Yunsup; Avizienas, Rimas; Patterson, David; Asanovic, Krste. "Draft Privileged ISA Specification 1.9". RISC-V. RISC-V Foundation. Retrieved 30 August 2016.
- RISC-V Foundation. "RISC-V The Free and Open Instruction Set". The RISC-V Foundation's Web Site. The RISC-V Foundation. Retrieved 11 November 2016.
- Celio, Christopher. "riscv-boom". GitHub. Regents of the University of California. Retrieved 11 November 2016.
- Asanovic, Krste; et al. "rocket-chip". GitHub. The RISC-V Foundation. Retrieved 11 November 2016.
- Celio, Christopher. "riscv-sodor". GitHub. Regents of the University of California. Retrieved 11 November 2016.
- "Chisel: Constructing Hardware in a Scala Embedded Language". UC Berkeley. Regents of the University of California. Retrieved 12 February 2015.
- "FreeBSD Wiki: RISC-V".
- "FreeBSD Foundation: Initial FreeBSD RISC-V Architecture Port Committed".
- "Architectures/RISC-V". Fedora WIKI. Red Hat. Retrieved 26 September 2016.
- Begari, Padmarao. "U-Boot port on RISC-V 32-bit is available". Google Groups. Microsemi. Retrieved 15 February 2017.
- The HiFive product page on SiFive.com
- SiFIVE. "Hi-FIVE1: Open-source Arduino-Compatible Development Kit". CROWDSUPPLY. crowdsupply.com. Retrieved 2 December 2016.
- Manners, David. "Codasip and UltraSoC Combine on RISC-V". Electronics Weekly. Metropolis International Group, Ltd. Retrieved 23 November 2016.
- "IIT Madras Open Source Processor Project". Rapid IO. IIT Madras. Retrieved 13 September 2014.
- Xie, Joe (July 2016). NVIDIA RISC V Evaluation Story. 4th RISC-V Workshop. Youtube.
- Ashenden, Peter (9 November 2016). "Re: [isa-dev] RISC V ISA for embedded systems". RISC-V ISA Dev (Mailing list). Google. Retrieved 10 November 2016.
At ASTC (www.astc-design.com), we have an implementation of RV32EC as a synthesizable IP core intended for small embedded applications, such as smart sensors and IoT.
- Oloffsson, Andreas. "Why I will be using RISC-V in my next chip.". Adapteva Blog. Adapteva. Retrieved 11 February 2016.
- "lowRISC website". Retrieved 10 May 2015.
- Traber, Andreas; et al. "PULP:Parallel Ultra Low Power". ETH Zurich, University of Bologna. Retrieved 5 August 2016.
- Waterman, Andrew (13 May 2011). Improving Energy Efficiency and Reducing Code Size with RISC-V Compressed. U.C. Berkeley: Regents of the University of California. p. 32. Retrieved 25 August 2014.
- Waterman, Andrew; et al. "The RISC-V Compressed Instruction Set Manual Version 1.9 (draft)" (PDF). RISC-V. Retrieved 18 July 2016.
- "Coremark FAQ, "What factors are involved in improving a device?"". Coremark, an EEMBC Benchmark. EEMBC. Retrieved 1 October 2014.
- Brussee, Rogier. "Proposal: Xcondensed, [a] ... Compact ...16 bit standalone G-ISA". RISC-V ISA Mail Server. Google Groups. Retrieved 10 November 2016.
- Bonzini, Paolo; Waterman, Andrew. "Proposal for Virtualization without H mode". Google Groups, RISC-V ISA Dev. RISC-V Foundation. Retrieved 24 February 2017.
- Lee, Ruby; Huck, Jerry (February 25, 1996). "64-bit and Multimedia Extensions in the PA-RISC 2.0 Architecture". Proceedings of Compcon 96: 152–160. Retrieved 21 September 2014.
- Lee, Ruby B. (April 1995). "Accelerating Multimedia with Enhanced Microprocessors" (PDF). IEEE Micro. 15 (2): 22–32. doi:10.1109/40.372347. Retrieved 21 September 2014.
- Schmidt, Colin; Ou, Albert; Lee, Yunsup; Asanovic, Krste. "RISC-V Vector Extension Proposal" (PDF). RISC-V. Regents of the University of California. Retrieved 14 March 2016.
- Ou, Albert; Nguyen, Quan; Lee, Yunsup; Asanovic, Krste. "A Case for MVPs: Mixed-Precision Vector Processors" (PDF). UC Berkeley EECS. Regents of the University of California. Retrieved 14 March 2016.
- Lee, Yunsup; Grover, Vinod; Krashinsky, Ronny; Stephenson, Mark; Keckler, Stephen W.; Asanovic, Krste. "Exploring the Design Space of SPMD Divergence Management on Data-Parallel Architectures" (PDF). Berkeley's EECS Site. Regents of the University of California. Retrieved 14 March 2016.
- Bradbury, Alex; Wallentowitz, Stefan. "RISC-V Run Control Debug". Google Docs. RISC-V Foundation. Retrieved 20 January 2017.
- Newsome, Tim. "RISC-V Debug Group>poll results". Google Groups, RISC-V Debug Group. RISC-V Foundation. Retrieved 20 January 2017.
- The RISC-V Instruction Set Manual
- Instruction Sets Should Be Free: The Case For RISC-V Whitepaper by Krste Asanović and David A. Patterson
- The RISC-V Instruction Set HotChips 25 (2013)
- The RISC-V Software Ecosystem HPCA 2015, Tutorial
- Rocket Chip HPCA 2015, Tutorial
- The RISC-V Compressed Instruction Set Manual Version 1.9 (draft)
- Official website
- "RISC-V: An Open Standard for SoCs. The case for an open ISA". EETimes. 8 July 2014.
- Hruska, Joel (21 August 2014). "RISC rides again: New RISC-V architecture hopes to battle ARM and x86 by being totally open source". ExtremeTech.
- "Analyzing the RISC-V Instruction Set Architecture". Adapteva. 11 August 2014.
- "search: RISC-V since 2013". Google Scholar.