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

  • Open
  • 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 19:31 +0100
[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 19:31 +0100
[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 19:31 +0100
[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 19:31 +0100
[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 19:31 +0100
[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 19:31 +0100
[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 15 hours ago
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 8 hours ago
(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 3 hours ago
(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
?