summaryrefslogtreecommitdiff
path: root/nix/peakrdl
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2024-05-05 18:19:50 -0600
committerAlejandro Soto <alejandro@34project.org>2024-05-05 18:21:57 -0600
commit1ffcdb62cd7e95ccd3f971d0b5cb2e617e1481b2 (patch)
tree1c0f622359012e0790626e83bcca66d498b2b938 /nix/peakrdl
parentca02833f22b08ceeeff501107371aa6667426115 (diff)
nix: patch peakrdl-regblock to silence verilator's MULTIDRIVEN warning
Diffstat (limited to 'nix/peakrdl')
-rw-r--r--nix/peakrdl/0001-Add-verilator-MULTIDRIVEN-hack.patch24
-rw-r--r--nix/peakrdl/peakrdl-regblock.nix42
-rw-r--r--nix/peakrdl/peakrdl.nix31
-rw-r--r--nix/peakrdl/systemrdl-compiler.nix32
4 files changed, 129 insertions, 0 deletions
diff --git a/nix/peakrdl/0001-Add-verilator-MULTIDRIVEN-hack.patch b/nix/peakrdl/0001-Add-verilator-MULTIDRIVEN-hack.patch
new file mode 100644
index 0000000..13bf7c1
--- /dev/null
+++ b/nix/peakrdl/0001-Add-verilator-MULTIDRIVEN-hack.patch
@@ -0,0 +1,24 @@
+From aef302875ec38e6f91e04f9368ba0ed84cc73b69 Mon Sep 17 00:00:00 2001
+From: Alejandro Soto <alejandro@34project.org>
+Date: Sun, 5 May 2024 18:17:10 -0600
+Subject: [PATCH] Add verilator MULTIDRIVEN hack
+
+---
+ src/peakrdl_regblock/module_tmpl.sv | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/peakrdl_regblock/module_tmpl.sv b/src/peakrdl_regblock/module_tmpl.sv
+index bcb8566..92183b5 100644
+--- a/src/peakrdl_regblock/module_tmpl.sv
++++ b/src/peakrdl_regblock/module_tmpl.sv
+@@ -27,6 +27,7 @@ module {{ds.module_name}}
+ {{hwif.port_declaration|indent(8)}}
+ );
+
++ // verilator lint_off MULTIDRIVEN
+ //--------------------------------------------------------------------------
+ // CPU Bus interface logic
+ //--------------------------------------------------------------------------
+--
+2.42.0
+
diff --git a/nix/peakrdl/peakrdl-regblock.nix b/nix/peakrdl/peakrdl-regblock.nix
new file mode 100644
index 0000000..3a3f0f6
--- /dev/null
+++ b/nix/peakrdl/peakrdl-regblock.nix
@@ -0,0 +1,42 @@
+{ buildPythonPackage
+, callPackage
+, fetchPypi
+, jinja2
+, lib
+, setuptools
+, setuptools-scm
+}:
+let
+ pname = "peakrdl-regblock";
+ version = "0.22.0";
+in
+buildPythonPackage {
+ inherit pname version;
+ format = "pyproject";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "sha256-N+YZSuHdSSMCmgko5YZpa7wDj3vMy2J7prPdfjj53GA=";
+ };
+
+ patches = [
+ ./0001-Add-verilator-MULTIDRIVEN-hack.patch
+ ];
+
+ propagatedBuildInputs = [
+ jinja2
+ (callPackage ./systemrdl-compiler.nix { })
+ ];
+
+ propagatedNativeBuildInputs = [
+ setuptools
+ setuptools-scm
+ ];
+
+ meta = {
+ description = "Compile SystemRDL into a SystemVerilog control/status register (CSR) block";
+ changelog = "https://github.com/SystemRDL/${pname}/releases/tag/v${version}";
+ homepage = "https://github.com/SystemRDL/${pname}";
+ license = lib.licenses.gpl3;
+ };
+}
diff --git a/nix/peakrdl/peakrdl.nix b/nix/peakrdl/peakrdl.nix
new file mode 100644
index 0000000..48cf1fa
--- /dev/null
+++ b/nix/peakrdl/peakrdl.nix
@@ -0,0 +1,31 @@
+{ buildPythonPackage
+, fetchPypi
+, lib
+, setuptools
+, setuptools-scm
+}:
+let
+ pname = "peakrdl";
+ version = "1.1.0";
+in
+buildPythonPackage {
+ inherit pname version;
+ format = "pyproject";
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "sha256-ZiqdXOaovFnOymvUQvT76OSwHlP+FLm/fuj5H/bY10w=";
+ };
+
+ propagatedNativeBuildInputs = [
+ setuptools
+ setuptools-scm
+ ];
+
+ meta = {
+ description = "PeakRDL is a free and open-source control & status register (CSR) toolchain";
+ changelog = "https://github.com/SystemRDL/${pname}/releases/tag/v${version}";
+ homepage = "https://github.com/SystemRDL/${pname}";
+ license = lib.licenses.gpl3;
+ };
+}
diff --git a/nix/peakrdl/systemrdl-compiler.nix b/nix/peakrdl/systemrdl-compiler.nix
new file mode 100644
index 0000000..00c92d7
--- /dev/null
+++ b/nix/peakrdl/systemrdl-compiler.nix
@@ -0,0 +1,32 @@
+{ antlr4-python3-runtime
+, buildPythonPackage
+, colorama
+, fetchPypi
+, lib
+, markdown
+}:
+let
+ pname = "systemrdl-compiler";
+ version = "1.27.3";
+in
+buildPythonPackage {
+ inherit pname version;
+
+ src = fetchPypi {
+ inherit pname version;
+ sha256 = "sha256-22g1S/8ZTMcjbtaLrGTFu4GpoXtbp7bzezAHilClOj4=";
+ };
+
+ propagatedBuildInputs = [
+ antlr4-python3-runtime
+ colorama
+ markdown
+ ];
+
+ meta = {
+ description = "Parse and elaborate front-end for SystemRDL 2.0";
+ changelog = "https://github.com/SystemRDL/${pname}/releases/tag/v${version}";
+ homepage = "https://github.com/SystemRDL/${pname}";
+ license = lib.licenses.mit;
+ };
+}