add piston nix pkg for iverilog

This commit is contained in:
Dan Vargas 2022-02-11 10:56:19 -07:00
parent 93cf2319f3
commit 61bac60830
8 changed files with 44 additions and 39 deletions

View file

@ -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;
}

43
runtimes/iverilog.nix Normal file
View file

@ -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";
})
];
}