-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
edif.y, e2net, e2sch - Frank Bennett
see change_log.txt for status
Tools with EDIF out writer:
o OrCad
o DataXpress
o Viewlogic
o IntuSoft ICAP
o Protel nVisage
o PADS ?
o P-CAD ?
o EDIF viewer (www.cimmetry.com)
o EDIF translator (www.elgris.com/content/edif_overview.html)
Modified to output a KiCad Netlist
1) find/store InstanceNameDef. ViewRef - i.e. CMP31.cap
2) find/store Nets: NetNameDef, InstRef, PortRef
3) sort Nets by InstRef
Files:
makefile - Unix style makefile, runs Bison & runs gcc
ppedif.c - pretty print EDIF
edif.y - edif BNF Grammer, yylex, & main.c
savlib.c - output format
e2net.c - EDIF to netlist main
e2sch.c - EDIF to libs, schematic main
e2lib.c - EDIF to libs (obsolete)
examples/
eyespy - ORCad schematic (ATX PS)
PS10 - OrCad schematic in EDIF format(reformated)
PS10.EDF - Original PS10
PS10.pdf - PS10 schematic
PS10.net - KiCad netlist output see below
batest.1 - edif test file
batest.2 - edif test file
hptest - edif test file
hptest.net - KiCad netlist output see below
Tested under Linux and cygwin (http://www.cygwin.com)
Install: (./run_tests or)
make
cd examples
../ppedif < PS10.EDF > PS10
../e2net < PS10 > PS10.net or
../e2net PS10 or
../e2net hptest or
../e2sch examples/eyespy
../e2sch examples/PS10
../e2sch examples/BCD
Notes:
e2lib is now obsolute
Edif Notes:
o hptest is more readable for parser debugging. This begs for
EdifBeautifier for the OrCad output (use ppedif)
o EDIF schematic file contain
- symbol ports names, Direction, Designator
- symbol graphics, justification, orientation, origin
- sheet ports, instances, instance location, symbol reference
- sheet Netlist, wire paths
Doesn't seem to include footprint references
TODO:
o find/output schematic drawing, symbol graphics
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
roger's previous comments:
This is an EDIF 2.0.0 parser, well more like a recognizer. If
you build the test case and run it with a valid EDIF file on the
standard input the program will just terminate normally. Sounds
real useful, huh. The nifty part is that the core of the parser
is YACC-able, almost. The problem is that the EDIF grammer is
so large that standard YACC just can't swallow it. So you need
to either super charge your YACC or use a YACC clone like BISON.
I used BISON, which is GNU-ware and so is freely available besides
being a terrific program. I think BISON is available from the
Free Software Foundation or on systems near you; even I am happy
to pass it on to whoever wants it.
Enough BISON praise. The reason I made the parser YACC-able is
because past experience indicates this one of the easiest forms
to add actions too, as well as put in updates or fixes. EDIF is
hardly context free though, and so I had to fold all sorts of
ugliness into the lexical analyzer to keep the YACC part clean.
This version is raw, it doesn't build symbol tables, do
semantic checking or create a database. The parser itself won't
even run though a wrapper has been included for testing. I wanted
to get out one version before I started adding such junk to it.
Again experience indicates that it is no fun lobotimizing parsers
so that you can do the low level stuff your way. Besides somebody
might even find a bug in the code ... naw, that's a silly
justification.
The 'makefile' I've included is not the one I use (and probably
will get me in lots of trouble). I invoke gobs of debugging and
profiling switches which are specific to our compilers, the
'makefile' is intended to be generic and may require some diddling.
I developed the code on a BSD 4.3 system and haven't added the
changes for SYS V, though they should be minor. The parser was too
large to post in one piece, so it got split and the 'makefile'
should know how to patch it together. There is one definition of
possible interest. Compiling with a '-DDEBUG' will cause the 8 most
recently consumed tokens to be displayed in the event of a parse
error. Profiling indicates a pretty costly item though.
Three test cases are included:
hptest - by Fabio Angelillis of Hewlett-Packard
batest.1
batest.2 - by Bill Ames of Silicon Compilers
Many thanks to them and the files are provide as is, no warrenty
implied and brush after every meal ...
I find the parser code to be easily immediately obvious and so
no documentation is included in the release. Humm ... don't buy that.
Actually documentation is in the works but it would delay this
posting too long if I waited for it to be completed. If you find
the parser totally incomprehensible, E-mail me a request and I'll
send you whatever I have written by the time I get your mail.
Lastly, as far as I'm concerned this parser is now in the public
domain and you can do anything you want with it. My next task is
to make it build a database and when that's through I'll probably
post it again ... you have been warned! Enjoy, and I'd be happy to
get bug reports or stories of how many ways you found to delete
the source ...
--
-your friendly neighborhood Rogue Monster roger@mips.com
UUCP: {decvax,ucbvax,ihnp4,hplabs,sun,ames,prls}!decwrl!mips!roger
USPS: MIPS Computer Systems, 930 Arques, Sunnyvale, CA 94086, (408) 991-0220