Information in this document is provided “as is”, with all faults.
SiFive expressly disclaims all warranties, representations and conditions of any kind, whether
express or implied, including, but not limited to, the implied warranties or conditions of
merchantability, fitness for a particular purpose and non-infringement.
SiFive does not assume any liability rising out of the application or use of any product or circuit, and
specifically disclaims any and all liability, including without limitation indirect, incidental, special,
exemplary, or consequential damages.
SiFive reserves the right to make changes without further notice to any products herein.
Release Information
VersionDateChanges
v3p0Feb 28, 2019Updated for 19.02 Core IP Release
v2p0Feb 2, 2018Updated to match v2p0 of the Evaluation MCS:
This document gives necessary information for a user of the SiFive Core IP FPGA Eval Kit. To
learn more about the functionality of your specific Core IP please read the appropriate Core IP
Manual.
This guide will help you download and flash the Core IP FPGA Eval Kit image to an FPGA
development board. It will help you install software tools to allow you to write, upload, and debug
code on the Eval Kit. It also contains information about what is contained in the MCS file for the
Core IP FPGA Eval Kit.
1.2About this Release
This Eval Kit allows you to prototype and benchmark your target RISC-V software without
modifying, integrating, or synthesizing any Verilog code.
This release is intended for evaluation purposes only.
1.3Evaluation Version Limitations
Version v19.02 of the Core IP FPGA Eval Kit has the following limitations compared with the fully
functional Core IP:
• DTIM is limited in size to 64kB.
• Peripheral Bus, System Bus, and Front Bus are not exported for additional user connections.
The evaluation can utilize the peripherals included on the FPGA.
• Not all Local and Global interrupts are exported at the top level.
To target a different FPGA platform or perform synthesis or simulation, you may obtain an
Evaluation Version of the Core IP RTL from sifive.com.
1
2SiFive Core IP FPGA Eval Kit User Guide v3p0
Chapter 2
Required Hardware
The Core IP FPGA Eval Kit requires the following hardware:
2.1Xilinx Arty A7 Artix-7 FPGA Evaluation Kit
The Arty A7 is a Xilinx FPGA development board for makers and hobbyists. The Arty A7 comes
in two FPGA variants: The Arty A7-35T features Xilinx XC7A35TICSG324-1L. The Arty A7-100T
features the larger Xilinx XC7A100TCSG324-1. Both can be purchased from Digilent or Avnet.
The Olimex ARM-USB-TINY-H is a hardware JTAG debugger. The Core IP Arty FPGA Dev Kit has
a standard JTAG debugging interface, and the tools included with the Core IP FPGA Eval Kit have
been tested using the Olimex ARM-USB-TINY-H. It can be purchased from Olimex or Digi-Key.
Any standard USB Type A Male to B Male cable can be used to interface to the Olimex ARM-USBTINY-H Debugger. Note that the package does not include one. These are available from a variety
of sources, including Digi-Key.
The connection between the Olimex ARM-USB-TINY-H and Core IP FPGA Eval Kit requires 10
connections. These can be made with Male-to-Female jumper cables. These cables are available
from Adafruit in convenient rip-apart ribbon cables:
https://www.adafruit.com/products/826
Chapter 3
Board Setup
3.1Connecting the USB Interface
Connect the USB Type A to Micro-B cable between the USB-JTAG port (J10) of the Arty and
the host machine. This provides UART console access to the Core IP FPGA Eval Kit as well
as a 5V power source for the board. This is also the interface by which the FPGA fabric will be
programmed.
3.2Connecting the Debugger
The debugger is essential for downloading and debugging code with your SDK. The software will
be downloaded to SPI Flash, so it will be retained. Without the debugger you can only flash
the FPGA image and run the included demo program, you cannot change the software which
executes.
Connect the Olimex ARM-USB-TINY-H with the USB Type A to B cable to the host machine. Then
connect the Olimex ARM-USB-TINY-H debugger to PMOD header JD using the 10 jumper cables.
The pinout is as shown in Figure 3.1. Note that the Olimex ARM-USB-TINY-H and the PMOD
header on the Arty Board have different numbering schemes. Figures 3.2 and 3.3 clarify the
different pinouts for the two connectors.
Figure 3.4 shows what the board looks like with all the debug connections in place.
Note: It is important to connect to PMOD header JD (not JA, JB, or JC). JD was selected over the
other PMOD headers to avoid damage to the Arty board in the event of mismatched connections.
The Xilinx Vivado Design Suite is used for flash programming. Both the Vivado Lab Edition and
WebPACK Edition 2018.2 support Artix-7 devices free of charge.
4.1Programming the Arty 35T SPI Flash
To program the Arty 35T SPI Flash with Vivado take the following steps:
1. Launch Vivado
2. Open Hardware Manager
3. Open target board
4. Right click on the FPGA device and select ”Add Configuration Memory Device”
5. Select the following SPI flash parameters:
Partm25ql128
ManufacturerMicron
Aliasn25q1283˙3vspi-x1 x2 x4
Familymt25ql
Typespi
Density128
Widthx1 x2 x4
6. Click OK to “Do you want to program the configuration memory device now?”
7. Add the MCS file
9
10SiFive Core IP FPGA Eval Kit User Guide v3p0
8. Select OK
9. Once the programming completes in Vivado, press the “PROG” Button on the Arty Board to
load the image into the FPGA.
4.2Programming the Arty 100T SPI Flash
To program the Arty 100T SPI Flash with Vivado take the following steps:
1. Launch Vivado
2. Open Hardware Manager
3. Open target board
4. Right click on the FPGA device and select ”Add Configuration Memory Device”
5. Select the following SPI flash parameters:
Parts25fl128sxxxxxx0
ManufacturerSpansion
Aliass25fl127s
Familys25flxxxs
Typespi
Density128
Widthx1 x2 x4
6. Click OK to “Do you want to program the configuration memory device now?”
7. Add the MCS file
8. Select OK
9. Once the programming completes in Vivado, press the “PROG” Button on the Arty Board to
load the image into the FPGA.
Chapter 5
Boot and Run
5.1Serial Setup
Using a terminal emulator such as GNU screen on Linux or a terminal on Windows, open a console
connection from the host computer to the Core IP FPGA Eval Kit.
Set the following parameters:
Speed115200
ParityNone
Data bits8
Stop bits1
Hardware FlowNone
For example, on Linux using GNU Screen:
sudo screen /dev/ttyUSB2 115200
You can use Ctrl-a k to “kill” (exit) the running screen session.
Depending on your setup, you may need additional drivers or permissions to communicate over
the USB port.
If you are running on Ubuntu-style Linux, the below is an example of steps you may need to follow
to access your dev kit without sudo permissions:
1. With your board’s debug interface connected, make sure your device shows up with the
lsusb command:
> lsusb
...
Bus XXX Device XXX: ID 0403:6010 Future Technology Devices
International, Ltd FT2232C Dual USB-UART/FIFO IC
2. Set the udev rules to allow the device to be accessed by the plugdev group:
11
12SiFive Core IP FPGA Eval Kit User Guide v3p0
> sudo vi /etc/udev/rules.d/99-openocd.rules
Add the following lines and save the file (if they are not already there):
# These are for the HiFive1 Board
SUBSYSTEM=="usb", ATTR{idVendor}=="0403",
3. See if your board shows up as a serial device belonging to the plugdev group:
> ls /dev/ttyUSB*
/dev/ttyUSB0 /dev/ttyUSB1 /dev/tty/USB2 /dev/tty/USB3
(If you have other serial devices or multiple boards attached, you may have more devices
listed). For serial communication with the UART, you will always want to select the higher
number of the pair, in this example /dev/ttyUSB2.
> ls -l /dev/ttyUSB2
crw-rw-r-- 1 root plugdev 188, 1 Nov 28 00:00 /dev/ttyUSB1
4. Add yourself to the plugdev group to eliminate the need to sudo for access to the device.
You can use the whoami command to determine your user name.
> whoami your user name > sudo usermod -a -G plugdev your user name
5. Log out and log back in, then check that you’re now a member of the plugdev group:
> groups
...plugdev ...
Now you should be able to access the serial (UART) and debug interface without sudo
permissions.
The FPGA Core IP Eval Kit’s boot code contains a jump to the external SPI Flash as described in
the DTS file.
For example,an E2/E3 or S5 Core IP FPGA Eval Kit’s reset vector is set using Switch 0 on the
board. When the switch is “Off” (set towards the edge of the board), the reset vector is set to
0x40400000, which is mapped to the external SPI Flash on the board.
A S7 or E7 Core IP FPGA Eval Kit will default to the QSPI to boot at address 0x20400000.
5.1.2Load a Program
You can change the program which the Eval Kit runs by using the debug/programming interface to
flash a new compiled program into the DTIM or SPI Flash.
When Switch 0 is “On” (set away from the edge of the board), the reset vector is set to 0x00000000.
This will cause the core to simply wait for the debugger to load a program.
5.2Default Demo Program
For Core IP the MCS file includes a simple demo program. This program is loaded to the SPI
Flash along with the FPGA image.
With Switch 0 set to the “Off” position (towards the edge of the board), on reset the Core will
execute a simple demo program. This program prints a message over the UART and uses the
PWM peripheral to change RGB LED 1. This program will be overwritten in the SPI Flash when
you program new software into the board with the SDK, but the FPGA image will not be modified.
Source for this program is included in the SDK.
5.2.1Terminal Log
If you have your serial setup correctly, your terminal will display a figure similar to the below. (you
may need to hit the ‘Reset’ button to restart the program):
SIFIVE, INC.
5555555555555555555555555
55555555
55555555
55555555
55555555555555555555555555
5555555555555555555555555555
55555555
55555555
55555555
555555555555555555555555555555555
5555555555555555555
555555555555555
55555555555
5555555555
5555555555
5555555555
5555555555
5555555555
555555555
14SiFive Core IP FPGA Eval Kit User Guide v3p0
55555
5
BUILD TIME : Feb 28 2019 : 00:00:00
Welcome to the E21 Core IP FPGA Evaluation Kit!
Chapter 6
Software Development Flow
SiFive supports several methods of obtaining the software development toolchain. Freedom Studio
is an Eclipse-Based IDE which bundles everything you need into one download. You can also
compile the source yourself and run command line tools with the Freedom E SDK..
These different development versions will all install the same set of tools, but the versions, install
paths and associated software libraries and examples are different for each.
6.1Supported Platforms
Freedom Studio is supported on Linux, macOS, and Windows.
6.2Software Development Using Freedom Studio IDE
SiFive recommends software development for the Core IP FPGA Eval Kit with the Eclipse-based
Freedom Studio IDE. Freedom Studio is supported for Windows, macOS, and Linux. When using
this method, the precompiled tools and drivers are automatically installed, you do not need to
download or install it seperately to get tools and example code.
You can obtain Freedom Studio from the SiFive website:
https://www.sifive.com/boards
More information on how to use it can be found in the Freedom Studio Manual:
6.3Software Development Using Freedom E SDK Command Line Tools
Freedom-E-SDK is a public github repository, maintained by SiFive Inc, that makes it easy to
get started developing software for SiFive’s Freedom and RISC-V Core IP Platforms. The SDK
supports a wide array of SiFive Core IPs, SoCs and Emulation environments.
https://github.com/sifive/freedom-e-sdk
This section describes how to setup the toolchain and configure the SDK. The section also walks
through building an example program and executing it in the RTL testbench included in a SiFive
Core IP deliverable. In addition, the section will walk through how to import custom BSPs and
build a program using the custom BSP target.
15
16SiFive Core IP FPGA Eval Kit User Guide v3p0
6.3.1Setting Up Freedom-E-SDK
Prerequisites
To use this SDK, you will need the following software available on your machine:
GNU Make
Git
Toolchain Prerequisites
To build examples and programs, you will need the following software installed on your machine:
• RISC-V GNU Toolchain
• RISC-V OpenOCD (for use with development board and FPGA targets)
Pre-built versions of these softwares can be found on the SiFive Website.
https://www.sifive.com/boards
The pre-built tools have been carefully packaged to support both RISCV 32bit & 64bit ISAs and
work on Linux, macOS, and Windows hosts.
Download the toolchain your platform, and unpack it to your desired location. Then, use the
RISCV PATH and RISCV OPENOCD PATH variables when using the tools. For example,
> cp openocd-<date>-<platform>.tar.gz /my/desired/location/
> cp riscv64-unknown-elf-gcc-<date>-<platform>.tar.gz /my/desired/location
> cd /my/desired/location
> tar -xvf openocd-<date>-<platform>.tar.gz
> tar -xvf riscv64-unknown-elf-gcc-<date>-<platform>.tar.gz
> export RISCV_OPENOCD_PATH=/my/desired/location/openocd
> export RISCV_PATH=/my/desired/location/riscv64-unknown-elf-gcc-<date>-<version>
6.3.2Cloning the Repository
The Freedom-E-SDK repository can be cloned by running the following commands:
> git clone --recursive https://github.com/sifive/freedom-e-sdk.git
> cd freedom-e-sdk
The recursive option is required to clone the git submodules included in the repository. If at first
you omit the recursive option, you can achieve the same effect by updating submodules using the
command:
The Freedom Metal Compatibility Library layer uses, the board support package files, to provide
the hardware abstraction layer. These bsp files can be found under the bsp folder in Freedom-ESDK and are encapsulated entirely within each target directory. The supported targets are:
SiFive Freedom E310 Arty
• freedom-e310-arty
SiFive CoreIP Arty FPGA Evaluation targets
• coreip-eXX-arty
• coreip-sXX-arty
For example, the board support files may consist of the following:
***design.dts***
The DeviceTree description of the target. This file is used to parameterize the Freedom Metal
library to the target device. It is included as reference so that users of Freedom Metal are aware
of what features and peripherals are available on the target.
***metal.h***
The Freedom Metal machine header which is used internally to Freedom Metal to instantiate
structures to support the target device.
***metal.lds***
The linker script for the target device.
openocd.cfg (for development board and FPGA targets)
Used to configure OpenOCD for flashing and debugging the target device.
***settings.mk***
Used to set march and mabi arguments to the RISC-V GNU Toolchain.
6.5Example Programs
Some example programs can be found under software:
***hello***
18SiFive Core IP FPGA Eval Kit User Guide v3p0
Prints ”Hello, World!” to stdout, if a serial device is present on the target.
***return-pass***
Returns status code 0 indicating program success.
***return-fail***
Returns status code 1 indicating program failure.
***example-itim****
Demonstrates how to statically link application code into the Instruction Tightly Integrated Memory
(ITIM) if an ITIM is present on the target.
***software-interrupt***
Demonstrates how to register a handler for and trigger a software interrupt
***timer-interrupt***
Demonstrates how to register a handler for and trigger a timer interrupt
***local-interrupt***
Demonstrates how to register a handler for and trigger a local interrupt
***example-pmp***
Demonstrates how to configure a Physical Memory Protection (PMP) region
6.6Using the Freedom E SDK
6.6.1Building an Example
To compile a bare-metal RISC-V program:
make BSP=metal PROGRAM=timer-interrupt TARGET=coreip-s51-arty software
The square brackets in the above command indicate optional parameters for the Make invocation.
6.6.2Uploading to the Target Board
make BSP=metal [PROGRAM=hello] [TARGET=coreip-s51-arty] upload
make BSP=metal [PROGRAM=hello] [TARGET=coreip-s51-arty] debug
6.6.4Cleaning a Target Program Build Directory
make BSP=metal [PROGRAM=hello] [TARGET=coreip-s51-arty] clean
6.6.5Create a Standalone Project
You can export a program to a standalone project directory using the standalone target. The
resulting project will be locked to a specific TARGET.
STANDALONE DEST is a required argument to provide the desired project location.
make standalone BSP=metal [PROGRAM=hello] [TARGET=coreip-s51-arty]
STANDALONE_DEST=/path/to/desired/location
Once the standalone project is created, it can be compiled simply by typing make.
cd /path/to/desired/location standalone
make
Run make help for more commands.
20SiFive Core IP FPGA Eval Kit User Guide v3p0
Chapter 7
E2 Core IP FPGA Eval Kit MCS Image
Contents
Figure 7.1 shows a block diagram of the E2 Core IP FPGA Eval Kit.
The evaluation kit includes an evaluation Core IP along with additional peripherals and I/Os to
allow software prototyping.
7.1Core IP FPGA Eval Kit Memory Map
The FPGA design on the Core IP FPGA Eval Kit has an evaluation version of the SiFive E2
Core IP, as well as peripheral devices which are not included with the Core IP deliverable. These
devices allow you to perform basic I/O to prototype and benchmark some basic applications.
Please refer to the Device Tree file, (.dts) for details of the Memory Map.
7.2Core IP FPGA Eval Kit Clock and Reset
The Core IP FPGA Eval Kit has a 100MHz input to the FPGA. This is used to derive the Core
IP’s io coreClock at 65 MHz, and the clock (peripheral clock) at 32.5 MHz. The io rtcToggle is
driven at approximately 32 kHz.
The system reset driven by the Reset Button on the evaluation board is combined with the external
debugger’s SRST n pin as a full system reset for the Core IP FPGA Eval Kit . This is combined with
the io ndreset to drive the reset input to the Core IP.
The reset vector is set with Switch 0. Leave the switch in the “Off” position to execute from SPI
Flash.
7.3Core IP FPGA Eval Kit Pinout
The peripherals perform I/O functionalities and are also used to demonstrate the use of Global
Interrupts. The peripheral devices are connected to hardware on the Arty development board
as described in Table 7.1. Some inputs are wired directly as Global Interrupts, while others go
through the GPIO peripheral.
In addition, some board I/Os are configured as Local Interrupt sources. The mapping between
hardware on the Core IP FPGA Eval Kit and Local Interrupt sources are provided in Table 7.2
21
22SiFive Core IP FPGA Eval Kit User Guide v3p0
Figure 7.1: E2 Core IP FPGA Eval Kit Block Diagram
Figure 8.1 shows a block diagram of the E3 / S5 Core IP FPGA Eval Kit.
The evaluation kit includes an evaluation Core IP along with additional peripherals and I/Os to
allow software prototyping.
8.1Core IP FPGA Eval Kit Memory Map
The FPGA design on the Core IP FPGA Eval Kit has an evaluation version of the SiFive E3 / S5
Core IP, as well as peripheral devices which are not included with the Core IP deliverable. These
devices allow you to perform basic I/O to prototype and benchmark some basic applications.
Please refer to the Device Tree file, (.dts) for details of the Memory Map.
8.2Core IP FPGA Eval Kit Clock and Reset
The Core IP FPGA Eval Kit has a 100MHz input to the FPGA. This is used to derive the Core
IP’s io coreClock at 65 MHz, and the clock (peripheral clock) at 32.5 MHz. The io rtcToggle is
driven at approximately 32 kHz.
The system reset driven by the Reset Button on the evaluation board is combined with the external
debugger’s SRST n pin as a full system reset for the Core IP FPGA Eval Kit . This is combined with
the io ndreset to drive the reset input to the Core IP.
The reset vector is set with Switch 0. Leave the switch in the “Off” position to execute from SPI
Flash.
8.3Core IP FPGA Eval Kit Pinout
The peripherals perform I/O functionalities and are also used to demonstrate the use of Global
Interrupts. The peripheral devices are connected to hardware on the Arty development board
as described in Table 8.1. Some inputs are wired directly as Global Interrupts, while others go
through the GPIO peripheral.
In addition, some board I/Os are configured as Local Interrupt sources. The mapping between
hardware on the Core IP FPGA Eval Kit and Local Interrupt sources are provided in Table 8.2
Figure 9.1 shows a block diagram of the E7 / S7 Core IP FPGA Eval Kit. The evaluation kit includes
an evaluation Core IP along with additional peripherals and I/Os to allow software prototyping.
9.1Core IP FPGA Eval Kit Memory Map
The FPGA design on the Core IP FPGA Eval Kit has an evaluation version of the SiFive E7 / S7
Core IP, as well as peripheral devices which are not included with the Core IP deliverable. These
devices allow you to perform basic I/O to prototype and benchmark some basic applications.
Please refer to the Device Tree file, (.dts) for details of the Memory Map.
9.2Core IP FPGA Eval Kit Clock and Reset
The Core IP FPGA Eval Kit has a 100MHz input to the FPGA. This is used to derive the Core IP’s
io coreClock at 32.5 MHz, and the clock (peripheral clock) at 32.5 MHz. The io rtcToggle is
driven at approximately 32 kHz.
The system reset driven by the Reset Button on the evaluation board is combined with the external
debugger’s SRST n pin as a full system reset for the Core IP FPGA Eval Kit˙This is combined with
the io ndreset to drive the reset input to the Core IP.
9.3Core IP FPGA Eval Kit Pinout
The peripherals perform I/O functionalities and are also used to demonstrate the use of Global
Interrupts. The peripheral devices are connected to hardware on the Arty development board
as described in Table 9.1. Some inputs are wired directly as Global Interrupts, while others go
through the GPIO peripheral.
In addition, some board I/Os are configured as Local Interrupt sources. The mapping between
hardware on the Core IP FPGA Eval Kit and Local Interrupt sources are provided in Table 9.2