build-system/r: Update to Bioconductor 3.7.
[jackhill/guix/guix.git] / gnu / packages / fpga.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
3 ;;; Copyright © 2016, 2017 Theodoros Foradis <theodoros@foradis.org>
4 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages fpga)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (guix download)
25 #:use-module (guix git-download)
26 #:use-module (guix build-system gnu)
27 #:use-module (guix build-system cmake)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages pkg-config)
31 #:use-module (gnu packages tcl)
32 #:use-module (gnu packages readline)
33 #:use-module (gnu packages python)
34 #:use-module (gnu packages bison)
35 #:use-module (gnu packages flex)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages graphviz)
38 #:use-module (gnu packages libffi)
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages maths)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages ghostscript)
43 #:use-module (gnu packages gperf)
44 #:use-module (gnu packages gawk)
45 #:use-module (gnu packages version-control)
46 #:use-module (gnu packages libftdi))
47
48 (define-public abc
49 (let ((commit "5ae4b975c49c")
50 (revision "1"))
51 (package
52 (name "abc")
53 (version (string-append "0.0-" revision "-" (string-take commit 9)))
54 (source (origin
55 (method url-fetch)
56 (uri
57 (string-append "https://bitbucket.org/alanmi/abc/get/" commit ".zip"))
58 (file-name (string-append name "-" version "-checkout.zip"))
59 (sha256
60 (base32
61 "1syygi1x40rdryih3galr4q8yg1w5bvdzl75hd27v1xq0l5bz3d0"))))
62 (build-system gnu-build-system)
63 (native-inputs
64 `(("unzip" ,unzip)))
65 (inputs
66 `(("readline" ,readline)))
67 (arguments
68 `(#:tests? #f ; no check target
69 #:phases
70 (modify-phases %standard-phases
71 (delete 'configure)
72 (replace 'install
73 (lambda* (#:key outputs #:allow-other-keys)
74 (let* ((out (assoc-ref outputs "out"))
75 (out-bin (string-append out "/bin")))
76 (install-file "abc" out-bin)))))))
77 (home-page "http://people.eecs.berkeley.edu/~alanmi/abc/")
78 (synopsis "Sequential logic synthesis and formal verification")
79 (description "ABC is a program for sequential logic synthesis and
80 formal verification.")
81 (license
82 (license:non-copyleft "https://fedoraproject.org/wiki/Licensing:MIT#Modern_Variants")))))
83
84 (define-public iverilog
85 (package
86 (name "iverilog")
87 (version "10.2")
88 (source (origin
89 (method url-fetch)
90 (uri
91 (string-append "ftp://ftp.icarus.com/pub/eda/verilog/v10/"
92 "verilog-" version ".tar.gz"))
93 (sha256
94 (base32
95 "0075x5nsxwkrgn7b3635il9kw7mslckaji518pdmwdrdn7fxppln"))))
96 (build-system gnu-build-system)
97 (native-inputs
98 `(("flex" ,flex)
99 ("bison" ,bison)
100 ("ghostscript" ,ghostscript))) ; ps2pdf
101 (home-page "http://iverilog.icarus.com/")
102 (synopsis "FPGA Verilog simulation and synthesis tool")
103 (description "Icarus Verilog is a Verilog simulation and synthesis tool.
104 It operates as a compiler, compiling source code written in Verilog
105 (IEEE-1364) into some target format.
106 For batch simulation, the compiler can generate an intermediate form
107 called vvp assembly.
108 This intermediate form is executed by @command{vvp}.
109 For synthesis, the compiler generates netlists in the desired format.")
110 ;; GPL2 only because of:
111 ;; - ./driver/iverilog.man.in
112 ;; - ./iverilog-vpi.man.in
113 ;; - ./tgt-fpga/iverilog-fpga.man
114 ;; - ./vvp/vvp.man.in
115 ;; Otherwise would be GPL2+.
116 ;; You have to accept both GPL2 and LGPL2.1+.
117 (license (list license:gpl2 license:lgpl2.1+))))
118
119 (define-public yosys
120 (package
121 (name "yosys")
122 (version "0.7")
123 (source (origin
124 (method url-fetch)
125 (uri
126 (string-append "https://github.com/cliffordwolf/yosys/archive/"
127 name "-" version ".tar.gz"))
128 (sha256
129 (base32
130 "0vkfdn4phvkjqlnpqlr6q5f97bgjc3312vj5jf0vf85zqv88dy9x"))
131 (file-name (string-append name "-" version "-checkout.tar.gz"))
132 (modules '((guix build utils)))
133 (snippet
134 '(substitute* "Makefile"
135 (("ABCREV = .*") "ABCREV = default\n")))))
136 (build-system gnu-build-system)
137 (arguments
138 `(#:test-target "test"
139 #:make-flags (list "CC=gcc"
140 "CXX=g++"
141 (string-append "PREFIX=" %output))
142 #:phases
143 (modify-phases %standard-phases
144 (add-before 'configure 'fix-paths
145 (lambda _
146 (substitute* "./passes/cmds/show.cc"
147 (("exec xdot") (string-append "exec " (which "xdot")))
148 (("dot -") (string-append (which "dot") " -"))
149 (("fuser") (which "fuser")))
150 #t))
151 (replace 'configure
152 (lambda* (#:key inputs (make-flags '()) #:allow-other-keys)
153 (zero? (apply system* "make" "config-gcc" make-flags))))
154 (add-after 'configure 'prepare-abc
155 (lambda* (#:key inputs #:allow-other-keys)
156 (let* ((sourceabc (assoc-ref inputs "abc"))
157 (sourcebin (string-append sourceabc "/bin"))
158 (source (string-append sourcebin "/abc")))
159 (mkdir-p "abc")
160 (call-with-output-file "abc/Makefile"
161 (lambda (port)
162 (format port ".PHONY: all\nall:\n\tcp -f abc abc-default\n")))
163 (copy-file source "abc/abc")
164 (zero? (system* "chmod" "+w" "abc/abc")))))
165 (add-before 'check 'fix-iverilog-references
166 (lambda* (#:key inputs native-inputs #:allow-other-keys)
167 (let* ((xinputs (or native-inputs inputs))
168 (xdirname (assoc-ref xinputs "iverilog"))
169 (iverilog (string-append xdirname "/bin/iverilog")))
170 (substitute* '("./manual/CHAPTER_StateOfTheArt/synth.sh"
171 "./manual/CHAPTER_StateOfTheArt/validate_tb.sh"
172 "./techlibs/ice40/tests/test_bram.sh"
173 "./techlibs/ice40/tests/test_ffs.sh"
174 "./techlibs/xilinx/tests/bram1.sh"
175 "./techlibs/xilinx/tests/bram2.sh"
176 "./tests/bram/run-single.sh"
177 "./tests/realmath/run-test.sh"
178 "./tests/simple/run-test.sh"
179 "./tests/techmap/mem_simple_4x1_runtest.sh"
180 "./tests/tools/autotest.sh"
181 "./tests/vloghtb/common.sh")
182 (("if ! which iverilog") "if ! true")
183 (("iverilog ") (string-append iverilog " "))
184 (("iverilog_bin=\".*\"") (string-append "iverilog_bin=\""
185 iverilog "\"")))
186 #t))))))
187 (native-inputs
188 `(("pkg-config" ,pkg-config)
189 ("python" ,python)
190 ("bison" ,bison)
191 ("flex" ,flex)
192 ("gawk" , gawk) ; for the tests and "make" progress pretty-printing
193 ("tcl" ,tcl) ; tclsh for the tests
194 ("iverilog" ,iverilog))) ; for the tests
195 (inputs
196 `(("tcl" ,tcl)
197 ("readline" ,readline)
198 ("libffi" ,libffi)
199 ("graphviz" ,graphviz)
200 ("psmisc" ,psmisc)
201 ("xdot" ,xdot)
202 ("abc" ,abc)))
203 (propagated-inputs
204 `(("z3" ,z3))) ; should be in path for yosys-smtbmc
205 (home-page "http://www.clifford.at/yosys/")
206 (synopsis "FPGA Verilog RTL synthesizer")
207 (description "Yosys synthesizes Verilog-2005.")
208 (license license:isc)))
209
210 (define-public icestorm
211 (let ((commit "12b2295c9087d94b75e374bb205ae4d76cf17e2f")
212 (revision "1"))
213 (package
214 (name "icestorm")
215 (version (string-append "0.0-" revision "-" (string-take commit 9)))
216 (source (origin
217 (method git-fetch)
218 (uri (git-reference
219 (url "https://github.com/cliffordwolf/icestorm.git")
220 (commit commit)))
221 (file-name (string-append name "-" version "-checkout"))
222 (sha256
223 (base32
224 "1mmzlqvap6w8n4qzv3idvy51arkgn03692ssplwncy3akjrbsd2b"))))
225 (build-system gnu-build-system)
226 (arguments
227 `(#:tests? #f ; no unit tests that don't need an FPGA exist.
228 #:make-flags (list "CC=gcc" "CXX=g++"
229 (string-append "PREFIX=" (assoc-ref %outputs "out")))
230 #:phases
231 (modify-phases %standard-phases
232 (add-after 'unpack 'remove-usr-local
233 (lambda _
234 (substitute* "iceprog/Makefile"
235 (("-I/usr/local/include") "")
236 (("-L/usr/local/lib") ""))
237 #t))
238 (add-after 'remove-usr-local 'fix-usr-local
239 (lambda* (#:key outputs #:allow-other-keys)
240 (substitute* "icebox/icebox_vlog.py"
241 (("/usr/local/share") (string-append (assoc-ref outputs "out") "/share")))
242 #t))
243 (delete 'configure))))
244 (inputs
245 `(("libftdi" ,libftdi)))
246 (native-inputs
247 `(("python-3" ,python)
248 ("pkg-config" ,pkg-config)))
249 (home-page "http://www.clifford.at/icestorm/")
250 (synopsis "Project IceStorm - Lattice iCE40 FPGAs bitstream tools")
251 (description "Project IceStorm - Lattice iCE40 FPGAs Bitstream Tools.
252 Includes the actual FTDI connector.")
253 (license license:isc))))
254
255 (define-public arachne-pnr
256 (let ((commit "52e69ed207342710080d85c7c639480e74a021d7")
257 (revision "1"))
258 (package
259 (name "arachne-pnr")
260 (version (string-append "0.0-" revision "-" (string-take commit 9)))
261 (source (origin
262 (method git-fetch)
263 (uri (git-reference
264 (url "https://github.com/cseed/arachne-pnr.git")
265 (commit commit)))
266 (file-name (string-append name "-" version "-checkout"))
267 (sha256
268 (base32
269 "15bdw5yxj76lxrwksp6liwmr6l1x77isf4bs50ys9rsnmiwh8c3w"))))
270 (build-system gnu-build-system)
271 (arguments
272 `(#:test-target "test"
273 #:phases (modify-phases %standard-phases
274 (replace 'configure
275 (lambda* (#:key outputs inputs #:allow-other-keys)
276 (substitute* '("Makefile")
277 (("DESTDIR = .*") (string-append "DESTDIR = "
278 (assoc-ref outputs "out")
279 "\n"))
280 (("ICEBOX = .*") (string-append "ICEBOX = "
281 (assoc-ref inputs "icestorm")
282 "/share/icebox\n")))
283 (substitute* '("./tests/fsm/generate.py"
284 "./tests/combinatorial/generate.py")
285 (("#!/usr/bin/python") "#!/usr/bin/python2"))
286 #t)))))
287 (inputs
288 `(("icestorm" ,icestorm)))
289 (native-inputs
290 `(("git" ,git) ; for determining its own version string
291 ("yosys" ,yosys) ; for tests
292 ("perl" ,perl) ; for shasum
293 ("python-2" ,python-2))) ; for tests
294 (home-page "https://github.com/cseed/arachne-pnr")
295 (synopsis "Place-and-Route tool for FPGAs")
296 (description "Arachne-PNR is a Place-and-Route Tool For FPGAs.")
297 (license license:gpl2))))
298
299 (define-public gtkwave
300 (package
301 (name "gtkwave")
302 (version "3.3.76")
303 (source (origin
304 (method url-fetch)
305 (uri (string-append "http://gtkwave.sourceforge.net/"
306 name "-" version ".tar.gz"))
307 (sha256
308 (base32
309 "1vlvavszb1jwwiixiagld88agjrjg0ix8qa4xnxj4ziw0q87jbmn"))))
310 (build-system gnu-build-system)
311 (native-inputs
312 `(("gperf" ,gperf)
313 ("pkg-config" ,pkg-config)))
314 (inputs
315 `(("tcl" ,tcl)
316 ("tk" ,tk)
317 ("gtk+-2" ,gtk+-2)))
318 (arguments
319 `(#:configure-flags
320 (list (string-append "--with-tcl="
321 (assoc-ref %build-inputs "tcl")
322 "/lib")
323 (string-append "--with-tk="
324 (assoc-ref %build-inputs "tk")
325 "/lib"))))
326
327 (synopsis "Waveform viewer for FPGA simulator trace files")
328 (description "This package is a waveform viewer for FPGA
329 simulator trace files (FST).")
330 (home-page "http://gtkwave.sourceforge.net/")
331 ;; Exception against free government use in tcl_np.c and tcl_np.h
332 (license (list license:gpl2+ license:expat license:tcl/tk))))