Test DPI Examples #199
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test DPI Examples | |
on: | |
push: | |
paths-ignore: | |
- README.md | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
renode_url_linux: | |
description: URL to a Linux portable Renode package | |
required: true | |
type: string | |
renode_url_windows: | |
description: URL to a Windows Renode package | |
required: true | |
type: string | |
verilator_git_ref: | |
description: Reference to a Verilator commit | |
required: true | |
type: string | |
jobs: | |
run-prebuilt-sample: | |
name: "Run prebuilt sample" | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- runner: ubuntu-20.04 | |
renode_url: ${{ inputs.renode_url_linux || 'https://builds.renode.io/renode-latest.linux-portable.tar.gz' }} | |
- runner: windows-latest | |
renode_url: ${{ inputs.renode_url_windows || 'https://builds.renode.io/renode-latest.zip' }} | |
runs-on: ${{ matrix.config.runner }} | |
defaults: | |
run: | |
shell: bash | |
env: | |
RENODE_ARGS: -e "emulation RunFor \"20\"; quit" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download Renode | |
run: curl -sSLO ${{ matrix.config.renode_url }} | |
- name: Unpack Renode for Linux | |
if: ${{ runner.os != 'Windows' }} | |
run: | | |
mkdir renode | |
tar xf renode*.tar.gz --strip-components 1 -C renode | |
- name: Unpack Renode for Windows | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
unzip renode*.zip | |
rm renode*.zip | |
mv renode_* renode | |
- name: Run Renode on Linux | |
if: ${{ runner.os != 'Windows' }} | |
run: renode/renode ${{ env.RENODE_ARGS }} samples/axi_fastvdma_prebuilt/platform.resc | |
- name: Run Renode on Windows | |
if: ${{ runner.os == 'Windows' }} | |
shell: cmd | |
run: renode\bin\Renode.exe ${{ env.RENODE_ARGS }} samples\axi_fastvdma_prebuilt\platform.resc | |
build-verilator-linux: | |
uses: ./.github/workflows/build-verilator.yml | |
with: | |
runner: ubuntu-20.04 | |
verilator_git_ref: ${{ inputs.verilator_git_ref || 'v5.018' }} | |
build-verilator-windows: | |
uses: ./.github/workflows/build-verilator.yml | |
with: | |
runner: windows-latest | |
verilator_git_ref: ${{ inputs.verilator_git_ref || 'v5.018' }} | |
build-fastvdma-sample: | |
name: Build FastVDMA sample | |
strategy: | |
matrix: | |
bus_width: [8, 16, 32, 64] | |
runs-on: ubuntu-latest | |
env: | |
FASTVDMA_GIT_REF: 0172db9fb0e3873af418941ecc0151241666350a | |
FASTVDMA_DIR: ${{ github.workspace }}/fastvdma | |
SAMPLE_DIR: ${{ github.workspace }}/samples/axi_fastvdma | |
CUSTOM_SAMPLE_NAME: axi_fastvdma-${{ matrix.bus_width }} | |
CUSTOM_SAMPLE_DIR: ${{ github.workspace }}/samples/axi_fastvdma-${{ matrix.bus_width }} | |
steps: | |
- name: Checkout the renode-dpi-examples repository | |
uses: actions/checkout@v3 | |
- name: Clone the FastVDMA repository | |
uses: actions/checkout@v3 | |
with: | |
repository: antmicro/fastvdma | |
ref: ${{ env.FASTVDMA_GIT_REF }} | |
path: fastvdma | |
- name: Add the Scala SBT packages repository | |
run: | | |
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list | |
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list | |
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add | |
- name: Install dependencies | |
run: > | |
sudo apt update | |
&& sudo apt-get install -y --no-install-recommends | |
default-jdk | |
default-jre | |
sbt | |
- name: Build HDL | |
run: | | |
cp -R ${{ env.SAMPLE_DIR }} ${{ env.CUSTOM_SAMPLE_DIR}} | |
CONFIG_FILE=${{ env.CUSTOM_SAMPLE_DIR }}/config_${{ matrix.bus_width }}.json | |
jq --argjson width ${{ matrix.bus_width }} \ | |
'.readDataWidth = $width | .writeDataWidth = $width' \ | |
${{ env.SAMPLE_DIR }}/config_base.json > $CONFIG_FILE | |
cd ${{ env.FASTVDMA_DIR }} | |
make verilog CONFIG_FILE=$CONFIG_FILE | |
cp DMATop*.v ${{ env.CUSTOM_SAMPLE_DIR }}/DMATop.v | |
sed -i 's/DMATopAXI_AXIL_AXI/DMATop/' ${{ env.CUSTOM_SAMPLE_DIR }}/DMATop.v | |
- name: Clean up the custom sample dir | |
run: | | |
cd ${{ env.CUSTOM_SAMPLE_DIR }} | |
rm *_linux.* | |
rm config_base.json | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.CUSTOM_SAMPLE_NAME }} | |
path: ${{ env.CUSTOM_SAMPLE_DIR }} | |
run-sample: | |
name: Run sample | |
needs: [build-fastvdma-sample, build-verilator-linux, build-verilator-windows] | |
strategy: | |
fail-fast: false | |
matrix: | |
sample: | |
- directory_name: axi_ram | |
- directory_name: axi_ram | |
custom_cmake_args: -DAXI_DATA_WIDTH=64 | |
custom_robot_args: --variable=BUS_WIDTH:64 | |
- directory_name: axi_ram | |
custom_cmake_args: -DAXI_DATA_WIDTH=32 | |
custom_robot_args: --variable=BUS_WIDTH:32 | |
- directory_name: axi_ram | |
custom_cmake_args: -DAXI_DATA_WIDTH=16 | |
custom_robot_args: --variable=BUS_WIDTH:16 | |
- directory_name: axi_ram | |
custom_cmake_args: -DAXI_DATA_WIDTH=8 | |
custom_robot_args: --variable=BUS_WIDTH:8 | |
- directory_name: axi_fastvdma | |
- directory_name: axi_fastvdma-64 | |
custom_artifact: true | |
custom_cmake_args: -DAXI_DATA_WIDTH=64 | |
custom_robot_args: --variable=BUS_WIDTH:64 | |
- directory_name: axi_fastvdma-32 | |
custom_artifact: true | |
custom_cmake_args: -DAXI_DATA_WIDTH=32 | |
custom_robot_args: --variable=BUS_WIDTH:32 | |
- directory_name: axi_fastvdma-16 | |
custom_artifact: true | |
custom_cmake_args: -DAXI_DATA_WIDTH=16 | |
custom_robot_args: --variable=BUS_WIDTH:16 | |
- directory_name: axi_fastvdma-8 | |
custom_artifact: true | |
custom_cmake_args: -DAXI_DATA_WIDTH=8 | |
custom_robot_args: --variable=BUS_WIDTH:8 | |
- directory_name: apb3_completer_mem | |
- directory_name: apb3_requester_synth | |
- directory_name: apb3_standalone | |
- directory_name: ahb_mem | |
- directory_name: ahb_dma | |
config: | |
- runner: ubuntu-20.04 | |
renode_url: ${{ inputs.renode_url_linux || 'https://builds.renode.io/renode-latest.linux-portable.tar.gz' }} | |
verilator_artifact: ${{ needs.build-verilator-linux.outputs.verilator_artifact }} | |
- runner: windows-latest | |
renode_url: ${{ inputs.renode_url_windows || 'https://builds.renode.io/renode-latest.zip' }} | |
verilator_artifact: ${{ needs.build-verilator-windows.outputs.verilator_artifact }} | |
uses: ./.github/workflows/run-sample.yml | |
with: | |
sample: ${{ matrix.sample.directory_name }} | |
custom_artifact: ${{ matrix.sample.custom_artifact || false }} | |
custom_cmake_args: ${{ matrix.sample.custom_cmake_args || '' }} | |
custom_robot_args: ${{ matrix.sample.custom_robot_args || '' }} | |
runner: ${{ matrix.config.runner }} | |
renode_url: ${{ matrix.config.renode_url }} | |
verilator_artifact: ${{ matrix.config.verilator_artifact }} |