Attached is a netlister I wrote to generate xilinx UCF (pinout) files from a schematic. All pins on the FPGA which are of type "in", "io", or "clk" are included, and are named by the name of the net attached. Power pins are ignored.
Current limitations -- - Assumes U1 is your fpga. I don't know how to parse command line args from a netlister, but if you can, this could easily be fixed. Any suggestions? - JTAG pins get included, since they are of type in or io. These should probably be filtered out somehow. - No string processing is done to convert "dacout12" or "dacout_12" to "dacout[12]" since I don't know how best to do this in guile. Cool enhancements once the above limitations are fixed would include: - automatically handling diff pairs - reading net properties for things like signaling standard and drive strength I hope someone finds this useful. Please feel free to add it to the project. Matt
;; Copyright 2009, Matt Ettus, m...@ettus.com ;; Released under the GPL (use-modules (ice-9 rdelim)) ;; guile-1.8 fix (define ucf (lambda (output-filename) (let ((port (if (string=? "-" output-filename) (current-output-port) (open-output-file output-filename)))) (ucf:print-entries (ucf:list-of-entries "U1") port) ))) (define ucf:print-entries (lambda (ls port) (if (null? ls) (newline port) (begin (if (car ls) (begin (display "NET \"" port) (display (cdar ls) port) (display "\" LOC = \"" port) (display (caar ls) port) (display "\" ;" port) (newline port))) (ucf:print-entries (cdr ls) port))))) (define ucf:list-of-entries (lambda (pkg) (map (lambda(pin) (ucf:ucf-entry "U1" pin)) (gnetlist:get-pins "U1")))) (define ucf:ucf-entry (lambda (pkg pin) (if (ucf:put-in-ucf? pkg pin) (cons pin (ucf:get-my-net pkg pin)) #f;'() ))) (define ucf:put-in-ucf? (lambda (pkg pin) (let ((type (gnetlist:get-attribute-by-pinnumber pkg pin "pintype"))) (and (ucf:connected? pkg pin) (or (string=? "io" type) (string=? "in" type) (string=? "clk" type)))))) (define ucf:connected? (lambda (pkg pin) (if (strncmp? "unconnected" (ucf:get-my-net pkg pin) 11) #f #t))) (define ucf:get-my-net (lambda (pkg pin) (car (gnetlist:get-nets pkg pin)))) (define ucf:printlist (lambda (ls port) (if (null? ls) (newline port) (begin (display (car ls) port) (write-char #\tab port) (ucf:printlist (cdr ls) port)))))
_______________________________________________ geda-dev mailing list geda-dev@moria.seul.org http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev