Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dpetrisko committed May 11, 2021
0 parents commit fdaa2fc
Show file tree
Hide file tree
Showing 8 changed files with 206 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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 .

100 changes: 100 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

31 changes: 31 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"

WORKDIR /home/build/black-parrot-sim

ENTRYPOINT ["sleep", "inf"]
16 changes: 16 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions rtl
Submodule rtl added at b339f7
1 change: 1 addition & 0 deletions sdk
Submodule sdk added at 965da4

0 comments on commit fdaa2fc

Please sign in to comment.