From fdaa2fc07b3d2e48fa145e0f5588314d4e4bdd30 Mon Sep 17 00:00:00 2001 From: Dan Petrisko Date: Mon, 10 May 2021 15:44:35 -0700 Subject: [PATCH] Initial commit --- .gitmodules | 6 +++ LICENSE | 24 +++++++++ Makefile | 27 ++++++++++ README.md | 100 ++++++++++++++++++++++++++++++++++++++ docker/Dockerfile | 31 ++++++++++++ docker/docker-compose.yml | 16 ++++++ rtl | 1 + sdk | 1 + 8 files changed, 206 insertions(+) create mode 100644 .gitmodules create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yml create mode 160000 rtl create mode 160000 sdk diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..16b6bd9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "rtl"] + path = rtl + url = https://github.com/black-parrot/black-parrot/ +[submodule "sdk"] + path = sdk + url = https://github.com/black-parrot-sdk/black-parrot-sdk diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2e256a9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2019, University of Washington +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the University of Washington nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..94ec2ca --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ +TOP ?= $(shell git rev-parse --show-toplevel) + +export BP_SDK_DIR := $(TOP)/sdk +export BP_RTL_DIR := $(TOP)/rtl + +.PHONY: prep prep_bsg bleach_all + +checkout: + cd $(TOP); git submodule update --init --recursive --checkout $(BP_RTL_DIR) + cd $(TOP); git submodule update --init --recursive --checkout $(BP_SDK_DIR) + +prep_lite: checkout + $(MAKE) -C $(BP_RTL_DIR) tools_lite + $(MAKE) -C $(BP_SDK_DIR) sdk_lite + +prep: prep_lite + $(MAKE) -C $(BP_RTL_DIR) tools + $(MAKE) -C $(BP_SDK_DIR) prog + +prep_bsg: prep + $(MAKE) -C $(BP_RTL_DIR) tools_bsg + +## This target just wipes the whole repo clean. +# Use with caution. +bleach_all: + cd $(TOP); git clean -fdx; git submodule deinit -f . + diff --git a/README.md b/README.md new file mode 100644 index 0000000..df3cf59 --- /dev/null +++ b/README.md @@ -0,0 +1,100 @@ +# BlackParrot Simulation Environment + +This repository is the main development meta-repository of the BlackParrot processor +[BlackParrot](https://www.github.com/black-parrot/black-parrot). It should track close to the +bleeding edge of the BlackParrot RTL and BlackParrot SDK repos. Because this is a low-level +simulation environment, there's very little else in this repo. + +## Getting Started +### Tire Kick +Users who just want to test their setup and run a minimal BlackParrot test should run the following: + + # Clone the latest repo + git clone https://github.com/black-parrot/black-parrot-sim.git + cd black-parrot-sim + + # Install a minimal set of tools and libraries + # For faster builds, make prep_lite -j is parallelizable! + make prep_lite + + # From here, most operations are handled from within the black-parrot repo + cd rtl + + # Running your first test + make -C bp_top/syn tire_kick + +This should output (roughly) + + Hello world! + [CORE0 FSH] PASS + [CORE0 STATS] + clk : 220 + instr : 66 + mIPC : 300 + All cores finished! Terminating... + +# Getting started (Full) +## Prerequisites +### Centos (7 or 8) + + yum install autoconf automake libmpc-devel mpfr-devel gmp-devel gawk bison flex texinfo patchutils gcc gcc-c++ zlib-devel expat-devel dtc gtkwave vim-common virtualenv + +CentOS 7 requires a more modern gcc to build Linux. If you receive an error such as "These critical programs are missing or too old: make" try + + scl enable devtoolset-8 bash + +### Ubuntu (18.04 or 20.04) + + sudo apt-get install autoconf automake autotools-dev cmake curl libmpc-dev libmpfr-dev libgmp-dev gawk build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev wget byacc device-tree-compiler python gtkwave vim-common virtualenv python-yaml + +cmake 3.14+ is required. This must be manually upgraded even on newer versions of Ubuntu. + +BlackParrot has been tested extensively on CentOS 7. We have many users who have used Ubuntu for +development. If not on these versions of these OSes, we suggest using a +Docker image. + +Ubuntu on Windows WSL 2.0 seems to work for most things, but you may encounter errors with more complex operations. For instance, compiling Linux is known not to work in this environment. This is considered an experimental build. + +## Build the toolchains + # Clone the latest repo + git clone https://github.com/black-parrot-sim/black-parrot-sim.git + cd black-parrot-sim + + # make prep is a meta-target which will build the RISC-V toolchains, programs and microcode + # needed for a full BlackParrot evaluation setup. + # Users who are changing code can use the 'libs' 'prog' or 'ucode' targets as appropriate + # For faster builds, make prep -j is parallelizable! + # BSG users should instead use 'make prep_bsg', which sets up the bsg CAD environment + make prep + + # From here, most operations are handled from within the black-parrot repo + cd rtl + + # Running your first test + make -C bp_top/syn build.sc sim.sc COSIM_P=1 + +## Continuing Onward +Additional documentation is available in the main BlackParrot repo, in the Simulation Guide: +[BlackParrot](https://github.com/black-parrot/black-parrot) + +### Docker build +For a painless Ubuntu build, download and install [Docker Desktop](https://www.docker.com/products/docker-desktop) then run the following: + + git clone https://github.com/black-parrot/black-parrot-sim.git + cd black-parrot-sim + docker-compose build --build-arg USER_ID=$(id -u) --build-arg GROUP_ID=$(id -g) bp + docker-compose up -d + docker-compose exec bp su - build + +Then follow the [Tire Kick](#-tire-kick) directions above starting with "cd black-parrot-sim" or the "Full" directions below. The repo directory will be mounted inside the container. + +### Getting Started for Real +Users who want to fully evaluate BlackParrot, or develop hardware or software using it should follow [Getting Started (Full)](docs/getting_started.md). + +Although the information in collected in this repo, it's recommended to look at these [Slides](https://fosdem.org/2020/schedule/event/riscv_blackparrot/attachments/slides/3718/export/events/attachments/riscv_blackparrot/slides/3718/Talk_Slides) for a quick overview of BlackParrot. + +# BlackParrot Repository Overview +- **rtl/** contains the BlackParrot RTL and basic simulation environment +- **sdk/** contains the BlackParrot Software Development Kit. More details can be found in the SDK + README.md + diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..2c6115c --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,31 @@ +# Dockerfile References: https://docs.docker.com/engine/reference/builder/ + +FROM ubuntu:18.04 + +RUN apt-get update + +# This deals with tzdata installation issues, but may not configure your VM timezone correctly. +# There are some potential work-arounds if that turns out to be a problem, but they didn't seem +# to be worth the trouble +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get install -y apt-utils tzdata git vim gettext-base \ + bash autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk \ + build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev \ + wget byacc device-tree-compiler python gtkwave python-yaml pkg-config swig python3-dev + +RUN apt-get clean + +ARG USER_ID +ARG GROUP_ID + +# Only create the group if it doesn't exist +RUN getent group $GROUP_ID || groupadd --gid $GROUP_ID build + +# Use --no-log-init to deal with large userids creating giant log files +RUN useradd --no-log-init --uid $USER_ID --gid $GROUP_ID --shell /bin/bash --create-home build + +LABEL maintainer="Mike Patnode " + +WORKDIR /home/build/black-parrot-sim + +ENTRYPOINT ["sleep", "inf"] diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..7973db1 --- /dev/null +++ b/docker/docker-compose.yml @@ -0,0 +1,16 @@ +# Docker Compose file Reference (https://docs.docker.com/compose/compose-file/) + +version: '3' + +# Define services +services: + + # App Service + bp: + # Configuration for building the docker image for the service + build: + context: . # Use an image built from the specified dockerfile in the current directory. + dockerfile: Dockerfile + volumes: + - .:/home/build/black-parrot + diff --git a/rtl b/rtl new file mode 160000 index 0000000..b339f7c --- /dev/null +++ b/rtl @@ -0,0 +1 @@ +Subproject commit b339f7c6c3e6627b9e5daa069ecec599c6f5f9fd diff --git a/sdk b/sdk new file mode 160000 index 0000000..965da45 --- /dev/null +++ b/sdk @@ -0,0 +1 @@ +Subproject commit 965da450475f4b632559f330a0c0c735b3d80486