[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: Defining parts with REALLY complicated pin labels
- To: geda-user@xxxxxxxx
 
- Subject: Re: gEDA-user: Defining parts with REALLY complicated pin labels
 
- From: Mike Jarabek <mjarabek@xxxxxxxxx>
 
- Date: Thu, 18 Aug 2005 15:15:10 -0400
 
- Delivered-to: archiver@seul.org
 
- Delivered-to: geda-user-outgoing@seul.org
 
- Delivered-to: geda-user@seul.org
 
- Delivery-date: Thu, 18 Aug 2005 15:15:39 -0400
 
- References: <4303E87E.1090801@sktc.net>
 
- Reply-to: geda-user@xxxxxxxx
 
- Sender: owner-geda-user@xxxxxxxx
 
- User-agent: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.0.1) Gecko/20020920 Netscape/7.0
 
Hi,
David D. Hagood wrote:
<SNIP>
Lastly - and this is truly blue-sky dreaming - I have an 
infrastructural question: Given a part like a PIC, would it be 
possible to create some form of scripted part (in Scheme) that would 
allow the user to select what the functions of the pins were, and then 
create the appropriate labels for them, and possibly even emit the 
register setups for the part? It seems to me that this would really 
help make a multifunction part like a PIC pass DRC, as then the device 
could be tailored to the exact setup - inputs could be really marked 
as inputs, output as outputs, etc.
I thought about this a bit and came up with this Proof of Concept 
written in (for no particular reason, and not prejudicing any future 
choice of language. ;-) tcl/tk, that allows the selection of a 
`Function' for each pin, then outputs a `gmk_sym' compatible text file. 
(Just the basics, nothing fancy)
I have hard coded knowlege of the structure of the device into this 
application, so it's not really scalable, I would imagine that gmk_sym, 
or a relative could be extended to include some kind of selection and 
load/save of settings.
To try this out:
1) Run `./pic16f688.tcl' and select the how you want the pins named
2) Click on `Write File', this writes `pic16f688.txt' to the current 
directory
3) run `gmk_sym pic16f688.txt >pic16f688.sym'
4) run `gschem pic16f688.sym' to view the results.
Is this the kind of direction you are thinking about?  Are you thinking 
of something more integrated into gschem?
Mike
--
--------------------------------------------------
                             Mike Jarabek
                               FPGA/ASIC Designer
http://www.istop.com/~mjarabek
--------------------------------------------------
#!/bin/sh
# the next line restarts using wish \
exec wish8.4 "$0" "$@"
proc make_pin {name function_list row} {
    global $name
    set winname [format ".%s" $name]
    set labelname [format "%slabel" $winname]
    # Label the pin
    label $labelname -text [format "%s:" $name]
    grid $labelname -row $row -column 0 -sticky e
    set i 1
    foreach {function} $function_list { 
	set radioname [format "%sfn%d" $winname $i]
	radiobutton $radioname -text $function -variable $name -value $function
	if {$i == 1} { $radioname select }
	grid $radioname -row $row -column $i -sticky w
	incr i
    }
}
proc all_done {} {
    set ofile [open "pic16f688.txt" w]
    # Write header
    puts $ofile ";; pic16f688.txt"
    puts $ofile "PIC16f688,PIC16F688,tl,5,9"
    puts $ofile "VDD,1,line,T,4"
    puts $ofile "VSS,14,line,B,4"
    for {set i 2} {$i<8} {incr i} {
	set name [format "pin%d" $i]
	global $name
	set pin [set $name]
	if {[string first "/" $pin 0] } then {
	    set type "line" 
	} else {
	    set type "dot"
	}
	puts $ofile [format "%s,%d,%s,L,%d" $pin $i $type $i]
    }
    for {set i 8} {$i<14} {incr i} {
	set name [format "pin%d" $i]
	global $name
	set pin [set $name]
	if {[string first "/" $pin 0] } then {
	    set type "line" 
	} else {
	    set type "dot"
	}
	puts $ofile [format "%s,%d,%s,R,%d" $pin $i $type [expr 15 - $i]]
    }
    close $ofile
}
make_pin "pin2" {"RA5" "T1CKI" "OSC1" "CLKIN"} 0
make_pin "pin3" {"RA4" "AN3" "/T1G" "OSC2" "CLKOUT"} 1
make_pin "pin4" {"RA3" "/MCLR" "VPP"} 2
make_pin "pin5" {"RC5" "RX" "DT"} 3
make_pin "pin6" {"RC4" "C2OUT" "TX" "CK"} 4
make_pin "pin7" {"RC3" "AN7"} 5
make_pin "pin8" {"RC2" "AN6"} 6
make_pin "pin9" {"RC1" "AN5" "C2IN-"} 7
make_pin "pin10" {"RC0" "AN4" "C2IN+"} 8
make_pin "pin11" {"RA2" "AN2" "T0CKI" "INT" "C1OUT"} 9
make_pin "pin12" {"RA1" "AN1" "C1IN-" "VREF" "ICSPCLK" } 10 
make_pin "pin13" {"RA0" "AN0" "C1IN+" "ICSPDAT" "ULPWU" } 11 
button .done -text "Write File" -command {all_done}
grid .done -row 12 -column 0
button .quit -text "Exit" -command {exit}
grid .quit -row 12 -column 1