3 ;;; gEDA - GNU Electronic Design Automation
4 ;;; gnetlist - GNU Netlist
5 ;;; Copyright (C) 1998-2000 Ales V. Hvezda
7 ;;; This program is free software; you can redistribute it and/or modify
8 ;;; it under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 2 of the License, or
10 ;;; (at your option) any later version.
12 ;;; This program is distributed in the hope that it will be useful,
13 ;;; but 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.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with this program; if not, write to the Free Software
19 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 ;; Allegro netlist format
25 (define allegro:write-device-files
26 (lambda (packages done)
27 (if (not (null? packages))
28 (let ((device (get-device (car packages))))
29 (if (contains? done device)
30 (allegro:write-device-files (cdr packages) done)
32 (allegro:write-device device (car packages))
33 (allegro:write-device-files (cdr packages) (cons device done))))))))
35 (define allegro:write-device
36 (lambda (device package)
37 (let ((p (open-output-file (string-downcase! (string-append "devfiles/" (string-append device ".txt"))))))
38 (display "(Device File generated by gEDA Allegro Netlister)\n" p)
39 (display "PACKAGE " p)
40 (display (gnetlist:get-package-attribute package "footprint" )p)
43 (display (gnetlist:get-package-attribute package "class" )p)
45 (display "PINCOUNT " p)
46 (display (gnetlist:get-package-attribute package "pins" )p)
48 (let ((altfoot (gnetlist:get-package-attribute package "alt_foot")))
49 (if (not (string=? altfoot "unknown"))
51 (display "PACKAGEPROP ALT_SYMBOLS\n" p)
56 (close-output-port p))))
58 (define allegro:components
59 (lambda (port packages)
60 (if (not (null? packages))
62 (let ((footprint (gnetlist:get-package-attribute (car packages)
64 (package (car packages)))
65 (if (not (string=? footprint "unknown"))
66 (display footprint port))
68 (display (gnetlist:get-package-attribute package "device") port)
70 (display (get-component-text package) port)
72 (display package port)
74 (allegro:components port (cdr packages))))))
76 (define allegro:display-connections
78 (if (not (null? nets))
80 (write-char #\space port)
81 (display (car (car nets)) port)
83 (display (car (cdr (car nets))) port)
84 (if (null? (cdr nets))
89 (allegro:display-connections port (cdr nets))
92 (define allegro:write-net
93 (lambda (port netnames)
94 (if (not (null? netnames))
95 (let ((netname (car netnames)))
96 (display netname port)
98 (allegro:display-connections port (gnetlist:get-all-connections netname))
99 (allegro:write-net port (cdr netnames))))))
103 (let ((port (open-output-file filename)))
104 (display "(Allegro netlister by M. Ettus)\n" port)
105 (display "$PACKAGES\n" port)
106 (allegro:components port packages)
107 (display "$NETS\n" port)
108 (allegro:write-net port (gnetlist:get-all-unique-nets "dummy"))
109 (display "$END\n" port)
110 (close-output-port port)
111 (allegro:write-device-files packages '() ))))