wip
authorLas Safin <me@las.rs>
Sat, 11 Sep 2021 17:07:34 +0000 (17:07 +0000)
committerLas Safin <me@las.rs>
Sat, 11 Sep 2021 17:07:34 +0000 (17:07 +0000)
flake.nix
nix/bigfloat.nix [new file with mode: 0644]
nix/ieee754fpu.nix [new file with mode: 0644]
nix/openpower-isa.nix [new file with mode: 0644]
nix/verilog.nix [new file with mode: 0644]

index 3911dde3b58c7866196d9bf49b2f730f719a2074..5b1e57a5a98451817d28e3e58b2d47d015577b68 100644 (file)
--- a/flake.nix
+++ b/flake.nix
       forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
 
       nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
-
     in
     {
-      overlay = final: prev: {};
+      overlay = self: super: {
+        python3Packages = super.python3Packages.override {
+          overrides = pself: psuper: {
+            libresoc-ieee754fpu = pself.callPackage ./nix/ieee754fpu.nix {};
+            libresoc-openpower-isa = pself.callPackage ./nix/openpower-isa.nix {};
+            bigfloat = pself.callPackage ./nix/bigfloat.nix {};
+          };
+        };
+
+        libresoc-verilog = self.callPackage (import ./nix/verilog.nix { inherit version; }) {};
+      };
+
+      packages = forAllSystems (system: {
+        verilog = nixpkgsFor.${system}.libresoc-verilog;
+      });
+
+      defaultPackage = forAllSystems (system: self.packages.${system}.verilog);
     };
 }
diff --git a/nix/bigfloat.nix b/nix/bigfloat.nix
new file mode 100644 (file)
index 0000000..f7675cf
--- /dev/null
@@ -0,0 +1,20 @@
+{ lib, buildPythonPackage, bigfloat, fetchPypi, gmp, mpfr }:
+
+buildPythonPackage rec {
+  pname = "bigfloat";
+  version = "0.4.0";
+
+  buildInputs = [ gmp mpfr ];
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "WLlr3ocqylmJ0T2C66Os8qoblOIhF91yoWulkRsMDLg=";
+  };
+
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = "https://pypi.org/project/bigfloat/";
+    license = licenses.lgpl3Plus;
+  };
+}
diff --git a/nix/ieee754fpu.nix b/nix/ieee754fpu.nix
new file mode 100644 (file)
index 0000000..3ec8486
--- /dev/null
@@ -0,0 +1,21 @@
+{ lib, buildPythonPackage, bigfloat, fetchgit }:
+
+buildPythonPackage {
+  pname = "libresoc-ieee754fpu";
+  version = "unstable-2021-06-05";
+
+  src = fetchgit {
+    url = "https://git.libre-soc.org/git/ieee754fpu.git";
+    rev = "c62fa3a7ee95832587d7725729dcdb9a002ae015";
+    sha256 = "wbr1vGFzUlUtBT6IcRsykADYeksiVoq/LacU/dbRQ0o=";
+  };
+
+  propagatedBuildInputs = [ bigfloat ];
+
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = "https://pypi.org/project/libresoc-ieee754fpu/";
+    license = licenses.lgpl3Plus;
+  };
+}
diff --git a/nix/openpower-isa.nix b/nix/openpower-isa.nix
new file mode 100644 (file)
index 0000000..67cd877
--- /dev/null
@@ -0,0 +1,19 @@
+{ lib, buildPythonPackage, fetchgit }:
+
+buildPythonPackage {
+  pname = "libresoc-openpower-isa";
+  version = "unstable-2021-09-04";
+
+  src = fetchgit {
+    url = "https://git.libre-soc.org/git/openpower-isa.git";
+    rev = "6e43a194f3d07ed5a8daa297187a32746c4c4d3c";
+    sha256 = "0EekUouTQruTXGO5jlPJtqh0DOudghILy0nca5eaZz8=";
+  };
+
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = "https://pypi.org/project/libresoc-openpower-isa/";
+    license = licenses.lgpl3Plus;
+  };
+}
diff --git a/nix/verilog.nix b/nix/verilog.nix
new file mode 100644 (file)
index 0000000..5575534
--- /dev/null
@@ -0,0 +1,33 @@
+{ version }:
+
+{ stdenv, python3Packages }:
+
+stdenv.mkDerivation {
+  pname = "libresoc.v";
+  inherit version;
+
+  src = ../.;
+
+  strictDeps = true;
+
+  nativeBuildInputs = with python3Packages; [ python libresoc-ieee754fpu libresoc-openpower-isa ];
+
+  configurePhase = "true";
+
+  buildPhase = ''
+    runHook preBuild
+    python3 src/soc/simple/issuer_verilog.py \
+      --debug=jtag --enable-core --enable-pll \
+      --enable-xics --enable-sram4x4kblock --disable-svp64 \
+      libresoc.v
+    runHook postBuild
+  '';
+
+  installPhase = ''
+    runHook preInstall
+    mv libresoc.v $out
+    runHook postInstall
+  '';
+
+  fixupPhase = "true";
+}