GNU bug report logs - #60429
[PATCH 0/5] gnu: yosys: Update to 0.24.

Previous Next

Package: guix-patches;

Reported by: Simon South <simon <at> simonsouth.net>

Date: Fri, 30 Dec 2022 15:59:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 60429 in the body.
You can then email your comments to 60429 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 30 Dec 2022 15:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon South <simon <at> simonsouth.net>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 30 Dec 2022 15:59:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/5] gnu: yosys: Update to 0.24.
Date: Fri, 30 Dec 2022 10:58:32 -0500
Here's a patch series that aims to improve the package for Yosys, a tool for
synthesizing Verilog RTL designs, by

- Updating the source-repository and home-page URLs to their current location;

- Updating the package definition to the modern style, using gexps and
  search-input-file;

- Having Yosys use the "abc" executable from Guix's package rather than
  creating and installing a duplicate copy;

- Explicitly propagating packages with executables Yosys invokes at runtime
  rather than embedding store references in Yosys' code; and

- Updating Yosys to version 0.24.

I've tested building the package and its dependencies on x86-64 and AArch64
and everything seems okay[0].  Again, arachne-pnr fails to build in any case
and will need separate attention.

[0] Yosys' README.md file includes sample sessions useful for testing,
    particularly whether external tools can be invoked via the "show" and
    "abc" commands:

    https://github.com/YosysHQ/yosys/blob/3ebc50d/README.md#getting-started

    The files "fiedler-cooley.v" and "mycells.lib" are present in the source
    tree.

--
Simon South
simon <at> simonsouth.net


Simon South (5):
  gnu: yosys: Update source and home-page URLs.
  gnu: yosys: Use new package style.
  gnu: yosys: Use external abc.
  gnu: yosys: Propagate external dependencies.
  gnu: yosys: Update to 0.24.

 gnu/packages/fpga.scm | 120 ++++++++++++++++--------------------------
 1 file changed, 45 insertions(+), 75 deletions(-)


base-commit: 01762b7171f9afaf7ffa364f7926461bdebc903f
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 30 Dec 2022 16:01:02 GMT) Full text and rfc822 format available.

Message #8 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH 1/5] gnu: yosys: Update source and home-page URLs.
Date: Fri, 30 Dec 2022 11:00:45 -0500
* gnu/packages/fpga.scm (yosys)[source]: Update source-repository URL.
[home-page]: Update URL.
---
 gnu/packages/fpga.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index acce5f8f82..45aadf8ea4 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -141,7 +141,7 @@ (define-public yosys
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                    (url "https://github.com/cliffordwolf/yosys")
+                    (url "https://github.com/YosysHQ/yosys")
                     (commit (string-append "yosys-" version))
                     (recursive? #t))) ; for the ‘iverilog’ submodule
               (sha256
@@ -223,7 +223,7 @@ (define-public yosys
            abc))
     (propagated-inputs
      (list z3)) ; should be in path for yosys-smtbmc
-    (home-page "http://www.clifford.at/yosys/")
+    (home-page "https://yosyshq.net/yosys/")
     (synopsis "FPGA Verilog RTL synthesizer")
     (description "Yosys synthesizes Verilog-2005.")
     (license license:isc)))
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 30 Dec 2022 16:02:02 GMT) Full text and rfc822 format available.

Message #11 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH 3/5] gnu: yosys: Use external abc.
Date: Fri, 30 Dec 2022 11:00:47 -0500
* gnu/packages/fpga.scm (yosys)[source]: Remove snippet and associated
"modules" field.
[arguments]: Replace "prepare-abc" phase with "use-external-abc", which
configures the package's build system to use the system's "abc" executable
instead of creating a duplicate; add "add-symbolic-link" phase to preserve
availability of "yosys-abc" command.
[inputs]: Move abc from here...
[propagated-inputs]: ...to here, to ensure its availability at runtime.
---
 gnu/packages/fpga.scm | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 479ca3b061..8effebd921 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -147,12 +147,7 @@ (define-public yosys
               (sha256
                 (base32
                    "0lb9r055h8y1vj2z8gm4ip0v06j5mk7f9zx9gi67kkqb7g4rhjli"))
-              (file-name (git-file-name name version))
-              (modules '((guix build utils)))
-              (snippet
-               #~(begin
-                   (substitute* "Makefile"
-                     (("ABCREV = .*") "ABCREV = default\n"))))))
+              (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -175,14 +170,10 @@ (define-public yosys
           (replace 'configure
             (lambda* (#:key make-flags #:allow-other-keys)
               (apply invoke "make" "config-gcc" make-flags)))
-          (add-after 'configure 'prepare-abc
-            (lambda* (#:key inputs #:allow-other-keys)
-              (mkdir-p "abc")
-              (call-with-output-file "abc/Makefile"
-                (lambda (port)
-                  (format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n")))
-              (copy-file (search-input-file inputs "/bin/abc") "abc/abc")
-              (invoke "chmod" "+w" "abc/abc")))
+          (add-after 'configure 'use-external-abc
+            (lambda _
+              (substitute* '("./Makefile")
+                (("ABCEXTERNAL \\?=") "ABCEXTERNAL = abc"))))
           (add-before 'check 'fix-iverilog-references
             (lambda* (#:key inputs native-inputs #:allow-other-keys)
               (let ((iverilog (search-input-file (or native-inputs inputs)
@@ -202,7 +193,15 @@ (define-public yosys
                   (("if ! which iverilog") "if ! true")
                   (("iverilog ") (string-append iverilog " "))
                   (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
-                                                          iverilog "\"")))))))))
+                                                          iverilog "\""))))))
+          (add-after 'install 'add-symbolic-link
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Previously this package provided a copy of the "abc"
+              ;; executable in its output, named "yosys-abc".  Create a
+              ;; symbolic link so any external uses of that name continue to
+              ;; work.
+              (symlink (search-input-file inputs "/bin/abc")
+                       (string-append #$output "/bin/yosys-abc")))))))
     (native-inputs
      (list bison
            flex
@@ -212,15 +211,15 @@ (define-public yosys
            python
            tcl)) ; tclsh for the tests
     (inputs
-     (list abc
-           graphviz
+     (list graphviz
            libffi
            psmisc
            readline
            tcl
            xdot))
     (propagated-inputs
-     (list z3)) ; should be in path for yosys-smtbmc
+     (list abc
+           z3)) ; should be in path for yosys-smtbmc
     (home-page "https://yosyshq.net/yosys/")
     (synopsis "FPGA Verilog RTL synthesizer")
     (description "Yosys synthesizes Verilog-2005.")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 30 Dec 2022 16:02:02 GMT) Full text and rfc822 format available.

Message #14 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH 2/5] gnu: yosys: Use new package style.
Date: Fri, 30 Dec 2022 11:00:46 -0500
* gnu/packages/fpga.scm (yosys)[source]: Use gexp in snippet and don't
explicitly return #t.
[arguments]: Use gexps; use search-input-file to locate executables; simplify
parameters to "configure" phase; don't explicitly return #t from phases.
[native-inputs]: Sort alphabetically.
[inputs]: Sort alphabetically.
---
 gnu/packages/fpga.scm | 122 +++++++++++++++++++++---------------------
 1 file changed, 60 insertions(+), 62 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 45aadf8ea4..479ca3b061 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -150,77 +150,75 @@ (define-public yosys
               (file-name (git-file-name name version))
               (modules '((guix build utils)))
               (snippet
-               '(begin
-                  (substitute* "Makefile"
-                    (("ABCREV = .*") "ABCREV = default\n"))
-                  #t))))
+               #~(begin
+                   (substitute* "Makefile"
+                     (("ABCREV = .*") "ABCREV = default\n"))))))
     (build-system gnu-build-system)
     (arguments
-     `(#:test-target "test"
-       #:make-flags (list "CC=gcc"
-                          "CXX=g++"
-                          (string-append "PREFIX=" %output))
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'fix-paths
-           (lambda _
-             (substitute* "./passes/cmds/show.cc"
-               (("exec xdot") (string-append "exec " (which "xdot")))
-               (("dot -") (string-append (which "dot") " -"))
-               (("fuser") (which "fuser")))
-             #t))
-         (replace 'configure
-           (lambda* (#:key inputs (make-flags '()) #:allow-other-keys)
-             (apply invoke "make" "config-gcc" make-flags)))
-         (add-after 'configure 'prepare-abc
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let* ((sourceabc (assoc-ref inputs "abc"))
-                    (sourcebin (string-append sourceabc "/bin"))
-                    (source (string-append sourcebin "/abc")))
-                   (mkdir-p "abc")
-                   (call-with-output-file "abc/Makefile"
-                     (lambda (port)
-                       (format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n")))
-                   (copy-file source "abc/abc")
-                   (invoke "chmod" "+w" "abc/abc"))))
+     (list
+      #:test-target "test"
+      #:make-flags #~(list "CC=gcc"
+                           "CXX=g++"
+                           (string-append "PREFIX=" #$output))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'fix-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "./passes/cmds/show.cc"
+                (("exec xdot")
+                 (string-append "exec " (search-input-file inputs
+                                                           "/bin/xdot")))
+                (("dot -")
+                 (string-append (search-input-file inputs "/bin/dot") " -"))
+                (("fuser")
+                 (search-input-file inputs "/bin/fuser")))))
+          (replace 'configure
+            (lambda* (#:key make-flags #:allow-other-keys)
+              (apply invoke "make" "config-gcc" make-flags)))
+          (add-after 'configure 'prepare-abc
+            (lambda* (#:key inputs #:allow-other-keys)
+              (mkdir-p "abc")
+              (call-with-output-file "abc/Makefile"
+                (lambda (port)
+                  (format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n")))
+              (copy-file (search-input-file inputs "/bin/abc") "abc/abc")
+              (invoke "chmod" "+w" "abc/abc")))
           (add-before 'check 'fix-iverilog-references
-             (lambda* (#:key inputs native-inputs #:allow-other-keys)
-               (let* ((xinputs (or native-inputs inputs))
-                      (xdirname (assoc-ref xinputs "iverilog"))
-                      (iverilog (string-append xdirname "/bin/iverilog")))
-                     (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
-                                    "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
-                                    "./techlibs/ice40/tests/test_bram.sh"
-                                    "./techlibs/ice40/tests/test_ffs.sh"
-                                    "./techlibs/xilinx/tests/bram1.sh"
-                                    "./techlibs/xilinx/tests/bram2.sh"
-                                    "./tests/bram/run-single.sh"
-                                    "./tests/realmath/run-test.sh"
-                                    "./tests/simple/run-test.sh"
-                                    "./tests/techmap/mem_simple_4x1_runtest.sh"
-                                    "./tests/tools/autotest.sh"
-                                    "./tests/vloghtb/common.sh")
-                        (("if ! which iverilog") "if ! true")
-                        (("iverilog ") (string-append iverilog " "))
-                        (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
-                                                                iverilog "\"")))
-                     #t))))))
+            (lambda* (#:key inputs native-inputs #:allow-other-keys)
+              (let ((iverilog (search-input-file (or native-inputs inputs)
+                                                 "/bin/iverilog")))
+                (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
+                               "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
+                               "./techlibs/ice40/tests/test_bram.sh"
+                               "./techlibs/ice40/tests/test_ffs.sh"
+                               "./techlibs/xilinx/tests/bram1.sh"
+                               "./techlibs/xilinx/tests/bram2.sh"
+                               "./tests/bram/run-single.sh"
+                               "./tests/realmath/run-test.sh"
+                               "./tests/simple/run-test.sh"
+                               "./tests/techmap/mem_simple_4x1_runtest.sh"
+                               "./tests/tools/autotest.sh"
+                               "./tests/vloghtb/common.sh")
+                  (("if ! which iverilog") "if ! true")
+                  (("iverilog ") (string-append iverilog " "))
+                  (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
+                                                          iverilog "\"")))))))))
     (native-inputs
-     (list pkg-config
-           python
-           bison
+     (list bison
            flex
            gawk ; for the tests and "make" progress pretty-printing
-           tcl ; tclsh for the tests
-           iverilog)) ; for the tests
+           iverilog ; for the tests
+           pkg-config
+           python
+           tcl)) ; tclsh for the tests
     (inputs
-     (list tcl
-           readline
-           libffi
+     (list abc
            graphviz
+           libffi
            psmisc
-           xdot
-           abc))
+           readline
+           tcl
+           xdot))
     (propagated-inputs
      (list z3)) ; should be in path for yosys-smtbmc
     (home-page "https://yosyshq.net/yosys/")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 30 Dec 2022 16:02:03 GMT) Full text and rfc822 format available.

Message #17 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH 4/5] gnu: yosys: Propagate external dependencies.
Date: Fri, 30 Dec 2022 11:00:48 -0500
* gnu/packages/fpga.scm (yosys)[inputs]: Move graphviz, psmisc, xdot from
here...
[propagated-inputs]: ...to here, to ensure the availability at runtime of
executables invoked by yosys' "show" command.
[arguments]: Remove now-obsolete "fix-paths" phase.
---
 gnu/packages/fpga.scm | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 8effebd921..785d385621 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -157,16 +157,6 @@ (define-public yosys
                            (string-append "PREFIX=" #$output))
       #:phases
       #~(modify-phases %standard-phases
-          (add-before 'configure 'fix-paths
-            (lambda* (#:key inputs #:allow-other-keys)
-              (substitute* "./passes/cmds/show.cc"
-                (("exec xdot")
-                 (string-append "exec " (search-input-file inputs
-                                                           "/bin/xdot")))
-                (("dot -")
-                 (string-append (search-input-file inputs "/bin/dot") " -"))
-                (("fuser")
-                 (search-input-file inputs "/bin/fuser")))))
           (replace 'configure
             (lambda* (#:key make-flags #:allow-other-keys)
               (apply invoke "make" "config-gcc" make-flags)))
@@ -211,14 +201,14 @@ (define-public yosys
            python
            tcl)) ; tclsh for the tests
     (inputs
-     (list graphviz
-           libffi
-           psmisc
+     (list libffi
            readline
-           tcl
-           xdot))
+           tcl))
     (propagated-inputs
      (list abc
+           graphviz ; for dot
+           psmisc ; for fuser
+           xdot
            z3)) ; should be in path for yosys-smtbmc
     (home-page "https://yosyshq.net/yosys/")
     (synopsis "FPGA Verilog RTL synthesizer")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 30 Dec 2022 16:02:03 GMT) Full text and rfc822 format available.

Message #20 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH 5/5] gnu: yosys: Update to 0.24.
Date: Fri, 30 Dec 2022 11:00:49 -0500
* gnu/packages/fpga.scm (yosys): Update to 0.24.
[arguments]: Remove obsolete "fix-iverilog-references" phase.
[inputs]: Add zlib.
[propagated-inputs]: Add gtkwave, python, python-click.
---
 gnu/packages/fpga.scm | 35 +++++++++--------------------------
 1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 785d385621..d3532069e8 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -137,16 +137,15 @@ (define-public iverilog
 (define-public yosys
   (package
     (name "yosys")
-    (version "0.9")
+    (version "0.24")
     (source (origin
               (method git-fetch)
               (uri (git-reference
                     (url "https://github.com/YosysHQ/yosys")
-                    (commit (string-append "yosys-" version))
-                    (recursive? #t))) ; for the ‘iverilog’ submodule
+                    (commit (string-append "yosys-" version))))
               (sha256
-                (base32
-                   "0lb9r055h8y1vj2z8gm4ip0v06j5mk7f9zx9gi67kkqb7g4rhjli"))
+               (base32
+                "1hrlqq9850j0160z9ibcia8fp0xxn0iakh0yb69kjzb6ffgjjn3d"))
               (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (arguments
@@ -164,26 +163,6 @@ (define-public yosys
             (lambda _
               (substitute* '("./Makefile")
                 (("ABCEXTERNAL \\?=") "ABCEXTERNAL = abc"))))
-          (add-before 'check 'fix-iverilog-references
-            (lambda* (#:key inputs native-inputs #:allow-other-keys)
-              (let ((iverilog (search-input-file (or native-inputs inputs)
-                                                 "/bin/iverilog")))
-                (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
-                               "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
-                               "./techlibs/ice40/tests/test_bram.sh"
-                               "./techlibs/ice40/tests/test_ffs.sh"
-                               "./techlibs/xilinx/tests/bram1.sh"
-                               "./techlibs/xilinx/tests/bram2.sh"
-                               "./tests/bram/run-single.sh"
-                               "./tests/realmath/run-test.sh"
-                               "./tests/simple/run-test.sh"
-                               "./tests/techmap/mem_simple_4x1_runtest.sh"
-                               "./tests/tools/autotest.sh"
-                               "./tests/vloghtb/common.sh")
-                  (("if ! which iverilog") "if ! true")
-                  (("iverilog ") (string-append iverilog " "))
-                  (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
-                                                          iverilog "\""))))))
           (add-after 'install 'add-symbolic-link
             (lambda* (#:key inputs #:allow-other-keys)
               ;; Previously this package provided a copy of the "abc"
@@ -203,11 +182,15 @@ (define-public yosys
     (inputs
      (list libffi
            readline
-           tcl))
+           tcl
+           zlib))
     (propagated-inputs
      (list abc
            graphviz ; for dot
+           gtkwave ; for vcd2fst
            psmisc ; for fuser
+           python
+           python-click
            xdot
            z3)) ; should be in path for yosys-smtbmc
     (home-page "https://yosyshq.net/yosys/")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Sun, 08 Jan 2023 18:32:01 GMT) Full text and rfc822 format available.

Message #23 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v2 0/5] gnu: yosys: Update to 0.24.
Date: Sun,  8 Jan 2023 13:31:26 -0500
Here's a revised patchset with a modified final patch that updates yosys to
version 0.25, released in the past week, instead of 0.24.  Everything else
remains unchanged.

I've re-tested this on x86-64 and AArch64 and everything appears fine.

Here's the original cover letter:

Here's a patch series that aims to improve the package for Yosys, a tool for
synthesizing Verilog RTL designs, by

- Updating the source-repository and home-page URLs to their current location;

- Updating the package definition to the modern style, using gexps and
  search-input-file;

- Having Yosys use the "abc" executable from Guix's package rather than
  creating and installing a duplicate copy;

- Explicitly propagating packages with executables Yosys invokes at runtime
  rather than embedding store references in Yosys' code; and

- Updating Yosys to version 0.24.

I've tested building the package and its dependencies on x86-64 and AArch64
and everything seems okay[0].  Again, arachne-pnr fails to build in any case
and will need separate attention.

[0] Yosys' README.md file includes sample sessions useful for testing,
    particularly whether external tools can be invoked via the "show" and
    "abc" commands:

    https://github.com/YosysHQ/yosys/blob/3ebc50d/README.md#getting-started

    The files "fiedler-cooley.v" and "mycells.lib" are present in the source
    tree.

--
Simon South
simon <at> simonsouth.net


Simon South (5):
  gnu: yosys: Update source and home-page URLs.
  gnu: yosys: Use new package style.
  gnu: yosys: Use external abc.
  gnu: yosys: Propagate external dependencies.
  gnu: yosys: Update to 0.25.

 gnu/packages/fpga.scm | 120 ++++++++++++++++--------------------------
 1 file changed, 45 insertions(+), 75 deletions(-)


base-commit: f5ea392b9cd3851ed7517876a8cd4beb13893c9c
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Sun, 08 Jan 2023 18:32:01 GMT) Full text and rfc822 format available.

Message #26 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v2 3/5] gnu: yosys: Use external abc.
Date: Sun,  8 Jan 2023 13:31:29 -0500
* gnu/packages/fpga.scm (yosys)[source]: Remove snippet and associated
"modules" field.
[arguments]: Replace "prepare-abc" phase with "use-external-abc", which
configures the package's build system to use the system's "abc" executable
instead of creating a duplicate; add "add-symbolic-link" phase to preserve
availability of "yosys-abc" command.
[inputs]: Move abc from here...
[propagated-inputs]: ...to here, to ensure its availability at runtime.
---
 gnu/packages/fpga.scm | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 479ca3b061..8effebd921 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -147,12 +147,7 @@ (define-public yosys
               (sha256
                 (base32
                    "0lb9r055h8y1vj2z8gm4ip0v06j5mk7f9zx9gi67kkqb7g4rhjli"))
-              (file-name (git-file-name name version))
-              (modules '((guix build utils)))
-              (snippet
-               #~(begin
-                   (substitute* "Makefile"
-                     (("ABCREV = .*") "ABCREV = default\n"))))))
+              (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -175,14 +170,10 @@ (define-public yosys
           (replace 'configure
             (lambda* (#:key make-flags #:allow-other-keys)
               (apply invoke "make" "config-gcc" make-flags)))
-          (add-after 'configure 'prepare-abc
-            (lambda* (#:key inputs #:allow-other-keys)
-              (mkdir-p "abc")
-              (call-with-output-file "abc/Makefile"
-                (lambda (port)
-                  (format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n")))
-              (copy-file (search-input-file inputs "/bin/abc") "abc/abc")
-              (invoke "chmod" "+w" "abc/abc")))
+          (add-after 'configure 'use-external-abc
+            (lambda _
+              (substitute* '("./Makefile")
+                (("ABCEXTERNAL \\?=") "ABCEXTERNAL = abc"))))
           (add-before 'check 'fix-iverilog-references
             (lambda* (#:key inputs native-inputs #:allow-other-keys)
               (let ((iverilog (search-input-file (or native-inputs inputs)
@@ -202,7 +193,15 @@ (define-public yosys
                   (("if ! which iverilog") "if ! true")
                   (("iverilog ") (string-append iverilog " "))
                   (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
-                                                          iverilog "\"")))))))))
+                                                          iverilog "\""))))))
+          (add-after 'install 'add-symbolic-link
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Previously this package provided a copy of the "abc"
+              ;; executable in its output, named "yosys-abc".  Create a
+              ;; symbolic link so any external uses of that name continue to
+              ;; work.
+              (symlink (search-input-file inputs "/bin/abc")
+                       (string-append #$output "/bin/yosys-abc")))))))
     (native-inputs
      (list bison
            flex
@@ -212,15 +211,15 @@ (define-public yosys
            python
            tcl)) ; tclsh for the tests
     (inputs
-     (list abc
-           graphviz
+     (list graphviz
            libffi
            psmisc
            readline
            tcl
            xdot))
     (propagated-inputs
-     (list z3)) ; should be in path for yosys-smtbmc
+     (list abc
+           z3)) ; should be in path for yosys-smtbmc
     (home-page "https://yosyshq.net/yosys/")
     (synopsis "FPGA Verilog RTL synthesizer")
     (description "Yosys synthesizes Verilog-2005.")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Sun, 08 Jan 2023 18:32:02 GMT) Full text and rfc822 format available.

Message #29 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v2 1/5] gnu: yosys: Update source and home-page URLs.
Date: Sun,  8 Jan 2023 13:31:27 -0500
* gnu/packages/fpga.scm (yosys)[source]: Update source-repository URL.
[home-page]: Update URL.
---
 gnu/packages/fpga.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index acce5f8f82..45aadf8ea4 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -141,7 +141,7 @@ (define-public yosys
     (source (origin
               (method git-fetch)
               (uri (git-reference
-                    (url "https://github.com/cliffordwolf/yosys")
+                    (url "https://github.com/YosysHQ/yosys")
                     (commit (string-append "yosys-" version))
                     (recursive? #t))) ; for the ‘iverilog’ submodule
               (sha256
@@ -223,7 +223,7 @@ (define-public yosys
            abc))
     (propagated-inputs
      (list z3)) ; should be in path for yosys-smtbmc
-    (home-page "http://www.clifford.at/yosys/")
+    (home-page "https://yosyshq.net/yosys/")
     (synopsis "FPGA Verilog RTL synthesizer")
     (description "Yosys synthesizes Verilog-2005.")
     (license license:isc)))
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Sun, 08 Jan 2023 18:32:02 GMT) Full text and rfc822 format available.

Message #32 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v2 4/5] gnu: yosys: Propagate external dependencies.
Date: Sun,  8 Jan 2023 13:31:30 -0500
* gnu/packages/fpga.scm (yosys)[inputs]: Move graphviz, psmisc, xdot from
here...
[propagated-inputs]: ...to here, to ensure the availability at runtime of
executables invoked by yosys' "show" command.
[arguments]: Remove now-obsolete "fix-paths" phase.
---
 gnu/packages/fpga.scm | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 8effebd921..785d385621 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -157,16 +157,6 @@ (define-public yosys
                            (string-append "PREFIX=" #$output))
       #:phases
       #~(modify-phases %standard-phases
-          (add-before 'configure 'fix-paths
-            (lambda* (#:key inputs #:allow-other-keys)
-              (substitute* "./passes/cmds/show.cc"
-                (("exec xdot")
-                 (string-append "exec " (search-input-file inputs
-                                                           "/bin/xdot")))
-                (("dot -")
-                 (string-append (search-input-file inputs "/bin/dot") " -"))
-                (("fuser")
-                 (search-input-file inputs "/bin/fuser")))))
           (replace 'configure
             (lambda* (#:key make-flags #:allow-other-keys)
               (apply invoke "make" "config-gcc" make-flags)))
@@ -211,14 +201,14 @@ (define-public yosys
            python
            tcl)) ; tclsh for the tests
     (inputs
-     (list graphviz
-           libffi
-           psmisc
+     (list libffi
            readline
-           tcl
-           xdot))
+           tcl))
     (propagated-inputs
      (list abc
+           graphviz ; for dot
+           psmisc ; for fuser
+           xdot
            z3)) ; should be in path for yosys-smtbmc
     (home-page "https://yosyshq.net/yosys/")
     (synopsis "FPGA Verilog RTL synthesizer")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Sun, 08 Jan 2023 18:32:03 GMT) Full text and rfc822 format available.

Message #35 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v2 2/5] gnu: yosys: Use new package style.
Date: Sun,  8 Jan 2023 13:31:28 -0500
* gnu/packages/fpga.scm (yosys)[source]: Use gexp in snippet and don't
explicitly return #t.
[arguments]: Use gexps; use search-input-file to locate executables; simplify
parameters to "configure" phase; don't explicitly return #t from phases.
[native-inputs]: Sort alphabetically.
[inputs]: Sort alphabetically.
---
 gnu/packages/fpga.scm | 122 +++++++++++++++++++++---------------------
 1 file changed, 60 insertions(+), 62 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 45aadf8ea4..479ca3b061 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -150,77 +150,75 @@ (define-public yosys
               (file-name (git-file-name name version))
               (modules '((guix build utils)))
               (snippet
-               '(begin
-                  (substitute* "Makefile"
-                    (("ABCREV = .*") "ABCREV = default\n"))
-                  #t))))
+               #~(begin
+                   (substitute* "Makefile"
+                     (("ABCREV = .*") "ABCREV = default\n"))))))
     (build-system gnu-build-system)
     (arguments
-     `(#:test-target "test"
-       #:make-flags (list "CC=gcc"
-                          "CXX=g++"
-                          (string-append "PREFIX=" %output))
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'fix-paths
-           (lambda _
-             (substitute* "./passes/cmds/show.cc"
-               (("exec xdot") (string-append "exec " (which "xdot")))
-               (("dot -") (string-append (which "dot") " -"))
-               (("fuser") (which "fuser")))
-             #t))
-         (replace 'configure
-           (lambda* (#:key inputs (make-flags '()) #:allow-other-keys)
-             (apply invoke "make" "config-gcc" make-flags)))
-         (add-after 'configure 'prepare-abc
-           (lambda* (#:key inputs #:allow-other-keys)
-             (let* ((sourceabc (assoc-ref inputs "abc"))
-                    (sourcebin (string-append sourceabc "/bin"))
-                    (source (string-append sourcebin "/abc")))
-                   (mkdir-p "abc")
-                   (call-with-output-file "abc/Makefile"
-                     (lambda (port)
-                       (format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n")))
-                   (copy-file source "abc/abc")
-                   (invoke "chmod" "+w" "abc/abc"))))
+     (list
+      #:test-target "test"
+      #:make-flags #~(list "CC=gcc"
+                           "CXX=g++"
+                           (string-append "PREFIX=" #$output))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'fix-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "./passes/cmds/show.cc"
+                (("exec xdot")
+                 (string-append "exec " (search-input-file inputs
+                                                           "/bin/xdot")))
+                (("dot -")
+                 (string-append (search-input-file inputs "/bin/dot") " -"))
+                (("fuser")
+                 (search-input-file inputs "/bin/fuser")))))
+          (replace 'configure
+            (lambda* (#:key make-flags #:allow-other-keys)
+              (apply invoke "make" "config-gcc" make-flags)))
+          (add-after 'configure 'prepare-abc
+            (lambda* (#:key inputs #:allow-other-keys)
+              (mkdir-p "abc")
+              (call-with-output-file "abc/Makefile"
+                (lambda (port)
+                  (format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n")))
+              (copy-file (search-input-file inputs "/bin/abc") "abc/abc")
+              (invoke "chmod" "+w" "abc/abc")))
           (add-before 'check 'fix-iverilog-references
-             (lambda* (#:key inputs native-inputs #:allow-other-keys)
-               (let* ((xinputs (or native-inputs inputs))
-                      (xdirname (assoc-ref xinputs "iverilog"))
-                      (iverilog (string-append xdirname "/bin/iverilog")))
-                     (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
-                                    "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
-                                    "./techlibs/ice40/tests/test_bram.sh"
-                                    "./techlibs/ice40/tests/test_ffs.sh"
-                                    "./techlibs/xilinx/tests/bram1.sh"
-                                    "./techlibs/xilinx/tests/bram2.sh"
-                                    "./tests/bram/run-single.sh"
-                                    "./tests/realmath/run-test.sh"
-                                    "./tests/simple/run-test.sh"
-                                    "./tests/techmap/mem_simple_4x1_runtest.sh"
-                                    "./tests/tools/autotest.sh"
-                                    "./tests/vloghtb/common.sh")
-                        (("if ! which iverilog") "if ! true")
-                        (("iverilog ") (string-append iverilog " "))
-                        (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
-                                                                iverilog "\"")))
-                     #t))))))
+            (lambda* (#:key inputs native-inputs #:allow-other-keys)
+              (let ((iverilog (search-input-file (or native-inputs inputs)
+                                                 "/bin/iverilog")))
+                (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
+                               "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
+                               "./techlibs/ice40/tests/test_bram.sh"
+                               "./techlibs/ice40/tests/test_ffs.sh"
+                               "./techlibs/xilinx/tests/bram1.sh"
+                               "./techlibs/xilinx/tests/bram2.sh"
+                               "./tests/bram/run-single.sh"
+                               "./tests/realmath/run-test.sh"
+                               "./tests/simple/run-test.sh"
+                               "./tests/techmap/mem_simple_4x1_runtest.sh"
+                               "./tests/tools/autotest.sh"
+                               "./tests/vloghtb/common.sh")
+                  (("if ! which iverilog") "if ! true")
+                  (("iverilog ") (string-append iverilog " "))
+                  (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
+                                                          iverilog "\"")))))))))
     (native-inputs
-     (list pkg-config
-           python
-           bison
+     (list bison
            flex
            gawk ; for the tests and "make" progress pretty-printing
-           tcl ; tclsh for the tests
-           iverilog)) ; for the tests
+           iverilog ; for the tests
+           pkg-config
+           python
+           tcl)) ; tclsh for the tests
     (inputs
-     (list tcl
-           readline
-           libffi
+     (list abc
            graphviz
+           libffi
            psmisc
-           xdot
-           abc))
+           readline
+           tcl
+           xdot))
     (propagated-inputs
      (list z3)) ; should be in path for yosys-smtbmc
     (home-page "https://yosyshq.net/yosys/")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Sun, 08 Jan 2023 18:32:03 GMT) Full text and rfc822 format available.

Message #38 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v2 5/5] gnu: yosys: Update to 0.25.
Date: Sun,  8 Jan 2023 13:31:31 -0500
* gnu/packages/fpga.scm (yosys): Update to 0.25.
[arguments]: Remove obsolete "fix-iverilog-references" phase.
[inputs]: Add zlib.
[propagated-inputs]: Add gtkwave, python, python-click.
---
 gnu/packages/fpga.scm | 35 +++++++++--------------------------
 1 file changed, 9 insertions(+), 26 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 785d385621..45cf0e74cf 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -137,16 +137,15 @@ (define-public iverilog
 (define-public yosys
   (package
     (name "yosys")
-    (version "0.9")
+    (version "0.25")
     (source (origin
               (method git-fetch)
               (uri (git-reference
                     (url "https://github.com/YosysHQ/yosys")
-                    (commit (string-append "yosys-" version))
-                    (recursive? #t))) ; for the ‘iverilog’ submodule
+                    (commit (string-append "yosys-" version))))
               (sha256
-                (base32
-                   "0lb9r055h8y1vj2z8gm4ip0v06j5mk7f9zx9gi67kkqb7g4rhjli"))
+               (base32
+                "1j5slm7m02q6n0yv6f3ihv2rgrc4krzcdz6g8v6jmj0gwgh9xi5h"))
               (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (arguments
@@ -164,26 +163,6 @@ (define-public yosys
             (lambda _
               (substitute* '("./Makefile")
                 (("ABCEXTERNAL \\?=") "ABCEXTERNAL = abc"))))
-          (add-before 'check 'fix-iverilog-references
-            (lambda* (#:key inputs native-inputs #:allow-other-keys)
-              (let ((iverilog (search-input-file (or native-inputs inputs)
-                                                 "/bin/iverilog")))
-                (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
-                               "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
-                               "./techlibs/ice40/tests/test_bram.sh"
-                               "./techlibs/ice40/tests/test_ffs.sh"
-                               "./techlibs/xilinx/tests/bram1.sh"
-                               "./techlibs/xilinx/tests/bram2.sh"
-                               "./tests/bram/run-single.sh"
-                               "./tests/realmath/run-test.sh"
-                               "./tests/simple/run-test.sh"
-                               "./tests/techmap/mem_simple_4x1_runtest.sh"
-                               "./tests/tools/autotest.sh"
-                               "./tests/vloghtb/common.sh")
-                  (("if ! which iverilog") "if ! true")
-                  (("iverilog ") (string-append iverilog " "))
-                  (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
-                                                          iverilog "\""))))))
           (add-after 'install 'add-symbolic-link
             (lambda* (#:key inputs #:allow-other-keys)
               ;; Previously this package provided a copy of the "abc"
@@ -203,11 +182,15 @@ (define-public yosys
     (inputs
      (list libffi
            readline
-           tcl))
+           tcl
+           zlib))
     (propagated-inputs
      (list abc
            graphviz ; for dot
+           gtkwave ; for vcd2fst
            psmisc ; for fuser
+           python
+           python-click
            xdot
            z3)) ; should be in path for yosys-smtbmc
     (home-page "https://yosyshq.net/yosys/")
-- 
2.38.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Wed, 08 Feb 2023 17:25:01 GMT) Full text and rfc822 format available.

Message #41 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Simon South <simon <at> simonsouth.net>
Cc: 60429 <at> debbugs.gnu.org, guix-patches <at> gnu.org
Subject: Re: [bug#60429] [PATCH v2 4/5] gnu: yosys: Propagate external
 dependencies.
Date: Wed, 08 Feb 2023 17:14:59 +0000
[Message part 1 (text/plain, inline)]
Simon South <simon <at> simonsouth.net> writes:

> * gnu/packages/fpga.scm (yosys)[inputs]: Move graphviz, psmisc, xdot from
> here...
> [propagated-inputs]: ...to here, to ensure the availability at runtime of
> executables invoked by yosys' "show" command.
> [arguments]: Remove now-obsolete "fix-paths" phase.
> ---
>  gnu/packages/fpga.scm | 20 +++++---------------
>  1 file changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
> index 8effebd921..785d385621 100644
> --- a/gnu/packages/fpga.scm
> +++ b/gnu/packages/fpga.scm
> @@ -157,16 +157,6 @@ (define-public yosys
>                             (string-append "PREFIX=" #$output))
>        #:phases
>        #~(modify-phases %standard-phases
> -          (add-before 'configure 'fix-paths
> -            (lambda* (#:key inputs #:allow-other-keys)
> -              (substitute* "./passes/cmds/show.cc"
> -                (("exec xdot")
> -                 (string-append "exec " (search-input-file inputs
> -                                                           "/bin/xdot")))
> -                (("dot -")
> -                 (string-append (search-input-file inputs "/bin/dot") " -"))
> -                (("fuser")
> -                 (search-input-file inputs "/bin/fuser")))))
>            (replace 'configure
>              (lambda* (#:key make-flags #:allow-other-keys)
>                (apply invoke "make" "config-gcc" make-flags)))
> @@ -211,14 +201,14 @@ (define-public yosys
>             python
>             tcl)) ; tclsh for the tests
>      (inputs
> -     (list graphviz
> -           libffi
> -           psmisc
> +     (list libffi
>             readline
> -           tcl
> -           xdot))
> +           tcl))
>      (propagated-inputs
>       (list abc
> +           graphviz ; for dot
> +           psmisc ; for fuser
> +           xdot
>             z3)) ; should be in path for yosys-smtbmc
>      (home-page "https://yosyshq.net/yosys/")
>      (synopsis "FPGA Verilog RTL synthesizer")

Thanks Simon, I've pushed the first 3 patches from this series to the
master branch now.

For the changes regarding propagated-inputs though, I'm not sure this it
the right direction. Firstly, I think it's possible (and maybe
desirable) to keep the 'fix-paths phase, even if the inputs are changed
to be propagated.

I know you say this is related to yosys show in the commit message, can
you elaborate on why these packages are necessary to have in the users
environment?

Thanks,

Chris
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Wed, 08 Feb 2023 17:25:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Thu, 09 Feb 2023 00:36:02 GMT) Full text and rfc822 format available.

Message #47 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 60429 <at> debbugs.gnu.org
Subject: Re: [bug#60429] [PATCH v2 4/5] gnu: yosys: Propagate external
 dependencies.
Date: Wed, 08 Feb 2023 19:35:30 -0500
Christopher Baines <mail <at> cbaines.net> writes:
> Thanks Simon, I've pushed the first 3 patches from this series to the
> master branch now.

Nice, thank you.

> I know you say this is related to yosys show in the commit message,
> can you elaborate on why these packages are necessary to have in the
> users environment?

Yosys' "show" command produces its output by building and executing a
shell command that invokes "dot" or "xdot" on the user's data.  The
implementation is in passes/cmds/show.cc[0]; the code for invoking dot
for instance looks like

    #define DOT_CMD "dot -T%s '%s' > '%s.new' && mv '%s.new' '%s'"
    (...)
    std::string cmd = stringf(DOT_CMD, format.c_str(), dot_file.c_str(), out_file.c_str(), out_file.c_str(), out_file.c_str());
    log("Exec: %s\n", cmd.c_str());
    if (run_command(cmd) != 0)
        log_cmd_error("Shell command failed!\n");

Obviously this works only if "dot" is in the user's PATH (as Yosys
blindly assumes), so the graphviz package must be installed as well or
the "show" command will be broken.  Similarly for the "fuser" and "xdot"
executables, which by default are invoked to provide graphical output
(though their use can be overridden by a setting at runtime).

I find this business of generating shell commands a bit ugly but at
least it creates only a loose coupling between the executables: The
shell is free to select a suitable "dot" to run, so the user can
substitute their own as easily as changing their PATH.

In constrast, the existing 'fix-paths phase tightens this coupling
considerably, as it embeds in the DOT_CMD string above the full path to
a specific "dot" executable in the store.  This ties the two executables
together completely, making it very difficult to change which "dot" is
used by Yosys without rebuilding the package.

I see no advantage to coupling the executables together tightly this
way, and in fact it seems counter to what is implied by the code above.
(Note also the "ABCEXTERNAL" build variable adjusted in a previous patch
is provided specifically to allow users to swap in their own version of
abc, which a different Yosys command invokes.)  I'd rather we propagate
the packages needed to ensure Yosys works as expected out-of-the-box,
then leave the user free to override its behaviour as they see fit.

-- 
Simon South
simon <at> simonsouth.net

[0] https://github.com/YosysHQ/yosys/blob/1979e0b1f2482dbf0562f5116ab444280a377773/passes/cmds/show.cc




Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Thu, 09 Feb 2023 05:30:02 GMT) Full text and rfc822 format available.

Message #50 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Simon South <simon <at> simonsouth.net>, Christopher Baines <mail <at> cbaines.net>
Cc: 60429 <at> debbugs.gnu.org
Subject: Re: [bug#60429] [PATCH v2 4/5] gnu: yosys: Propagate external
 dependencies.
Date: Thu, 09 Feb 2023 06:29:26 +0100
Am Mittwoch, dem 08.02.2023 um 19:35 -0500 schrieb Simon South:
> Yosys' "show" command produces its output by building and executing a
> shell command that invokes "dot" or "xdot" on the user's data.  The
> implementation is in passes/cmds/show.cc[0]; the code for invoking
> dot for instance looks like
> 
>     #define DOT_CMD "dot -T%s '%s' > '%s.new' && mv '%s.new' '%s'"
>     (...)
>     std::string cmd = stringf(DOT_CMD, format.c_str(),
> dot_file.c_str(), out_file.c_str(), out_file.c_str(),
> out_file.c_str());
>     log("Exec: %s\n", cmd.c_str());
>     if (run_command(cmd) != 0)
>         log_cmd_error("Shell command failed!\n");
> 
> Obviously this works only if "dot" is in the user's PATH (as Yosys
> blindly assumes), so the graphviz package must be installed as well
> or the "show" command will be broken.  Similarly for the "fuser" and
> "xdot" executables, which by default are invoked to provide graphical
> output (though their use can be overridden by a setting at runtime).
> 
> I find this business of generating shell commands a bit ugly but at
> least it creates only a loose coupling between the executables: The
> shell is free to select a suitable "dot" to run, so the user can
> substitute their own as easily as changing their PATH.
When propagating inputs, it creates the same tight coupling as
hardcoding would, but with worse UX (think propagating conflicts).


You should instead try:

  std::optional<std::string> dot_bin = which("dot")
  if (!dot_bin)
    dot_bin = "@dot@";
  std::string cmd = string(DOT_CMD, *dot_bin, ...)

Cheers




Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Thu, 09 Feb 2023 16:48:02 GMT) Full text and rfc822 format available.

Message #53 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: 60429 <at> debbugs.gnu.org, Christopher Baines <mail <at> cbaines.net>
Subject: Re: [bug#60429] [PATCH v2 4/5] gnu: yosys: Propagate external
 dependencies.
Date: Thu, 09 Feb 2023 11:47:04 -0500
Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:
> You should instead try:

That would be a nice approach but I don't really want to start modifying
the source code.

I'll send out a v3 of the remaining patches that keeps the 'fix-paths
phase (and updates Yosys to 0.26, since that came out yesterday).

Embedding store references directly in source code still feels ugly to
me but I can see how propagating packages just creates a different
problem.  Pity there isn't an elegant way to specify a package should
"use this input, but not exclusively" (though at least there's "guix
build --with-input").

--
Simon South
simon <at> simonsouth.net




Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 10 Feb 2023 13:18:02 GMT) Full text and rfc822 format available.

Message #56 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v3 0/5] gnu: yosys: Update to 0.24.
Date: Fri, 10 Feb 2023 08:16:53 -0500
Here's a third revision of the remaining two patches in this series.  These
updated patches now

- Remove the remaining propagated inputs (abc and z3) from the yosys package
  via changes to its "fix-paths" and "use-external-abc" phases, and

- Update Yosys to version 0.26.

Note the second patch adds python and python-click as new propagated inputs.
The Click library is needed by the "yosys-witness" command, and including both
it and the Python interpreter in propagated-inputs is the only combination
I've found that will cause Guix to set GUIX_PYTHONPATH appropriately on
installation so this command can function.

This appears to be supported by the Guix manual (in the sections "Search
Paths" and "Python Modules") but if there's a better approach, please let me
know.

As usual, I've tested these changes on x86-64 and AArch64 and all appears
well.

--
Simon South
simon <at> simonsouth.net


Simon South (2):
  gnu: yosys: Do not propagate any inputs.
  gnu: yosys: Update to 0.26.

 gnu/packages/fpga.scm | 56 +++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 32 deletions(-)


base-commit: b8f6ead5faac3c1b9a8fa6e060c00cf0917e884e
-- 
2.39.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 10 Feb 2023 13:18:02 GMT) Full text and rfc822 format available.

Message #59 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v3 4/5] gnu: yosys: Do not propagate any inputs.
Date: Fri, 10 Feb 2023 08:16:54 -0500
* gnu/packages/fpga.scm (yosys)[arguments]<#:phases>: Patch reference to z3 in
"fix-paths" phase; in "use-external-abc" phase, use complete path to "abc"
executable in store.
[propagated-inputs]: Remove, moving abc and z3 from here...
[inputs]: ...to here.
---
 gnu/packages/fpga.scm | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 7b3c522bf7..4a01714e81 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -159,6 +159,9 @@ (define-public yosys
       #~(modify-phases %standard-phases
           (add-before 'configure 'fix-paths
             (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "./backends/smt2/smtio.py"
+                (("\\['z3")
+                 (string-append "['" (search-input-file inputs "/bin/z3"))))
               (substitute* "./passes/cmds/show.cc"
                 (("exec xdot")
                  (string-append "exec " (search-input-file inputs
@@ -171,9 +174,11 @@ (define-public yosys
             (lambda* (#:key make-flags #:allow-other-keys)
               (apply invoke "make" "config-gcc" make-flags)))
           (add-after 'configure 'use-external-abc
-            (lambda _
+            (lambda* (#:key inputs #:allow-other-keys)
               (substitute* '("./Makefile")
-                (("ABCEXTERNAL \\?=") "ABCEXTERNAL = abc"))))
+                (("ABCEXTERNAL \\?=")
+                 (string-append "ABCEXTERNAL = "
+                                (search-input-file inputs "/bin/abc"))))))
           (add-before 'check 'fix-iverilog-references
             (lambda* (#:key inputs native-inputs #:allow-other-keys)
               (let ((iverilog (search-input-file (or native-inputs inputs)
@@ -211,15 +216,14 @@ (define-public yosys
            python
            tcl)) ; tclsh for the tests
     (inputs
-     (list graphviz
+     (list abc
+           graphviz
            libffi
            psmisc
            readline
            tcl
-           xdot))
-    (propagated-inputs
-     (list abc
-           z3)) ; should be in path for yosys-smtbmc
+           xdot
+           z3))
     (home-page "https://yosyshq.net/yosys/")
     (synopsis "FPGA Verilog RTL synthesizer")
     (description "Yosys synthesizes Verilog-2005.")
-- 
2.39.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Fri, 10 Feb 2023 13:18:03 GMT) Full text and rfc822 format available.

Message #62 received at 60429 <at> debbugs.gnu.org (full text, mbox):

From: Simon South <simon <at> simonsouth.net>
To: 60429 <at> debbugs.gnu.org
Subject: [PATCH v3 5/5] gnu: yosys: Update to 0.26.
Date: Fri, 10 Feb 2023 08:16:55 -0500
* gnu/packages/fpga.scm (yosys): Update to 0.26.
[source]: Disable unnecessary recursive checkout.
[arguments]<#:phases>: Expand "fix-paths" phase to match new version; remove
obsolete "fix-iverilog-references" phase.
[inputs]: Add gtkwave, zlib.
[propagated-inputs]: Add python, python-click.
---
 gnu/packages/fpga.scm | 42 +++++++++++++++---------------------------
 1 file changed, 15 insertions(+), 27 deletions(-)

diff --git a/gnu/packages/fpga.scm b/gnu/packages/fpga.scm
index 4a01714e81..8f03ba7a1d 100644
--- a/gnu/packages/fpga.scm
+++ b/gnu/packages/fpga.scm
@@ -137,16 +137,15 @@ (define-public iverilog
 (define-public yosys
   (package
     (name "yosys")
-    (version "0.9")
+    (version "0.26")
     (source (origin
               (method git-fetch)
               (uri (git-reference
                     (url "https://github.com/YosysHQ/yosys")
-                    (commit (string-append "yosys-" version))
-                    (recursive? #t))) ; for the ‘iverilog’ submodule
+                    (commit (string-append "yosys-" version))))
               (sha256
-                (base32
-                   "0lb9r055h8y1vj2z8gm4ip0v06j5mk7f9zx9gi67kkqb7g4rhjli"))
+               (base32
+                "0s79ljgbcfkm7l9km7dcvlz4mnx38nbyxppscvh5il5lw07n45gx"))
               (file-name (git-file-name name version))))
     (build-system gnu-build-system)
     (arguments
@@ -162,7 +161,11 @@ (define-public yosys
               (substitute* "./backends/smt2/smtio.py"
                 (("\\['z3")
                  (string-append "['" (search-input-file inputs "/bin/z3"))))
-              (substitute* "./passes/cmds/show.cc"
+              (substitute* "./kernel/fstdata.cc"
+                (("vcd2fst")
+                 (search-input-file inputs "/bin/vcd2fst")))
+              (substitute* '("./passes/cmds/show.cc"
+                             "./passes/cmds/viz.cc")
                 (("exec xdot")
                  (string-append "exec " (search-input-file inputs
                                                            "/bin/xdot")))
@@ -179,26 +182,6 @@ (define-public yosys
                 (("ABCEXTERNAL \\?=")
                  (string-append "ABCEXTERNAL = "
                                 (search-input-file inputs "/bin/abc"))))))
-          (add-before 'check 'fix-iverilog-references
-            (lambda* (#:key inputs native-inputs #:allow-other-keys)
-              (let ((iverilog (search-input-file (or native-inputs inputs)
-                                                 "/bin/iverilog")))
-                (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
-                               "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
-                               "./techlibs/ice40/tests/test_bram.sh"
-                               "./techlibs/ice40/tests/test_ffs.sh"
-                               "./techlibs/xilinx/tests/bram1.sh"
-                               "./techlibs/xilinx/tests/bram2.sh"
-                               "./tests/bram/run-single.sh"
-                               "./tests/realmath/run-test.sh"
-                               "./tests/simple/run-test.sh"
-                               "./tests/techmap/mem_simple_4x1_runtest.sh"
-                               "./tests/tools/autotest.sh"
-                               "./tests/vloghtb/common.sh")
-                  (("if ! which iverilog") "if ! true")
-                  (("iverilog ") (string-append iverilog " "))
-                  (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
-                                                          iverilog "\""))))))
           (add-after 'install 'add-symbolic-link
             (lambda* (#:key inputs #:allow-other-keys)
               ;; Previously this package provided a copy of the "abc"
@@ -218,12 +201,17 @@ (define-public yosys
     (inputs
      (list abc
            graphviz
+           gtkwave
            libffi
            psmisc
            readline
            tcl
            xdot
-           z3))
+           z3
+           zlib))
+    (propagated-inputs
+     (list python
+           python-click))
     (home-page "https://yosyshq.net/yosys/")
     (synopsis "FPGA Verilog RTL synthesizer")
     (description "Yosys synthesizes Verilog-2005.")
-- 
2.39.1





Information forwarded to guix-patches <at> gnu.org:
bug#60429; Package guix-patches. (Sat, 11 Feb 2023 20:42:02 GMT) Full text and rfc822 format available.

Message #65 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Simon South <simon <at> simonsouth.net>
Cc: 60429-done <at> debbugs.gnu.org, guix-patches <at> gnu.org
Subject: Re: [bug#60429] [PATCH v3 0/5] gnu: yosys: Update to 0.24.
Date: Sat, 11 Feb 2023 20:38:02 +0000
[Message part 1 (text/plain, inline)]
Simon South <simon <at> simonsouth.net> writes:

> Here's a third revision of the remaining two patches in this series.  These
> updated patches now
>
> - Remove the remaining propagated inputs (abc and z3) from the yosys package
>   via changes to its "fix-paths" and "use-external-abc" phases, and
>
> - Update Yosys to version 0.26.

Thanks for the update, I made a tweak and pushed these to master as
8553148dfb91a9957b95c7bc6bc108cc0a973f9e.

> Note the second patch adds python and python-click as new propagated inputs.
> The Click library is needed by the "yosys-witness" command, and including both
> it and the Python interpreter in propagated-inputs is the only combination
> I've found that will cause Guix to set GUIX_PYTHONPATH appropriately on
> installation so this command can function.
>
> This appears to be supported by the Guix manual (in the sections "Search
> Paths" and "Python Modules") but if there's a better approach, please let me
> know.

I believe the good approach to do this is to wrap the relevant
script. I've gone ahead and changed the patch to do this rather than add
the propagated inputs. Do let me know if there's a problem with this
approach though, as I don't know how to test this software as well as
you.

Thanks again,

Chris
[signature.asc (application/pgp-signature, inline)]

Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Sat, 11 Feb 2023 20:42:02 GMT) Full text and rfc822 format available.

Notification sent to Simon South <simon <at> simonsouth.net>:
bug acknowledged by developer. (Sat, 11 Feb 2023 20:42:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 12 Mar 2023 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 46 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.