diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a488765 --- /dev/null +++ b/.github/workflows/main.yml @@ -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-lin-x64 + 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-mac-x64 + path: | + plugin.so + plugin.json diff --git a/Makefile b/Makefile index c6d8486..acf7ecd 100644 --- a/Makefile +++ b/Makefile @@ -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. @@ -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 diff --git a/README.md b/README.md index 8e8f5a4..fa8e165 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 +```