A_32-bit_RISC-V_AXI4-lite_bus-based_microcontroller_with_10-bit_SAR_ADC
A_32-bit_RISC-V_AXI4-lite_bus-based_microcontroller_with_10-bit_SAR_ADC
Abstract—In this paper a complete implementation and design order to explore all the status of the peripherals while the
of a fully-synthesized 32-bit microcontroller in a 130nm CMOS microprocessor is still executing its program.
technology is presented. This is the first microcontroller featuring
the open source RISC-V instruction set all mounted through II. RISC-V
AXI4-Lite and APB buses for communication process. The
microcontroller contains a 10-bit SAR ADC, a 12-bit DAC, an RISC-V is a new open instruction set architecture (ISA)
8-bit GPIO module, a 4kB-RAM, an SPI AXI slave interface for designed by the Berkeley Architecture Group with the aim
output verification, and an SPI APB slave interface for checking to support architecture research and education [1]. RISC-V
the correct behavioral of the APB bridge. All peripherals are is fully available to public and has advantages such as a
controlled by a RISC-V and an SPI AXI master interface that is smaller footprint size, support for highly-parallel multi-core
used for programming the device and checking the data flowing
through all the slaves. A total power density is reported as or many-core implementations [2], variable-length instructions
167µW/MHz and the area for this RISC-V microcontroller has to support an optional dense instruction, and energy efficient.
a reduced footprint of 798µm×484µm. Moreover, RISC-V presents improvements in different charac-
teristics over another open ISAs as shown the comparison in
I. INTRODUCTION the Table I.
V instruction set. However, up to date there has not been any funct7 rs2 rs1 funct3 rd OPCODE R-type
reported work with of a small footprint RISC-V core for low- imm[11:0] rs1 funct3 rd OPCODE I-type
power microcontroller applications.
We are presenting the implementation of the first reported imm[11:5] rs2 rs1 funct3 imm[4:0] OPCODE S-type
32-bit RISC-V based microcontroller (mRISC-V). Our imple-
mentation and design is equivalent to commercial microcon- imm[31:12] rd OPCODE U-type
trollers implemented with an ARM-M0 core. Features of this Fig. 1. RISC-V base instruction formats
microcontroller are: AXI4-Lite and APB buses for interfac-
ing communication between the core and all the peripherals The base ISA is clean and suitable for direct hardware
attached to it, a 4kB-RAM, Serial Peripheral Interface (SPI) implementation, the instructions of RISC-V are similar to
slaves for output, a GPIO module, a SAR Analog-to-Digital other RISC instructions set such as OpenRISC. The Fig.
converter and a Digital-to-Analog converter. The circuit was 1 shows the four core instruction formats (R,I,S,U). R-type
designed using 130nm CMOS technology and tested using format is used for several arithmetic instructions with one or
an efficient test algorithm in bus and using RISC-V tool- two source operands and for the atomic memory operation
chain. In addition, a master SPI has been implemented in (AMO) instructions that perform read-modify-write operations
for multiprocessor synchronization. In addition, R-type is used
RISC-V
INSTRUCTIONS ALU Registers
Instructin
Decoder
SPI
Multiplier PCPI RISC-V Master
Controller
Memory
R-type S-type I-type U-type
for computational instruction register-register. I-type format is ADC DAC GPIO RAM
SPI SPI
used for system instructions to access system functionality that 10-bit 12-bit 8 pins 4 KB
Slave 10 MHz
Slave
might require privileged access and computational instructions
register-immediate. Load and store instructions transfer a value
between the registers and memory. Loads are encoded in the Fig. 3. mRISC-V block diagram.
I-type format and stores are S-type. U-type format is used for
JAL instructions or immediate instructions as LUI (load upper
data channels of 32-bit and other necessary control signals for
immediate) and AUIPC (add upper immediate to pc), see Fig.
communication between Masters (SPI M, RISC-V) and slaves
2. All formats are fixed 32-bit in length, and keeps the source
(RAM, SPI S, APB) [5].
(rs1 and rs2) and destination (rd) registers at the same position
According to the AXI4 specification, communication be-
to simply decoding, for all formats the bit 31 is the sign bit.
tween the masters and the slaves must be done through
RISC-V architecture contains an Arithmetic Logic Unit
an Interconnect module. For this application the AXI4-Lite
(ALU), registers, past memory and future memory, an inter-
interconnect has been implemented following specification.
rupt system, an instruction decoder and a Pico co-processor
interface (PCPI) which is connected to a co-processor to do B. SPI Master
multiplications. We have implemented a reduced instruction SPI is used as a master AXI4-Lite interface for controlling
set microcontroller mRISC-V, described in verilog, using a all slaves attached to the core. This interface has a 66-bit
smaller core to promote research and development of the data instruction: 32-bit for data, 32-bit for address and 2-
internet of things. According to [1], the implemented sub-set bit to define an action like write, read; to put the core reset;
of instructions are RV32I Base Integer Instruction Set (all) and check the last request. This is a fully custom design for
and ”M” Standard Extension for Integer Multiplication and debugging and programming purposes.
Division (only MUL[H[SU—U]]).
C. APB
III. M RISC-V ARCHITECTURE
Several types of protocols are available in SoC, which
Implementation of an efficient microcontroller requires a
require a bridge to safely pass the information from one
reliable and fast communication between masters and slaves
type of protocol to another without data loss. The Advance
blocks in the microcontroller. Nowadays, many bus-based
Peripheral Bus (APB) is part of the Advaced Microcontroller
communication architecture standards are found. In this work
Bus Architecture (AMBA) protocol family. This protocol
we are using the AMBA and APB protocols such that we can
determines a low-cost interface that is optimized for minimal
compare with microcontrollers based on ARM-M0 cores. The
power expending and decreased interface complexity used to
architecture of the mRISC-V is shown in Fig. 3.
connect to low-bandwidth peripherals that do not demand the
Slave interfaces are interconnected to the AXI4-Lite or to
high performance of the AXI protocol.
the APB Bridge. Each interface is different but with several
The signal transaction between AXI master and APB slave
similarities for each protocol. Buses are composed of state
are described by:
machines, registers, multiplexers and Hi-Z buffers. Moreover,
• AMBA AXI-Lite signals as described in the AMBA AXI-
the master interface is implemented with a Serial Peripheral In-
terface (SPI). Following sections describe all these interfaces. Lite 4.0 protocol specification. [5]
• AMBA APB signals as described in the AMBA APB 4.0
A. AXI4-Lite protocol specification. [6]
The AMBA AXI4 is an ultra-high performance protocol The APB bridge provides an interface between the high-
bus standard [4] developed by ARM for easy application in speed AXI domain and the low-power APB domain. It’s
small scale SoCs. AXI4 has different forms to be implemented seen as slave on AXI but as a master on APB. To run
and this work uses the AXI4-Lite protocol, which has two a process of writing or reading transfers on the AXI bus
AXI
scoreboard
AXI master
trasaction
RAM
Write read/
AXI4-LITE
get data SPI slave
AXI master 1
DAC
Write read/
get data
ADC
APB
AXI master
trasaction GPIO
AXI master 2
SPI slave
Fig. 8. Final layout for AXI-APB implementation. Area:798µm×484µm