Mail Archives: geda-help/2014/11/19/06:17:50
--=-QLRwZ47DYc1OpsmQmpna
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
I got and modified /usr/share/gEDA/scheme/gnet-xnf.scm from an older
version of geda, I modified the library xunified and added symbols and
subcircuits. I Could only verify on some circuits.
is it possible to insert those results for people who have licenses for
old xnf tools (and other FPGAs tools that can use xnf files [atmel
tools]) ?
I added a Zacwire (from www.zmdi.com/ ) interface for temperature
sensors(http://www.ist-ag.com/eh/ist-ag/resource.nsf/imgref/Download_ATTSic_E2.pdf/$FILE/ATTSic_E2.pdf).
would you recommend to use GPL license ? or other License for the
subcircuits library ?
are there other people trying to generate FPGA files from geda ?
thank you.
--=-QLRwZ47DYc1OpsmQmpna
Content-Disposition: attachment; filename="gnet-xnf.scm"
Content-Type: text/x-scheme; name="gnet-xnf.scm"; charset="UTF-8"
Content-Transfer-Encoding: 8bit
;;; Copyright (C) 2000 Stephen Williams <steve AT icarus DOT com>
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
; $Id: $
;; This source is a gnetlist extension that supports translating
;; schematic designs into XNF netlists for the consumption of the
;; Xilinx place&route tools. For this version to work, you need gEDA
;; software later then 15 April 2000, as getting pin attributes from
;; symbols doesn't work before then.
;; INSTALLATION
;; To install, copy this file (gnet-xnf.scm) into the scheme directory
;; for your gEDA installation. This is usually ``/usr/share/gEDA/scheme''.
;; You also need the associated library of Xilinx unified
;; devices. Make sure you install that library in a place where both
;; gschem and gnetlist can find it.
;;
;;
;; modified by Yves Sichez
(define EXTERN_ST #f)
(define xnf:write-header
(lambda (p)
(display "LCANET, 6" p)
(newline p)
(display "PROG, gnetlist, 0.0, \"gnetlist -o xnf\"" p)
(newline p)))
; Iterate over the components. The caller passes to this function a
; list of parts from the schematic. The parts are listed by their refdes
; value.
(define xnf:components
(lambda (port ls)
(if (not (null? ls))
(let ((refdes (car ls)))
(begin
(xnf:draw-refdes refdes port)
(xnf:components port (cdr ls)))))))
;(define xnf:COMPOSANT refdes)
(define xnf:COMPOSANT
(lambda (refdes) (gnetlist:get-package-attribute refdes "device")))
(define xnf:tri_composants_extern
(lambda (refdes)
( if (equal? (xnf:COMPOSANT refdes) "IPAD") (set! EXTERN_ST #t)
(if (equal? (xnf:COMPOSANT refdes) "OPAD") (set! EXTERN_ST #t)
(if (equal? (xnf:COMPOSANT refdes) "IOPAD") (set! EXTERN_ST #t)
(if (equal? (xnf:COMPOSANT refdes) "UPAD") (set! EXTERN_ST #t) (set! EXTERN_ST #f)))))
))
(define display-nl (lambda (X)
(begin
(display X)
(newline))))
; Given the refdes of a part, draw the SYM record and PIN records to
; connect the device around. The device type which goes into the SYM
; record is pulled from the device= attribute of the symbol.
(define xnf:draw-refdes
(lambda (refdes port)
(display-nl (gnetlist:get-package-attribute refdes "device"))
; pb :(define COMPOSANT (gnetlist:get-package-attribute refdes "device")
;(let (COMPOSANT (gnetlist:get-package-attribute refdes "device")) (display COMPOSANT))
;(if (equal? (xnf:COMPOSANT refdes) "IPAD") (display-nl "IPAD rencontré") (display "autre composant"))
(xnf:tri_composants_extern refdes)
(if (equal? EXTERN_ST #t) (display-nl "IPAD/OPAD/IOPAD ou UPAD rencontré") (display-nl "autre composant rencontré"))
(if (equal? EXTERN_ST #f) (begin
(display "SYM, " port)
(display refdes port)
(display ", " port)
(display (gnetlist:get-package-attribute refdes "device") port)
; Look for some standard attributes that I can attach to the
; symbol. The LIBVER attribute
(let ((loc (gnetlist:get-package-attribute refdes "LOC"))
(libver (gnetlist:get-package-attribute refdes "libver")))
(if (not (string=? loc "unknown"))
(begin (if (equal? EXTERN_ST #t) (display "," port)) (display ", LOC=" port)
(display loc port)))
(if (not (string=? libver "unknown"))
(begin (display ", LIBVER=" port)
(display libver port))))
(newline port)
(xnf:draw-refdes-pins refdes (gnetlist:get-pins refdes) port)
(display "END" port)
(newline port)) (begin
(display-nl "autre composant rencontré")
(display "EXT," port)
(xnf:draw-refdes-pins refdes (gnetlist:get-pins refdes) port)
))
))
(define xnf:draw-refdes-pins
(lambda (refdes pins port)
(if (not (null? pins))
(let ((pin (car pins)))
(begin
(xnf:draw-refdes-pin refdes pin port)
(xnf:draw-refdes-pins refdes (cdr pins) port))))))
; Given a pin name, draw the pin record for the refdes. The pin name is
; the XNF name that gnetlist got from the pin#= attribute. We assume
; here that pin name is the XNF name for that refdes, so we just need
; to write it out.
(define xnf:draw-refdes-pin
(lambda (refdes pin port)
; (let ((type (gnetlist:get-pin-attribute refdes pin "type"))) remplacé par:
;passe avec: (let ((type "IN"))
;remplacé par :
; (let ((type (gnetlist:get-uref "type"))) pour trouver refdes ou uref pour désigner composant ==> pas correct
; (let ((type (get-attrib-value-by-attrib-name pin "type")))
;
; (let ((type "IN"))
;(let ((type (gnetlist:get-pin-attribute refdes pin "pintype")))(gnetlist:get-attribute-by-pinnumber uref pin "port_mode")
(let ((type (gnetlist:get-attribute-by-pinnumber refdes pin "pintype")))
(begin
;(define pinname (gnetlist:get-attribute-by-pinnumber refdes pin "pinlabel"))
(if (equal? EXTERN_ST #f) (display "PIN, " port))
(if (equal? EXTERN_ST #t) (begin (display (car (gnetlist:get-nets refdes pin)) port) (display ", " port)))
(if (equal? EXTERN_ST #f) (begin (display (gnetlist:get-attribute-by-pinnumber refdes pin "pinlabel") port)
(display ", " port)))
(if (string=? type "IN") (display "I, " port)
(if (string=? type "OUT") (display "O, " port)
(if (string=? type "I/O") (display "B, " port)
(if (string=? type "TRI") (display "T, " port)
(if (string=? type "BIDIR") (display "B, " port)
(if (string=? type "UNBOUNDED") (display "U, " port) ))))))
(if (equal? EXTERN_ST #f) (display (car (gnetlist:get-nets refdes pin)) port))
(if (equal? EXTERN_ST #t) (begin
(let ((loc (gnetlist:get-package-attribute refdes "LOC")))
(if (not (string=? loc "unknown"))
(begin (if (equal? EXTERN_ST #t) (display "," port)) (display " LOC=" port)
(display loc port)))))
)
; ajout:
; (xnf:cherche-attributs-pin pin port)
(newline port)))))
; fonction cherche-attribut-pin
; définie le 22 05 2013 par ys pour remplacer (gnetlist:get-pin-attribute refdes pin "type")
;
(define xnf:cherche-attributs-pin
(lambda (pin port)
(display "*************ajout**************" port)
(display (get-attrib-value-by-attrib-name pin "type") port)
(display (get-attrib-value-by-attrib-name pin "pinlabel") port)
(define type "IN")
))
;
;
(define xnf:write-footer
(lambda (p)
(display "EOF" p)
(newline p)))
(define xnf
(lambda (output-filename)
(let ((port (open-output-file output-filename)))
(begin
(xnf:write-header port)
; Catch PART attributes on the schematic.
(let ((part (gnetlist:get-toplevel-attribute "PART")))
(if (not (string=? part "unknown"))
(begin (display "PART," port)
(display part port)
(newline port))))
(xnf:components port packages)
(xnf:write-footer port))
(close-output-port port))))
; $Log: $
--=-QLRwZ47DYc1OpsmQmpna--
- Raw text -