Hi Werner, El mar, 12-04-2005 a las 19:39 +0200, Werner Hoch escribió: > Hi Carlos, > > On Sunday 10 April 2005 19:41, Carlos Nieves Ónega wrote: > > El dom, 10-04-2005 a las 14:07 +0200, Werner Hoch escribió: > > > I think the spacer keyword should be placed in the pintype column > > > and be lowercase, even if I cannot imaging that there is a device > > > with a real "SPACER" named pin. > > > > Ok. Done in the attached diff. > > Sorry for my stupidity the correct column is the P_STYLE, because it has > nothing to do with the electrical properties of pintype. Please do not > listen if I write such curious things ;-).
I shouldn't ;-) . I don't mind. It's easy to change ;-) [snip] > There are a few things. > In your test file the nets and the device attributes are written across > the symbol. They are hard to read. Fixed. > If you convert the AT90S8535_TQFP.src file, the bottom pins become > unreachable. You have to translate the symbol away from the origin > first. Something strange is happening: - First I create the symbol - Then I open it with gschem using: gschem AT90S8535_TQFP.sym , I can't see the bottom pins. If you look at the coords, the symbol is correct. The coords at the bottom at the screen are just at y=1400, so it's not displaying all the symbol. - I open the SAME symbol in two steps: - First running gschem - And then File->Open and selecting the symbol Everything is ok. So I think this is a bug in gschem.... > The position of the graphical name and the refdes is just a matter of > tast. It's ok for me even if I usually put the refdes to the upper > right and the name to the upper left. Fixed. I'm curious: what do you do if there are pins on the top? The name of the symbol will overlap with the pins... > > P.S.: One of the tragesym options is "pinwidthvertikal". I think it's > > mispelled: in english it would be "pinwidthvertical" (with a "C" in > > "vertical")... > > Very funny, "vertikal" is the german translation of vertical. I included some code so it uses vertikal if it was changed (defined), and vertical otherwise. On the other hand, I made tragesym a little more clever: If there are pins on the top (or on the bottom) and the width specified is 0, then it calculates the width based on the greater number of pins on the top or on the bottom. It could be extended, so it calculates automatically the symbol's width based on the length of pin names and number of pins on the top and on the bottom... just matter of figure out how to know the width of the pin names. See attached diff. Regards, Carlos
--- tragesym 2004-11-14 19:08:23.000000000 +0100 +++ /home/cnieves/temp/scripts_trabajo/utils/tragesym 2005-04-14 17:08:03.282418016 +0200 @@ -29,7 +29,7 @@ import sys, string ##################### GLOBALS ############################################ -VERSION="0.0.7" +VERSION="0.0.8" CHARHIGH=26 pre_options={"wordswap":"yes" @@ -38,6 +38,7 @@ ,"generate_pinseq":"yes" ,"sym_width":"1400" ,"pinwidthvertikal":"400" + ,"pinwidthvertical":"400" ,"pinwidthhorizontal":"400"} pre_attr=["version", "name", "device", "refdes", "footprint", "numslots", "slot", "slotdef","description", "comment", "author", "documentation"] @@ -157,6 +158,14 @@ def checkpins(pinlist): for pin in pinlist: + if (pin[P_STYLE]=="spacer"): + if (pin[P_POS] == ""): + print "There must be a position with a spacer.\n" + sys.exit() + if pin[P_POS] not in poslist: + print "Position is not allowed: \n", pin + sys.exit() + continue try: if pin[P_STYLE] != "none": string.atoi(pin[P_SEQ]) @@ -244,115 +253,87 @@ def writesym(filename,options,attr,pins): o_symwidth=string.atoi(options["sym_width"]) o_hdist=string.atoi(options["pinwidthhorizontal"]) - o_vdist=string.atoi(options["pinwidthvertikal"]) + + # If pinwidthvertikal was defined, use it, else use pinwidthvertical + # This keeps compatibility with older versions, while fixing the spell + # bug + if options["pinwidthvertikal"] != pre_options["pinwidthvertikal"]: + o_vdist=string.atoi(options["pinwidthvertikal"]) + else: + o_vdist=string.atoi(options["pinwidthvertical"]) + o_wordswap=options["wordswap"] o_rotate=options["rotate_labels"] o_sort=options["sort_labels"] pinlength = 300 - topleftx, toplefty = 50000, 30000 ## top left of the box - textx, texty= topleftx , toplefty + 50 - urefx, urefy= topleftx + o_symwidth, toplefty + 100 - prightx, prighty= topleftx + pinlength + o_symwidth, toplefty - o_vdist - pleftx, plefty= topleftx - pinlength, toplefty - o_vdist - ptopx, ptopy= topleftx + o_symwidth + 1000, toplefty + pinlength - pbottomx, pbottomy= topleftx + o_symwidth + 1000, toplefty - 2000 - + +### Count the number of pins in each side + + numpleft=0 + numpright=0 + numpbottom=0 + numptop = 0 + for pin in pins: + if pin[P_POS] == "l": # left pin + numpleft=numpleft+1 + elif pin[P_POS] == "r": #right pin + numpright=numpright+1 + elif pin[P_POS] == "b": #right pin + numpbottom=numpbottom+1 + elif pin[P_POS] == "t": #right pin + numptop=numptop+1 + + # If there are pins on the top, then o_vdist should be 500 at least + if ( (numptop > 0) and (o_vdist < 500) ): + o_vdist = 500 + + # Calculate the position of the pins in the left and right side. + plefty, prighty = 0, 0 + if numpleft > numpright: + plefty=plefty+(numpleft-1)*o_vdist + prighty = plefty + else : + prighty=prighty+(numpright-1)*o_vdist + plefty = prighty + + # Calculate the bottom left of the box + bottomleftx, bottomlefty = pinlength + 100, 100 ## bottom left of the box + if numpbottom > 0: + bottomlefty += pinlength + + # Calculate the minimum symwidth and increase it if necessary + if numpbottom > numptop: + calculated_symwidth=(numpbottom-1)*o_hdist+2*o_hdist + else: + calculated_symwidth=(numptop-1)*o_hdist+2*o_hdist + + if o_symwidth == 0: + o_symwidth = calculated_symwidth + + # Calculate the symbol's high + if numpleft < numpright: + high=(numpright+1)*o_vdist + else: + high=(numpleft+1)*o_vdist + topy = bottomlefty + high + + # Calculate the position of several items. + prightx, prighty= bottomleftx + pinlength + o_symwidth, prighty + bottomlefty + o_vdist + pleftx, plefty= bottomleftx - pinlength, plefty + bottomlefty + o_vdist + ptopx, ptopy= bottomleftx + o_hdist, bottomlefty + high + pinlength + pbottomx, pbottomy = bottomleftx + o_hdist, bottomlefty - pinlength + + f = open(filename, "w") - texty_basis=texty +### Draw the symbol version if attr.has_key(("version",1)): value=attr[("version",1)] - f.write("v " + value + "\n") + f.write("v " + value + " 1\n") else: print "version attribut missing" - if attr.has_key(("refdes",1)): - value=attr[("refdes",1)] - f.write("T %i"% urefx +" %i"% urefy +" 8 10 1 1 0 6 1\n") - f.write("refdes=" + value + "\n") - else: - print "refdes attribut missing" - if attr.has_key(("name",1)): - value=attr[("name",1)] - f.write("T %i" %textx + " %i"% texty + " 9 10 1 0 0 0 1\n") - f.write(value + "\n") - texty=texty+200 - else: - print "name attribut missing" - if attr.has_key(("device",1)): - value=attr[("device",1)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("device=" + value + "\n") - texty=texty+200 - else: - print "device attribut missing" - if attr.has_key(("footprint",1)): - value=attr[("footprint",1)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("footprint=" + value + "\n") - texty=texty+200 - else: - print "footprint attribut missing" - if attr.has_key(("author",1)): - value=attr[("author",1)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("author=" + value + "\n") - texty=texty+200 - else: - print "author attribut missing" - if attr.has_key(("documentation",1)): - value=attr[("documentation",1)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("documentation=" + value + "\n") - texty=texty+200 - else: - print "documentation attribut missing" - if attr.has_key(("description",1)): - value=attr[("description",1)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("description=" + value + "\n") - texty=texty+200 - else: - print "description attribut missing" - if attr.has_key(("numslots",1)): - value=attr[("numslots",1)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("numslots=" + value + "\n") - texty=texty+200 - else: - print "numslots attribut missing" - if attr.has_key(("slot",1)): - value=attr[("slot",1)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("slot=" + value + "\n") - texty=texty+200 - i = 1 - while attr.has_key(("slotdef",i)): - value=attr[("slotdef",i)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("slotdef=" + value + "\n") - texty=texty+200 - i = i + 1 - i = 1 - while attr.has_key(("comment",i)): - value=attr[("comment",i)] - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("comment=" + value + "\n") - texty=texty+200 - i = i + 1 - - nets={} - for pin in pins: - if pin[P_STYLE] == "none": - if not nets.has_key(pin[P_NET]): - nets[pin[P_NET]] = pin[P_NR] - else: - nets[pin[P_NET]] = nets[pin[P_NET]] + ","+ pin[P_NR] - for key,value in nets.items(): - f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") - f.write("net=" + key + ":" + value + "\n") - texty=texty+200 - + if o_sort == "yes": pins.sort(pinsort) @@ -416,6 +397,8 @@ negl=(0,20,1,0) swap=0 ptopx=ptopx + o_hdist + if (pin[P_STYLE]=="spacer"): + continue ### draw the pin if (pin[P_STYLE]=="dot" or #short pin and dot? pin[P_STYLE]=="dotclk"): @@ -430,12 +413,16 @@ pintx, pinty, pinta, pintr=pint x=basex+pintx y=basey+pinty + if pin[P_POS] == "t": # top pin + y += 50 f.write("T %i"%x+" %i"%y+" 5 8 1 1 %i"%pintr+" %i 1\n"%pinta) f.write("pinnumber="+pin[P_NR]+"\n") ### draw pinseq pintx, pinty, pinta, pintr=pinq x=basex+pintx y=basey+pinty + if pin[P_POS] == "t": # top pin + y += 50 f.write("T %i"%x+" %i"%y+" 5 8 0 1 %i"%pintr+" %i 1\n"%pinta) f.write("pinseq="+pin[P_SEQ]+"\n") ### draw pinlabel and pintype @@ -491,14 +478,105 @@ f.write("L %i"%x1+" %i"%y1+" %i"%x2+" %i"%y2 + " 3 0 0 0 -1 -1\n") f.write("L %i"%x1+" %i"%y1+" %i"%x3+" %i"%y3 + " 3 0 0 0 -1 -1\n") ### draw a box - width=o_symwidth - if plefty < prighty: - high=toplefty - plefty - else: - high=toplefty - prighty - bottomy = toplefty - high - f.write("B %i"%topleftx+" %i"%bottomy+" %i"%width+" %i"%high+ + f.write("B %i"%bottomleftx+" %i"%bottomlefty+" %i"%o_symwidth+" %i"%high+ " 3 0 0 0 -1 -1 0 -1 -1 -1 -1 -1\n") + +### draw the attributes + urefx, urefy = bottomleftx+o_symwidth, bottomlefty + high + 100 + namex, namey = bottomleftx, bottomlefty+high+100 + textx = namex + texty = namey + 200 + if numptop > 0: + texty += 100 + + if attr.has_key(("refdes",1)): + value=attr[("refdes",1)] + f.write("T %i"% urefx +" %i"% urefy +" 8 10 1 1 0 6 1\n") + f.write("refdes=" + value + "\n") + else: + print "refdes attribut missing" + if attr.has_key(("name",1)): + value=attr[("name",1)] + f.write("T %i" %namex + " %i"% namey + " 9 10 1 0 0 0 1\n") + f.write(value + "\n") + else: + print "name attribut missing" + if attr.has_key(("device",1)): + value=attr[("device",1)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("device=" + value + "\n") + texty=texty+200 + else: + print "device attribut missing" + + if attr.has_key(("footprint",1)): + value=attr[("footprint",1)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("footprint=" + value + "\n") + texty=texty+200 + else: + print "footprint attribut missing" + if attr.has_key(("author",1)): + value=attr[("author",1)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("author=" + value + "\n") + texty=texty+200 + else: + print "author attribut missing" + if attr.has_key(("documentation",1)): + value=attr[("documentation",1)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("documentation=" + value + "\n") + texty=texty+200 + else: + print "documentation attribut missing" + if attr.has_key(("description",1)): + value=attr[("description",1)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("description=" + value + "\n") + texty=texty+200 + else: + print "description attribut missing" + if attr.has_key(("numslots",1)): + value=attr[("numslots",1)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("numslots=" + value + "\n") + texty=texty+200 + else: + print "numslots attribut missing" + if attr.has_key(("slot",1)): + value=attr[("slot",1)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("slot=" + value + "\n") + texty=texty+200 + i = 1 + while attr.has_key(("slotdef",i)): + value=attr[("slotdef",i)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("slotdef=" + value + "\n") + texty=texty+200 + i = i + 1 + i = 1 + while attr.has_key(("comment",i)): + value=attr[("comment",i)] + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("comment=" + value + "\n") + texty=texty+200 + i = i + 1 + + nets={} + for pin in pins: + if pin[P_STYLE] == "none": + if not nets.has_key(pin[P_NET]): + nets[pin[P_NET]] = pin[P_NR] + else: + nets[pin[P_NET]] = nets[pin[P_NET]] + ","+ pin[P_NR] + for key,value in nets.items(): + f.write("T %i" %textx + " %i"% texty + " 5 10 0 0 0 0 1\n") + f.write("net=" + key + ":" + value + "\n") + texty=texty+200 + + return 0 def mergeoptions(source_opt,pre_opt):