1
0
mirror of https://github.com/antonblanchard/chiselwatt.git synced 2026-01-11 23:53:33 +00:00

Merge pull request #21 from antonblanchard/mill

Use mill by default
This commit is contained in:
Anton Blanchard 2020-02-23 08:50:42 +11:00 committed by GitHub
commit 936679ee06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 14 deletions

View File

@ -6,4 +6,4 @@ services: docker
before_install: docker pull verilator/verilator:latest
script:
docker run --rm -t -v `pwd`:/build -w /build --entrypoint /bin/bash verilator/verilator:latest -c "apt update && apt install -y default-jre-headless gnupg python3-pexpect && apt update && echo 'deb https://dl.bintray.com/sbt/debian /' | tee -a /etc/apt/sources.list.d/sbt.list && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 && apt update && apt install -y sbt && make && make check && ./scripts/test_micropython_long.py"
docker run --rm -t -v `pwd`:/build -w /build --entrypoint /bin/bash verilator/verilator:latest -c "apt update && apt install -y default-jre-headless python3-pexpect curl && make && make check && ./scripts/test_micropython_long.py"

View File

@ -7,7 +7,7 @@ verilog_files = Core.v MemoryBlackBox.v
verilator_binary = chiselwatt
$(verilog_files): $(scala_files)
sbt 'runMain CoreObj'
scripts/mill chiselwatt.run
$(verilator_binary): $(verilog_files) chiselwatt.cpp uart.c
# Warnings disabled until we fix the Chisel issues
@ -24,7 +24,7 @@ clean:
@rm -f LoadStoreInsns.hex MemoryBlackBoxInsns.hex
scala_tests: $(verilator_binary)
sbt testOnly
scripts/mill chiselwatt.test
tests = $(sort $(patsubst tests/%.out,%,$(wildcard tests/*.out)))

View File

@ -4,16 +4,6 @@ A tiny POWER Open ISA soft processor written in Chisel.
## Simulation using verilator
* Chisel uses `sbt` (the scala build tool), but unfortunately most of the
distros package an ancient version. On Fedora you can install an upstream
version using:
```sh
$ sudo dnf remove sbt
$ sudo curl https://bintray.com/sbt/rpm/rpm | sudo tee /etc/yum.repos.d/bintray-sbt-rpm.repo
$ sudo dnf --enablerepo=bintray--sbt-rpm install sbt
```
* Chiselwatt uses `verilator` for simulation. Either install this from your
distro or build it. On Fedora you can install the distro version using:

View File

@ -47,5 +47,5 @@ trait HasMacroParadise extends ScalaModule {
object chiselwatt extends CrossSbtModule with HasChisel3 with HasChiselTests with HasXsource211 with HasMacroParadise {
override def millSourcePath = super.millSourcePath
def crossScalaVersion = "2.12.10"
def mainClass = Some("CoreObj")
}

48
scripts/mill Executable file
View File

@ -0,0 +1,48 @@
#!/usr/bin/env sh
# This is a wrapper script, that automatically download mill from GitHub release pages
# You can give the required mill version with MILL_VERSION env variable
# If no version is given, it falls back to the value of DEFAULT_MILL_VERSION
DEFAULT_MILL_VERSION=0.6.0
set -e
if [ -z "$MILL_VERSION" ] ; then
if [ -f ".mill-version" ] ; then
MILL_VERSION="$(head -n 1 .mill-version 2> /dev/null)"
elif [ -f "mill" ] && [ "$BASH_SOURCE" != "mill" ] ; then
MILL_VERSION=$(grep -F "DEFAULT_MILL_VERSION=" "mill" | head -n 1 | cut -d= -f2)
else
MILL_VERSION=$DEFAULT_MILL_VERSION
fi
fi
if [ "x${XDG_CACHE_HOME}" != "x" ] ; then
MILL_DOWNLOAD_PATH="${XDG_CACHE_HOME}/mill/download"
else
MILL_DOWNLOAD_PATH="${HOME}/.cache/mill/download"
fi
MILL_EXEC_PATH="${MILL_DOWNLOAD_PATH}/${MILL_VERSION}"
version_remainder="$MILL_VERSION"
MILL_MAJOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
MILL_MINOR_VERSION="${version_remainder%%.*}"; version_remainder="${version_remainder#*.}"
if [ ! -x "$MILL_EXEC_PATH" ] ; then
mkdir -p $MILL_DOWNLOAD_PATH
if [ "$MILL_MAJOR_VERSION" -gt 0 ] || [ "$MILL_MINOR_VERSION" -ge 5 ] ; then
ASSEMBLY="-assembly"
fi
DOWNLOAD_FILE=$MILL_EXEC_PATH-tmp-download
MILL_DOWNLOAD_URL="https://github.com/lihaoyi/mill/releases/download/${MILL_VERSION%%-*}/$MILL_VERSION${ASSEMBLY}"
curl --fail -L -o "$DOWNLOAD_FILE" "$MILL_DOWNLOAD_URL"
chmod +x "$DOWNLOAD_FILE"
mv "$DOWNLOAD_FILE" "$MILL_EXEC_PATH"
unset DOWNLOAD_FILE
unset MILL_DOWNLOAD_URL
fi
unset MILL_DOWNLOAD_PATH
unset MILL_VERSION
exec $MILL_EXEC_PATH "$@"