[PATCH 0/5] gnu: yosys: Update to 0.24.

  • Done
  • quality assurance status badge
Details
3 participants
  • Liliana Marie Prikler
  • Christopher Baines
  • Simon South
Owner
unassigned
Submitted by
Simon South
Severity
normal
S
S
Simon South wrote on 30 Dec 2022 16:58
(address . guix-patches@gnu.org)
cover.1672412713.git.simon@simonsouth.net
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:


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

--
Simon South
simon@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
S
S
Simon South wrote on 30 Dec 2022 17:00
[PATCH 1/5] gnu: yosys: Update source and home-page URLs.
(address . 60429@debbugs.gnu.org)
42363f6bff2eea2b49eb7058cf03eda11fd79131.1672412713.git.simon@simonsouth.net
* 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(-)

Toggle diff (24 lines)
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
S
S
Simon South wrote on 30 Dec 2022 17:00
[PATCH 3/5] gnu: yosys: Use external abc.
(address . 60429@debbugs.gnu.org)
3860fcf9632f6c9bbc7c3eb4359a28277f8d0683.1672412713.git.simon@simonsouth.net
* 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(-)

Toggle diff (75 lines)
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
S
S
Simon South wrote on 30 Dec 2022 17:00
[PATCH 2/5] gnu: yosys: Use new package style.
(address . 60429@debbugs.gnu.org)
a9b9c4a0d2c4c22ed964c674bc94d7eed7eda6a6.1672412713.git.simon@simonsouth.net
* 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(-)

Toggle diff (144 lines)
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
S
S
Simon South wrote on 30 Dec 2022 17:00
[PATCH 4/5] gnu: yosys: Propagate external dependencies.
(address . 60429@debbugs.gnu.org)
477fccd0f411dc2e6cccd91106116e6d71fc58f9.1672412713.git.simon@simonsouth.net
* 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(-)

Toggle diff (43 lines)
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
S
S
Simon South wrote on 30 Dec 2022 17:00
[PATCH 5/5] gnu: yosys: Update to 0.24.
(address . 60429@debbugs.gnu.org)
67ee629dc59d691f639ad436935091d26bbf4aec.1672412713.git.simon@simonsouth.net
* 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(-)

Toggle diff (71 lines)
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
S
S
Simon South wrote on 8 Jan 2023 19:31
[PATCH v2 0/5] gnu: yosys: Update to 0.24.
(address . 60429@debbugs.gnu.org)
cover.1673202235.git.simon@simonsouth.net
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:


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

--
Simon South
simon@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
S
S
Simon South wrote on 8 Jan 2023 19:31
[PATCH v2 3/5] gnu: yosys: Use external abc.
(address . 60429@debbugs.gnu.org)
5ab17e11b0670fff010bc169218f60f89e37df0c.1673202235.git.simon@simonsouth.net
* 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(-)

Toggle diff (75 lines)
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
S
S
Simon South wrote on 8 Jan 2023 19:31
[PATCH v2 1/5] gnu: yosys: Update source and home-page URLs.
(address . 60429@debbugs.gnu.org)
b6c836918f1fd6fb965ea08f44223e5c623948d3.1673202235.git.simon@simonsouth.net
* 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(-)

Toggle diff (24 lines)
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
S
S
Simon South wrote on 8 Jan 2023 19:31
[PATCH v2 4/5] gnu: yosys: Propagate external dependencies.
(address . 60429@debbugs.gnu.org)
62b19db61f34b63e37ba204fd9691b97d5c245bb.1673202235.git.simon@simonsouth.net
* 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(-)

Toggle diff (43 lines)
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
S
S
Simon South wrote on 8 Jan 2023 19:31
[PATCH v2 2/5] gnu: yosys: Use new package style.
(address . 60429@debbugs.gnu.org)
b0e94191c8dc07e894b57ebbe66941613c2d9d24.1673202235.git.simon@simonsouth.net
* 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(-)

Toggle diff (144 lines)
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
S
S
Simon South wrote on 8 Jan 2023 19:31
[PATCH v2 5/5] gnu: yosys: Update to 0.25.
(address . 60429@debbugs.gnu.org)
69832a7e061412efc3ef6b0148815534a513b28d.1673202235.git.simon@simonsouth.net
* 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(-)

Toggle diff (71 lines)
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
C
C
Christopher Baines wrote on 8 Feb 2023 18:14
Re: [bug#60429] [PATCH v2 4/5] gnu: yosys: Propagate external dependencies.
(name . Simon South)(address . simon@simonsouth.net)
87357g6pfz.fsf@cbaines.net
Simon South <simon@simonsouth.net> writes:

Toggle quote (51 lines)
> * 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
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmPj2rBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xfbog/+IEgcaWo8mnj6zY6uN1a4HiLzXXMcb6DF
O4q0IVYWpN3YH4TvFKmrROZ5A0yRr48ATnG3lrxX/WlAxwsPCxysflz4x3sITvP1
yfgyTsxW+i0Ep6BjkvCa6Sr7Gnb72imPU14nnKDLdaPhk3zA9KXY2aGQ8lpnvWMS
Nq+/PyPVADzaTL6cwbzuoVYtCOaba6v9WoUepgMIPw4n9BgsTbKdEami5Uz4im3i
4nNTgchvT0WdZnTAZNUyIdMooeuAjdSTogaypDC7sXSJapMcCLZv1F9RsoinXh1B
gwutVJnV3kmNnmRi4KV/I8YM8YruhR7zd5atyorXTEfLeGKxUhxIQtSRfRCGC4kx
86eDw5pRDVdjRZ9zTUSQ1MkBZGp0qcpk9Of6s/7HWgcVYDO0Z8gGRHG0ZTIzmh30
tIROonm5QhAFGAGNhfrbJGfkcS0ZiqVBoZQg/I4VByEuDxti4ZW7OCQ6Dtgm9xOP
VIF05xj9p4X5NsD8N4o1ocxjhAM144YViQ2THYHqbarm/g9zVkTV+TTR5NbHmscz
NA/KhYRAXKQN6cNUV84iarg6Vwt5gbmcIOYEZBf5WIUsadr+qWidguKw7atXz/uP
Qik07oK3nJhR+6EPOKJM1LNHyjtNopG5HuF/qHtw+g9dOg4aoUOskNmsnPxedBSW
bbZGdL89X/o=
=rYkZ
-----END PGP SIGNATURE-----

S
S
Simon South wrote on 9 Feb 2023 01:35
(name . Christopher Baines)(address . mail@cbaines.net)(address . 60429@debbugs.gnu.org)
87v8kb7k19.fsf@simonsouth.net
Christopher Baines <mail@cbaines.net> writes:
Toggle quote (3 lines)
> Thanks Simon, I've pushed the first 3 patches from this series to the
> master branch now.

Nice, thank you.

Toggle quote (4 lines)
> 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@simonsouth.net

L
L
Liliana Marie Prikler wrote on 9 Feb 2023 06:29
(address . 60429@debbugs.gnu.org)
a9a131b4467300c12ff6f20722cd895ac3636995.camel@gmail.com
Am Mittwoch, dem 08.02.2023 um 19:35 -0500 schrieb Simon South:
Toggle quote (24 lines)
> 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
S
S
Simon South wrote on 9 Feb 2023 17:47
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
87zg9meqgn.fsf@simonsouth.net
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
Toggle quote (2 lines)
> 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@simonsouth.net
S
S
Simon South wrote on 10 Feb 2023 14:16
[PATCH v3 0/5] gnu: yosys: Update to 0.24.
(address . 60429@debbugs.gnu.org)
cover.1676033083.git.simon@simonsouth.net
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@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
S
S
Simon South wrote on 10 Feb 2023 14:16
[PATCH v3 4/5] gnu: yosys: Do not propagate any inputs.
(address . 60429@debbugs.gnu.org)
2341e855934118580304aaf92195878fc6c71dff.1676033083.git.simon@simonsouth.net
* 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(-)

Toggle diff (50 lines)
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
S
S
Simon South wrote on 10 Feb 2023 14:16
[PATCH v3 5/5] gnu: yosys: Update to 0.26.
(address . 60429@debbugs.gnu.org)
86a0feb6df92cf2765408198627925e6fd88decd.1676033083.git.simon@simonsouth.net
* 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(-)

Toggle diff (86 lines)
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
C
C
Christopher Baines wrote on 11 Feb 2023 21:38
Re: [bug#60429] [PATCH v3 0/5] gnu: yosys: Update to 0.24.
(name . Simon South)(address . simon@simonsouth.net)
878rh453zz.fsf@cbaines.net
Simon South <simon@simonsouth.net> writes:

Toggle quote (8 lines)
> 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.

Toggle quote (10 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmPn/YBfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh
aW5lcy5uZXQACgkQXiijOwuE9Xdqgw//ScUtuC3TP42e1Qih3uI68jDjING2Rs9M
PMbMt8TY3mX+keMluiO8hDJiPBha+NTjWe+9ntcqAaddYa3WRzgEL3XPYWgJcW+/
bO0Fgpl7beRK68KgxU+e/BR1ijwY9DBA5mjBNhzp9r3iTt6xpZ//CeiMKedkoC/n
TQjtB9jfxnWSTNO6r2LDxo6yn4C/YUsg7EnR0dMr4Ah+SaKwkomqPpZBa6b8CxYA
NkCARmS2xnFBGpsa3idAvA7GNDMlLXvrkXqVuK6AuIcRZ/1EF5sm8RE3RQbrAjag
nwB2QcyMXEAfz27+SVN5HIKBzxnLuC77PUja6PmLhLeuuroW4I1PAX3GYG6bITFD
9xtHx4s34ybAyM4CDWY2I7x9VxBPHmAu5fLdXi7ji1QOweHnAyIDDqefbE7F8XB/
cpLYyE0p9vFOsngR/jtqfwJ16C8SxgxECaHywkmSxO1hiaRdBT54t1VkH+mMU6XK
eguY/NAWSxtl0K6tR6PN1l0/zeCbtyNzakO0bOzwgFj1DXmPGhZz3OFPGujCHHSI
vPf9d9qRutz3BbK3obzxPY5ocGPOE+Nz8f+Ekh7CxL+2JxFkdZBJd1dWB8z/j9Pm
x1U90IZO5XCVTKI9m501CPsjOjeEPDgPvu9S9HjA5L0/I0fPQJnUckayebXgL/OS
EVT1R/iNC4Y=
=mZDd
-----END PGP SIGNATURE-----

?