From 61bac60830cd03d657e7bfdfe04302dd525a09da Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Fri, 11 Feb 2022 10:56:19 -0700 Subject: [PATCH] add piston nix pkg for iverilog --- packages/iverilog/11.0.0/build.sh | 17 ---------- packages/iverilog/11.0.0/compile | 4 --- packages/iverilog/11.0.0/environment | 2 -- packages/iverilog/11.0.0/metadata.json | 5 --- packages/iverilog/11.0.0/run | 4 --- packages/iverilog/11.0.0/test.verilog | 7 ----- runtimes/default.nix | 1 + runtimes/iverilog.nix | 43 ++++++++++++++++++++++++++ 8 files changed, 44 insertions(+), 39 deletions(-) delete mode 100755 packages/iverilog/11.0.0/build.sh delete mode 100644 packages/iverilog/11.0.0/compile delete mode 100644 packages/iverilog/11.0.0/environment delete mode 100644 packages/iverilog/11.0.0/metadata.json delete mode 100644 packages/iverilog/11.0.0/run delete mode 100644 packages/iverilog/11.0.0/test.verilog create mode 100644 runtimes/iverilog.nix diff --git a/packages/iverilog/11.0.0/build.sh b/packages/iverilog/11.0.0/build.sh deleted file mode 100755 index befb2fa..0000000 --- a/packages/iverilog/11.0.0/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -PREFIX=$(realpath $(dirname $0)) - -mkdir -p build/iverilog -cd build/iverilog -curl -L https://github.com/steveicarus/iverilog/archive/refs/tags/v11_0.tar.gz -o iverilog.tar.gz -tar xzf iverilog.tar.gz --strip-components=1 - -chmod +x ./autoconf.sh -./autoconf.sh -./configure --prefix="$PREFIX" -make -j$(nproc) -make install -j$(nproc) - -cd ../../ -rm -rf build diff --git a/packages/iverilog/11.0.0/compile b/packages/iverilog/11.0.0/compile deleted file mode 100644 index 56f4b4e..0000000 --- a/packages/iverilog/11.0.0/compile +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -rename 's/$/\.v/' "$@" # Add .v extension -iverilog *.v diff --git a/packages/iverilog/11.0.0/environment b/packages/iverilog/11.0.0/environment deleted file mode 100644 index b482830..0000000 --- a/packages/iverilog/11.0.0/environment +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -export PATH=$PWD/bin:$PATH diff --git a/packages/iverilog/11.0.0/metadata.json b/packages/iverilog/11.0.0/metadata.json deleted file mode 100644 index 5a35bde..0000000 --- a/packages/iverilog/11.0.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "iverilog", - "version": "11.0.0", - "aliases": ["verilog", "vvp"] -} diff --git a/packages/iverilog/11.0.0/run b/packages/iverilog/11.0.0/run deleted file mode 100644 index 39e898c..0000000 --- a/packages/iverilog/11.0.0/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -shift -vvp a.out "$@" diff --git a/packages/iverilog/11.0.0/test.verilog b/packages/iverilog/11.0.0/test.verilog deleted file mode 100644 index 88fcd7a..0000000 --- a/packages/iverilog/11.0.0/test.verilog +++ /dev/null @@ -1,7 +0,0 @@ -module hello; - initial - begin - $display("OK"); - $finish ; - end -endmodule diff --git a/runtimes/default.nix b/runtimes/default.nix index ec6e596..c09b8f5 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -41,4 +41,5 @@ args: { "julia" = import ./julia.nix args; "jelly" = import ./jelly.nix args; "openjdk-java" = import ./openjdk-java.nix args; + "iverilog" = import ./iverilog.nix args; } diff --git a/runtimes/iverilog.nix b/runtimes/iverilog.nix new file mode 100644 index 0000000..9e62d7a --- /dev/null +++ b/runtimes/iverilog.nix @@ -0,0 +1,43 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.verilog; +in piston.mkRuntime { + language = "iverilog"; + version = pkg.version; + + aliases = [ + "verilog" + "vvp" + ]; + + compile = '' + rename 's/$/\.v/' "$@" # Add .v extension + ${pkg}/bin/iverilog *.v + ''; + + run = '' + shift + ${pkg}/bin/vvp a.out "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.verilog" = '' + module ok; + initial + begin + $display("OK"); + $finish ; + end + endmodule + + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.verilog"; + }) + ]; +} \ No newline at end of file