Skip to content

nmoroze/lemoncore

Repository files navigation

Lemoncore 🍋

Build Status

Lemoncore is a simple RISC-V processor core targeting FPGAs. It implements the base RV32I instruction set, along with M-mode from the RISC-V privilege spec.

This repository contains the implementation of Lemoncore itself, along with a simple SoC implementation, automated tests, simulation code, and example software.

Getting Started

The easiest way to get started with Lemoncore is to run the SoC simulation.

The simulation requires installing the following dependencies:

Then, run make sim to run the simulator on the default firmware (sw/hello.c).

See below for more details on using the simulation, as well as instructions for running tests or building the SoC for an Icebreaker FPGA.

Usage

Simulation

Dependencies

Commands

make sim-soc FW=<firmware>

Runs interactive SoC simulation. The simulator displays an ASCII representation of the Icebreaker LEDs, and uses the keyboard for providing button input. Runs sw/hello.c by default, but setting the optional FW variable will cause Make to build sw/<firmware>.c and run that file instead.

You can also run the simulator executable directly. Run make socsim to compile the binary, then ./socsim to run. Run ./socsim --help for more info on command line configuration options.

make sim-core FW=<firmware>

Runs simulation of Lemoncore alone. This provides outputs as a trace of memory reads/writes. The software to run can be selected via FW as in the SoC simulation target.

Tests

Dependencies

Commands

make test

Runs all tests.

make test-core
make test-soc
make test-alu
make test-decoder
make test-ext
make test-regfile

Runs tests for the Lemoncore, SoC, or individual module (alu, decoder, ext, or regfile), respectively.

FPGA

Dependencies

Commands

make

Builds bitstream of SoC targeting the Icebreaker.

make prog FW=<firmware>

Injects compiled sw/<firmware>.c into bitstream, and flashes it onto a connected FPGA using iceprog.

ASIC build

Dependencies

SiliconCompiler:

pip install siliconcompiler

Commands

python lemoncore.py -remote

Builds Lemoncore ASIC using SiliconCompiler's cloud beta server.

Repository Contents

rtl/core/

RTL for Lemoncore CPU.

rtl/soc/

RTL for a simple SoC that incorporates Lemoncore, memory, a GPIO peripheral, and a timer module, targeting the Icebreaker FPGA.

sim/*_tb.cpp

Automated testbenches for Lemoncore, SoC, and individual modules that make up the core.

sim/*_sim.cpp

Simulation harnesses for the SoC and CPU.

sw/

Example software and a simple library that implements a code entry point and functions for interfacing with SoC peripherals.

License

This project is copyright 2020 Noah Moroze, released under the MIT license.

About

Simple RISC-V processor for FPGAs 🍋 🤖

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published