Skip to content

Commit 2dd2f4a

Browse files
authored
Merge pull request #3 from apfelaudio/seb/ci
ci/make: add basic CI for mac/linux, fix compilation for latest SDK 2.4.1
2 parents 50758c3 + 5684016 commit 2dd2f4a

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

.github/workflows/main.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: build
2+
3+
on: [push]
4+
5+
jobs:
6+
ubuntu-build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: YosysHQ/setup-oss-cad-suite@v3
11+
- run: verilator --version
12+
- run: wget https://vcvrack.com/downloads/Rack-SDK-2.4.1-lin-x64.zip
13+
- run: unzip Rack-SDK*.zip && rm Rack-SDK*.zip
14+
- run: make RACK_DIR=`pwd`/Rack-SDK
15+
- uses: actions/upload-artifact@v4
16+
with:
17+
name: plugin-lin-x64
18+
path: |
19+
plugin.so
20+
plugin.json
21+
22+
macos-build:
23+
runs-on: macos-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- run: brew install verilator
27+
- run: verilator --version
28+
- run: wget https://vcvrack.com/downloads/Rack-SDK-2.4.1-mac-x64.zip
29+
- run: unzip Rack-SDK*.zip && rm Rack-SDK*.zip
30+
- run: make RACK_DIR=`pwd`/Rack-SDK
31+
- uses: actions/upload-artifact@v4
32+
with:
33+
name: plugin-mac-x64
34+
path: |
35+
plugin.so
36+
plugin.json

Makefile

+6-4
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,15 @@ VERILATED_OBJ=Vcore__ALL.a
1010

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

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

2118
# Add .cpp files to the build
22-
SOURCES += $(wildcard src/*.cpp) $(VERILATOR_ROOT)/include/verilated.cpp
19+
SOURCES += $(wildcard src/*.cpp) \
20+
$(VERILATOR_ROOT)/include/verilated.cpp \
21+
$(VERILATOR_ROOT)/include/verilated_threads.cpp
2322

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

3938
# Include the Rack plugin Makefile framework
4039
include $(RACK_DIR)/plugin.mk
40+
41+
CXXFLAGS := $(filter-out -std=c++11,$(CXXFLAGS))
42+
CXXFLAGS += -std=c++17

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![ci workflow](https://github.com/apfelaudio/verilog-vcvrack/actions/workflows/main.yml/badge.svg)
2+
13
# Basic example of simulating Verilog inside a VCV Rack plugin.
24

35
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.
@@ -30,3 +32,21 @@ This plugin should now be visible on restarting VCV Rack.
3032
# Limitations
3133

3234
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).
35+
36+
# Debugging
37+
38+
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.
39+
40+
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:
41+
42+
```bash
43+
$ ./Rack --dev
44+
```
45+
46+
For example, an update to verilator recently added an extra source dependency that was missing, causing an error like this --
47+
48+
49+
```bash
50+
[0.011 info src/plugin.cpp:130 loadPlugin] Loading plugin from /home/seb/Downloads/Rack2Free/plugins/eurorack-pmod-vcvrack
51+
[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
52+
```

0 commit comments

Comments
 (0)