Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 21 additions & 20 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Base image with Miniconda
FROM continuumio/miniconda3:latest
ENV DEBIAN_FRONTEND=noninteractive

# ------------------------------
# Install system packages
# ------------------------------
Expand All @@ -10,81 +9,83 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
git \
curl \
wget \
openssh-server \
openssh-client \
rsync \
less \
vim \
nano \
locales \
build-essential \
ca-certificates \
kmod \
tmux \
unzip \
&& rm -rf /var/lib/apt/lists/*

# Install CPIO to get firemarshal running
RUN sudo apt update
RUN sudo apt install cpio

# Fix locale setup - ensure it's in locale.gen first
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
locale-gen en_US.UTF-8

# Set locale environment variables
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

# Set JVM encoding options to handle Unicode (fixes Shapeless error)
ENV SBT_OPTS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dfile.encoding.pkg=UTF-8"
ENV _JAVA_OPTIONS="-Dfile.encoding=UTF-8"
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8"

# Auto-activate base
RUN conda config --set auto_activate_base true

# Install conda-lock <1.5
RUN conda install -c conda-forge 'conda-lock<1.5' -y

RUN conda install -c conda-forge 'libstdcxx-ng>=12' -y
# Install firtool
RUN conda config --add channels ucb-bar && \
conda config --set channel_priority strict && \
conda install -y firtool

# ------------------------------
# SSH setup
# ------------------------------
RUN mkdir -p /run/sshd && \
ssh-keygen -A && \
echo "Port 22" >> /etc/ssh/sshd_config && \
echo "PasswordAuthentication yes" >> /etc/ssh/sshd_config && \
echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config && \
echo "PermitRootLogin no" >> /etc/ssh/sshd_config
# ------------------------------
# Create a non-root user for VSCode
# ------------------------------
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

RUN groupadd --gid $USER_GID $USERNAME \
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_GID -m $USERNAME \
&& echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# Make /workspace writable
RUN mkdir -p /workspace && chown -R $USERNAME:$USERNAME /workspace

# Make /workspace writable and set up SSH directory
RUN mkdir -p /workspace && chown -R $USERNAME:$USERNAME /workspace && \
mkdir -p /home/$USERNAME/.ssh && chmod 700 /home/$USERNAME/.ssh && \
chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh
USER $USERNAME
WORKDIR /workspace

# ------------------------------
# Clone and build Chipyard (cached)
# ------------------------------
ARG CHIPYARD_REPO=https://github.com/AnshKetchum/chipyard.git
ARG CHIPYARD_BRANCH=main

RUN git clone --branch $CHIPYARD_BRANCH $CHIPYARD_REPO chipyard

WORKDIR /workspace/chipyard

# Hack: for all directories to be trusted
RUN git config --global --add safe.directory '*'

# Ensure encoding environment is set for the build user too
ENV SBT_OPTS="-Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dfile.encoding.pkg=UTF-8"
ENV _JAVA_OPTIONS="-Dfile.encoding=UTF-8"


RUN chmod +x ./build-setup.sh && ./build-setup.sh -s 9 -s 10


# ------------------------------
# Default command
# ------------------------------
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/chipyard-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Chipyard Integration Tests

on:
workflow_dispatch:
pull_request:
branches: [ main ]

jobs:
run-chipyard-benchmarks:
runs-on: ubuntu-latest
timeout-minutes: 180 # adjust if needed
container:
image: eyeamansh/chipyard-dev:latest
options: --user root --network host

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Verify Chipyard Directory Exists
run: |
if [ ! -d "/workspace/chipyard" ]; then
echo "Error: /workspace/chipyard directory not found."
exit 1
fi

- name: Activate Environment
working-directory: /workspace/chipyard
shell: bash
run: |
set -e
source env.sh
echo "Environment activated."

- name: Run DRAMSim2 Baseline Benchmark
working-directory: /workspace/chipyard/sims/verilator
shell: bash
run: |
set -e
echo "Running DRAMSim2 baseline benchmark..."
make run-binary \
CONFIG=RocketConfig \
BINARY=/workspace/chipyard/.conda-env/riscv-tools/riscv64-unknown-elf/share/riscv-tests/benchmarks/memcpy.riscv \
-B | tee run_baseline.log

echo "Checking for success pattern in run_baseline.log..."
grep -q "PASS" run_baseline.log && echo "✅ DRAMSim2 benchmark passed!" || (echo "❌ DRAMSim2 benchmark failed." && exit 1)

- name: Clean Build Directory
working-directory: /workspace/chipyard/sims/verilator
run: |
echo "Cleaning build directory..."
make clean

- name: Run MemorySim Benchmark
working-directory: /workspace/chipyard/sims/verilator
shell: bash
run: |
set -e
echo "Running MemorySim benchmark..."
make run-binary \
CONFIG=MemorySimRocketConfig \
BINARY=/workspace/chipyard/.conda-env/riscv-tools/riscv64-unknown-elf/share/riscv-tests/benchmarks/memcpy.riscv \
-B | tee run_memorysim.log

echo "Checking for success pattern in run_memorysim.log..."
grep -q "PASS" run_memorysim.log && echo "✅ MemorySim benchmark passed!" || (echo "❌ MemorySim benchmark failed." && exit 1)
12 changes: 11 additions & 1 deletion docs/chipyard.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Running Chipyard Benchmarks

## DRAMSim Comparison
## DRAMSim 2 Comparison

To compare output with DRAMSim, go ahead and run the following benchmark to establish a baseline -

Expand All @@ -14,4 +14,14 @@ To run MemorySim, go ahead and run the following benchmark

```bash
make run-binary CONFIG=MemorySimRocketConfig BINARY=/workspace/chipyard/.conda-env/riscv-tools/riscv64-unknown-elf/share/riscv-tests/benchmarks/memcpy.riscv -B | tee run.log
```


### Running the dev container
```bash
docker run -d --privileged --network=host -it --rm --user root \
--memory=32g --memory-swap=64g \
--name chipyard-development-environment \
-v /tmp/.X11-unix:/tmp/.X11-unix \
eyeamansh/chipyard-dev:latest
```
21 changes: 21 additions & 0 deletions flow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -euo pipefail

# Define image and tags
IMAGE_NAME="eyeamansh/chipyard-dev"
GIT_SHA=$(git rev-parse --short HEAD)

echo "[info] Building Docker image for chipyard-dev..."
docker build --network=host -t chipyard-dev -f .devcontainer/Dockerfile .

echo "[info] Tagging image with commit SHA and latest..."
docker tag chipyard-dev "${IMAGE_NAME}:${GIT_SHA}"
docker tag chipyard-dev "${IMAGE_NAME}:latest"

echo "[info] Pushing image to Docker Hub..."
docker push "${IMAGE_NAME}:${GIT_SHA}"
docker push "${IMAGE_NAME}:latest"

echo "[success] Pushed:"
echo " - ${IMAGE_NAME}:${GIT_SHA}"
echo " - ${IMAGE_NAME}:latest"
Loading