Skip to content

Commit

Permalink
Merge pull request #12 from PyFPGA/add-simulation
Browse files Browse the repository at this point in the history
Add simulation
  • Loading branch information
rodrigomelo9 authored Jan 9, 2025
2 parents 22fcca6 + 49409f3 commit abdc012
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ jobs:
fail-fast: false
matrix:
name:
- synthesis
- langutils
- synthesis
- simulation
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@
* [ghdl-yosys-plugin](https://github.com/ghdl/ghdl-yosys-plugin)
* [yosys-slang](https://github.com/povik/yosys-slang)
* [synlig](https://github.com/chipsalliance/synlig)
* `simulation`: tools for simulation
* [GHDL](https://github.com/ghdl/ghdl)
* [iVerilog](https://github.com/steveicarus/iverilog)
* [Verilator](https://github.com/verilator/verilator)
* [cocotb](https://github.com/cocotb/cocotb)
75 changes: 75 additions & 0 deletions recipes/simulation
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
FROM ubuntu:latest AS build

WORKDIR /root

#
# Dependencies
#

RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
# Common
build-essential \
ca-certificates \
git \
python3 \
zlib1g-dev \
# GHDL
gnat \
# iVerilog & Verilator
autoconf \
bison \
flex \
gperf \
# Verilator
help2man \
libfl2 \
libfl-dev \
zlib1g \
ccache \
mold \
# cocotb
python3-pip \
libpython3-dev \
libgoogle-perftools-dev numactl \
&& apt-get autoclean && apt-get clean && apt-get -y autoremove \
&& rm -rf /var/lib/apt/lists/*

#
# GHDL
#

RUN git clone --depth 1 https://github.com/ghdl/ghdl \
&& mkdir ghdl/build && cd ghdl/build \
&& ../configure --prefix=/usr/local \
&& make -j$(nproc) && make install

#
# iVerilog
#

RUN git clone --depth 1 https://github.com/steveicarus/iverilog \
&& cd iverilog && autoconf && ./configure \
&& make -j$(nproc) && make install

#
# Verilator
#

RUN git clone --depth 1 https://github.com/verilator/verilator \
&& cd verilator && autoconf && ./configure \
&& make -j$(nproc) && make install

#
# cocotb
#

RUN pip install cocotb --break-system-packages

#
# Clean-up
#

###############################################################################

# FROM ubuntu:latest
10 changes: 10 additions & 0 deletions tests/simulation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

DOCKER="docker run --rm -v $HOME:$HOME -w $PWD --user $(id -u):$(id -g) ghcr.io/pyfpga/simulation"

$DOCKER ghdl --version
$DOCKER iverilog -V | grep Icarus
$DOCKER verilator --version
$DOCKER cocotb-config --version

0 comments on commit abdc012

Please sign in to comment.