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