1 ;;; gEDA - GPL Electronic Design Automation
2 ;;; gnetlist - gEDA Netlist
3 ;;; Copyright (C) 1998-2007 Ales Hvezda
4 ;;; Copyright (C) 1998-2007 gEDA Contributors (see ChangeLog for details)
6 ;;; This program is free software; you can redistribute it and/or modify
7 ;;; it under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 2 of the License, or
9 ;;; (at your option) any later version.
11 ;;; This program is distributed in the hope that it will be useful,
12 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with this program; if not, write to the Free Software
18 ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 ;; --------------------------------------------------------------------------
23 ;; DRC backend written by Matt Ettus starts here
26 ;; DRC rules format: (list (part rules) (net rules) (pin rules))
27 ;; Part rules: List of predicates of one variable, uref
28 ;; Net rules: List of predicates of one variable, net name
29 ;; Pin Rules: List of predicates of 2 variables, uref and pin number
31 (define drc:parseconfig
33 (let ((read-from-file (read port)))
34 (if (not (eof-object? read-from-file))
35 (cons (symbol->string read-from-file) (drc:parseconfig port))
38 (define drc:attriblist
40 (open-input-file "attribs")))
43 (lambda (output-filename)
44 (let ((port (open-output-file output-filename)))
45 (drc:device-rules drc:attriblist packages port)
46 (drc:net-rules (gnetlist:get-all-unique-nets "dummy") port)
47 (drc:pin-rules packages port)
48 (close-output-port port))))
55 ((null? (gnetlist:get-all-connections (car nets)))
58 (display (car nets) port)
59 (display " has no connected pins\n" port)
60 (drc:net-rules (cdr nets) port)
62 ((null? (cdr (gnetlist:get-all-connections (car nets))))
65 (display (car nets) port)
66 (display " has only 1 connected pin\n" port)
67 (drc:net-rules (cdr nets) port)
69 (#t (drc:net-rules (cdr nets) port)))))
72 (lambda(packages port)
75 (define drc:device-rules
76 (lambda (attriblist packages port)
77 (if (not (null? packages))
79 (drc:has-attributes? attriblist (car packages) port)
80 (drc:device-rules attriblist (cdr packages) port)))))
82 (define drc:has-attributes?
83 (lambda (attriblist uref port)
84 (if (not (null? attriblist))
86 (if (string=? "unknown" (gnetlist:get-package-attribute uref (car attriblist)))
89 (display " Does not have attribute: " port)
90 (display (car attriblist) port)
92 (drc:has-attributes? (cdr attriblist) uref port)))))
96 ;; DRC backend written by Matt Ettus ends here
98 ;; --------------------------------------------------------------------------