Skip to content

Commit

Permalink
add basic CI
Browse files Browse the repository at this point in the history
  • Loading branch information
vk2seb committed Apr 7, 2024
1 parent 50758c3 commit 6539169
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 4 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: build

on: [push]

jobs:
ubuntu-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: YosysHQ/setup-oss-cad-suite@v3
- run: verilator --version
- run: wget https://vcvrack.com/downloads/Rack-SDK-2.4.1-lin-x64.zip
- run: unzip Rack-SDK*.zip && rm Rack-SDK*.zip
- run: make RACK_DIR=`pwd`/Rack-SDK
- uses: actions/upload-artifact@v4
with:
name: plugin
path: |
plugin.so
plugin.json
macos-build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- run: brew install verilator
- run: verilator --version
- run: wget https://vcvrack.com/downloads/Rack-SDK-2.4.1-mac-x64.zip
- run: unzip Rack-SDK*.zip && rm Rack-SDK*.zip
- run: make RACK_DIR=`pwd`/Rack-SDK
- uses: actions/upload-artifact@v4
with:
name: plugin
path: |
plugin.so
plugin.json
10 changes: 6 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ VERILATED_OBJ=Vcore__ALL.a

# FLAGS will be passed to both the C and C++ compiler
FLAGS += -I$(VERILATOR_ROOT)/include -faligned-new
CFLAGS +=
CXXFLAGS +=

# Careful about linking to shared libraries, since you can't assume much about the user's environment and library search path.
# Static libraries are fine, but they should be added to this plugin's build system.
#LDFLAGS += -L$(VERILATED_PATH) -l:$(VERILATED_OBJ)
OBJECTS += $(VERILATED_PATH)/$(VERILATED_OBJ)

# Add .cpp files to the build
SOURCES += $(wildcard src/*.cpp) $(VERILATOR_ROOT)/include/verilated.cpp
SOURCES += $(wildcard src/*.cpp) \
$(VERILATOR_ROOT)/include/verilated.cpp \
$(VERILATOR_ROOT)/include/verilated_threads.cpp

# Add files to the ZIP package when running `make dist`
# The compiled plugin and "plugin.json" are automatically added.
Expand All @@ -38,3 +37,6 @@ src/eurorack-pmod.cpp: $(VERILATED_PATH)/$(VERILATED_OBJ)

# Include the Rack plugin Makefile framework
include $(RACK_DIR)/plugin.mk

CXXFLAGS := $(filter-out -std=c++11,$(CXXFLAGS))
CXXFLAGS += -std=c++17
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![ci workflow](https://github.com/apfelaudio/verilog-vcvrack/actions/workflows/main.yml/badge.svg)

# Basic example of simulating Verilog inside a VCV Rack plugin.

This plugin simulates the panel layout of the [`eurorack-pmod`](https://github.com/schnommus/eurorack-pmod) FPGA-based module. See [`rtl/core.sv`](rtl/core.sv) for the Verilog source. This example is intentionally kept as simple as possible.
Expand Down Expand Up @@ -30,3 +32,21 @@ This plugin should now be visible on restarting VCV Rack.
# Limitations

At the moment only the audio rate `sample_clk` is injected into the verilog core, I doubt verilator would be fast enough to simulate filters pipelined at the PLL clock (12MHz/24MHz).

# Debugging

Some basic CI for Mac + Linux is in [`.github/workflows/main.yml`](.github/workflows/main.yml), this may be useful to look at if you are having trouble building.

Sometimes it is useful to run VCVRack in development mode so that you get some more detailed logs if a plugin doesn't load correctly:

```bash
$ ./Rack --dev
```

For example, an update to verilator recently added an extra source dependency that was missing, causing an error like this --


```bash
[0.011 info src/plugin.cpp:130 loadPlugin] Loading plugin from /home/seb/Downloads/Rack2Free/plugins/eurorack-pmod-vcvrack
[0.011 warn src/plugin.cpp:196 loadPlugin] Could not load plugin /home/seb/Downloads/Rack2Free/plugins/eurorack-pmod-vcvrack: Failed to load library /home/seb/Downloads/Rack2Free/plugins/eurorack-pmod-vcvrack/plugin.so: /home/seb/Downloads/Rack2Free/plugins/eurorack-pmod-vcvrack/plugin.so: undefined symbol: _ZN12VlThreadPoolC1EP16VerilatedContextj
```

0 comments on commit 6539169

Please sign in to comment.