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