Package c4m-jtag
authorLas Safin <me@las.rs>
Sun, 12 Sep 2021 19:06:04 +0000 (19:06 +0000)
committerLas Safin <me@las.rs>
Sun, 12 Sep 2021 19:06:04 +0000 (19:06 +0000)
flake.lock
flake.nix
nix/bigfloat.nix
nix/c4m-jtag.nix [new file with mode: 0644]
nix/ieee754fpu.nix
nix/modgrammar.nix [new file with mode: 0644]
nix/verilog.nix

index d6bf6a5a04823c31fdfaa2326d7a7120af14cdb8..df14d0ad822d5551e05be6422ad0cc133425d1e3 100644 (file)
@@ -1,5 +1,21 @@
 {
   "nodes": {
+    "c4m-jtag": {
+      "flake": false,
+      "locked": {
+        "lastModified": 1619101523,
+        "narHash": "sha256-y1OY8URcE1lnu5L7IDFcJ8zT8sqlrfMP9VPNmVvACGk=",
+        "ref": "master",
+        "rev": "c2bf4810f9f91ced7fcda777b92b86ab353da288",
+        "revCount": 146,
+        "type": "git",
+        "url": "https://git.libre-soc.org/git/c4m-jtag.git"
+      },
+      "original": {
+        "type": "git",
+        "url": "https://git.libre-soc.org/git/c4m-jtag.git"
+      }
+    },
     "nixpkgs": {
       "locked": {
         "lastModified": 1630612789,
@@ -18,6 +34,7 @@
     },
     "root": {
       "inputs": {
+        "c4m-jtag": "c4m-jtag",
         "nixpkgs": "nixpkgs"
       }
     }
index 75e3ed63aae1d9206e39cdf6277184aac7234fe7..3df85429d6ecc8b346c5dd66793d1de6a7a4a877 100644 (file)
--- a/flake.nix
+++ b/flake.nix
@@ -4,11 +4,11 @@
   description = "FOSS CPU/GPU/VPU/SoC all in one, see https://libre-soc.org/";
 
   inputs.nixpkgs.url = "github:L-as/nixpkgs?ref=alliance"; # for alliance
+  inputs.c4m-jtag.url = "git+https://git.libre-soc.org/git/c4m-jtag.git";
+  inputs.c4m-jtag.flake = false;
 
-  outputs = { self, nixpkgs }:
+  outputs = { self, nixpkgs, c4m-jtag }:
     let
-      version = builtins.substring 0 8 self.lastModifiedDate;
-
       supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
 
       forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
       nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; overlays = [ self.overlay ]; });
     in
     {
-      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-nmutil = pself.callPackage ./nix/nmutil.nix {};
+      overlay = final: prev: {
+        python3Packages = prev.python3Packages.override {
+          overrides = pfinal: pprev: {
+            libresoc-ieee754fpu = pfinal.callPackage ./nix/ieee754fpu.nix {};
+            libresoc-openpower-isa = pfinal.callPackage ./nix/openpower-isa.nix {};
+            c4m-jtag = pfinal.callPackage (import ./nix/c4m-jtag.nix { src = c4m-jtag; version = c4m-jtag.lastModifiedDate; }) {};
+            bigfloat = pfinal.callPackage ./nix/bigfloat.nix {};
+            modgrammar = pfinal.callPackage ./nix/modgrammar.nix {};
+            libresoc-nmutil = pfinal.callPackage ./nix/nmutil.nix {};
           };
         };
 
-        libresoc-verilog = self.callPackage (import ./nix/verilog.nix { inherit version; }) {};
+        libresoc-verilog = final.callPackage (import ./nix/verilog.nix { version = self.lastModifiedDate; }) {};
       };
 
       packages = forAllSystems (system: {
index 1438f519dd919de55c98939f69e4a26e17bf02e6..4355ef04e4774f3cd0a55d4b734a04fa8187747d 100644 (file)
@@ -1,4 +1,4 @@
-{ lib, buildPythonPackage, bigfloat, fetchPypi, gmp, mpfr, six }:
+{ lib, buildPythonPackage, fetchPypi, gmp, mpfr, six }:
 
 buildPythonPackage rec {
   pname = "bigfloat";
diff --git a/nix/c4m-jtag.nix b/nix/c4m-jtag.nix
new file mode 100644 (file)
index 0000000..cf4dcf4
--- /dev/null
@@ -0,0 +1,19 @@
+{ version, src }:
+
+{ lib, python, buildPythonPackage, nmigen-soc, nmigen, modgrammar }:
+
+buildPythonPackage {
+  pname = "libresoc-openpower-isa";
+  inherit version src;
+
+  propagatedBuildInputs = [ nmigen-soc nmigen modgrammar ];
+
+  doCheck = false;
+
+  pythonImportsCheck = [ "c4m.nmigen.jtag.tap" ];
+
+  meta = with lib; {
+    homepage = "https://pypi.org/project/libresoc-openpower-isa/";
+    license = licenses.lgpl3Plus;
+  };
+}
index ac221c935549c4df179bcbc966c93b2867591523..e520437daa4ee849f80aa3b835694a3a4de8c058 100644 (file)
@@ -14,6 +14,12 @@ buildPythonPackage {
 
   doCheck = false;
 
+  prePatch = ''
+    touch ./src/ieee754/part/__init__.py
+  '';
+
+  pythonImportsCheck = [ "ieee754.part" ];
+
   meta = with lib; {
     homepage = "https://pypi.org/project/libresoc-ieee754fpu/";
     license = licenses.lgpl3Plus;
diff --git a/nix/modgrammar.nix b/nix/modgrammar.nix
new file mode 100644 (file)
index 0000000..ce0f348
--- /dev/null
@@ -0,0 +1,20 @@
+{ lib, buildPythonPackage, fetchFromGitHub }:
+
+buildPythonPackage rec {
+  pname = "modgrammar";
+  version = "unstable-2020-09-20";
+
+  src = fetchFromGitHub {
+    owner = "bloerwald";
+    repo = "modgrammar";
+    rev = "d363ad5a86584e560a8b03cbe11c0168d7610691";
+    sha256 = "SO2qjfEVaJfgbA5HLJYwXlaeUzt5EFoljYQ2SsdDCbc=";
+  };
+
+  doCheck = false;
+
+  meta = with lib; {
+    homepage = "https://pypi.org/project/modgrammar/";
+    # license = licenses.bsd; # FIXME: Which BSD?
+  };
+}
index cb6df044788efbae3c918bc48dc74eb1bd18b648..afd884bf6ee16c71c47856893e17211269fc48fb 100644 (file)
@@ -10,7 +10,9 @@ stdenv.mkDerivation {
 
   strictDeps = true;
 
-  nativeBuildInputs = with python3Packages; [ nmigen-soc python libresoc-ieee754fpu libresoc-openpower-isa ];
+  nativeBuildInputs = with python3Packages; [
+    c4m-jtag nmigen-soc python libresoc-ieee754fpu libresoc-openpower-isa
+  ];
 
   configurePhase = "true";