├── .gitignore ├── COPYRIGHT ├── Makefile ├── README ├── VERSION ├── analyzer ├── Bitmaps │ ├── chk │ ├── cursor │ ├── cursor_mask │ ├── gray │ ├── icon │ ├── iconbox │ ├── left_arros │ ├── left_arrows │ ├── left_curs │ ├── left_mask │ ├── opus │ ├── right_arrows │ ├── right_curs │ ├── right_mask │ ├── select │ ├── sizebox │ ├── timer │ ├── timer_mask │ └── xpat ├── Depend ├── Makefile ├── anXhelper.c ├── ana.h ├── ana_glob.h ├── ana_tk.h ├── analyzer.c ├── base.c ├── convert.c ├── coords.c ├── defaults.c ├── deltaT.c ├── event.c ├── graphics.c ├── graphics.h ├── helper.h ├── icon.c ├── menu.c ├── movetot.c ├── movetrace.c ├── namelen.c ├── noana.c ├── postscript.c ├── scrollbar.c ├── setsteps.c ├── textwind.c ├── thread.c ├── tkana.c ├── update.c ├── window.c ├── wm.c └── zoom.c ├── base ├── ASSERT.h ├── Depend ├── Makefile ├── access.c ├── bin_io.h ├── binsim.c ├── cad_dir.c ├── config.c ├── conn_list.c ├── defs.h ├── eval.c ├── fio.c ├── globals.h ├── hist.c ├── hist_io.c ├── incstub.c ├── intr.c ├── loctypes.h ├── mem.c ├── net.h ├── net_macros.h ├── netupdate.c ├── network.c ├── newrstep.c ├── nsubrs.c ├── parallel.c ├── prints.c ├── rsim.c ├── rsim.h ├── sched.c ├── sim.c ├── spiketbl.c ├── sstep.c ├── stables.c ├── stack.c ├── symbol.map ├── tpos.c ├── units.h └── usage.c ├── configure ├── doc ├── Makefile ├── faultsim │ ├── doc.tex │ ├── fsim.ps │ └── fsim.tex ├── irsim-analyzer.3 ├── irsim-analyzer.doc ├── irsim.1 ├── irsim.doc ├── netchange.5 ├── netchange.doc └── powerEst.doc ├── faultsim ├── Depend ├── Makefile ├── faultsim.c └── incsim.c ├── irsim ├── Depend ├── Makefile ├── genspktbl.c ├── gentbl.c ├── irsim.c └── symbol.map ├── lib ├── Makefile ├── bitmaps │ ├── center.xbm │ ├── left.xbm │ ├── lleft.xbm │ ├── right.xbm │ └── rright.xbm ├── calibrate_hspice │ ├── README │ ├── ckt.hsp │ ├── cktCap.hsp │ ├── dev.example │ ├── getres │ ├── scmos100.prm │ ├── scmos30.prm │ ├── scmos35.prm │ ├── scmos50_3v.prm │ ├── scmos50_5v.prm │ └── scmos60.prm ├── calibrate_spice3 │ ├── Makefindr │ ├── README │ ├── ckt.spi │ ├── cs.spi │ ├── dev.1_6um │ ├── dev.2um │ ├── findr │ ├── findr.c │ ├── getres │ ├── mosis1_6u.spi │ ├── mosis2u.spi │ ├── scmos1_6um.prm │ ├── scmos2um.prm │ └── spi.out ├── prm │ ├── amiabn.80.n99z.5.prm │ ├── amic5.30.n98s.3.3.prm │ ├── amicwl.50.n97l.5.prm │ ├── hpcmos10.20.n98v.3.3.prm │ ├── hpcmos14.30.n9ae.3.3.prm │ ├── hpcmos26.40.n88x.5.prm │ ├── orbit.60.n96e.5.prm │ ├── scmos100.prm │ ├── scmos1_6um.prm │ ├── scmos2um.prm │ ├── scmos30.prm │ ├── scmos35.prm │ ├── scmos50_3v.prm │ ├── scmos50_5v.prm │ ├── scmos60.prm │ ├── tsmc18.10.nxxx.1.8.prm │ ├── tsmc25.15.n99y.2.5.prm │ ├── tsmc35.20.n98t.3.3.prm │ └── tsmc35p.20.n98tp.3.3.prm └── test │ ├── foo.sim │ └── z.test │ ├── control.ps │ ├── foo.c │ └── foo.ps ├── other ├── README ├── h2a │ ├── Hist.c │ ├── Makefile │ ├── Nsubrs.c │ ├── h2a.c │ ├── history.h │ └── sort.c └── inet2sim │ ├── Binsim.c │ ├── Hist.c │ ├── Makefile │ ├── Sim.c │ └── inet2sim.c ├── random ├── Depend ├── Makefile ├── README └── random.c ├── rules.mak ├── scripts ├── config.guess ├── config.sub ├── configure ├── configure.in ├── defs.mak.in ├── install-sh ├── irsim.spec.in ├── makedbh ├── missing └── mkdirs ├── tclsubckt ├── Makefile └── diglib.c ├── tcltk ├── Depend ├── Makefile ├── console.tcl ├── irsim.sh.in ├── irsim.tcl.in ├── irsimexec.c ├── lookup.c ├── tclanalyzer.c ├── tclirsim.c ├── tkAnalyzer.c ├── tkTag.c ├── tkcon.tcl └── vcd.tcl └── usersubckt ├── Depend ├── Makefile ├── README ├── dll.c ├── dll.cmd ├── dll.sim ├── flop.cmd ├── flop.sim ├── flop_mux.c ├── subckt.c ├── subckt.h └── user.c /.gitignore: -------------------------------------------------------------------------------- 1 | irsim 2 | irsimexec 3 | defs.mak 4 | Depend 5 | config.cache 6 | config.status 7 | config.log 8 | scripts/defs.mak 9 | scripts/config.log 10 | scripts/config.status 11 | make.log 12 | install.log 13 | *.o 14 | *.so 15 | *~ 16 | *.log 17 | tcltk/irsim.sh 18 | tcltk/irsim.tcl 19 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile redesigned for irsim-9.7 3 | # 4 | 5 | IRSIMDIR = . 6 | PROGRAMS = irsim 7 | LIBRARIES = 8 | MODULES = base analyzer 9 | 10 | MAKEFLAGS = 11 | INSTALL_CAD_DIRS = lib doc 12 | 13 | -include defs.mak 14 | 15 | all: $(ALL_TARGET) 16 | 17 | standard: 18 | @echo --- errors and warnings logged in file make.log 19 | @${MAKE} mains 2>&1 | tee -a make.log 20 | 21 | tcl: 22 | @echo --- errors and warnings logged in file make.log 23 | @${MAKE} tcllibrary 2>&1 | tee -a make.log 24 | 25 | force: clean all 26 | 27 | defs.mak: 28 | @echo No \"defs.mak\" file found. Run "configure" to make one. 29 | 30 | config: 31 | ${IRSIMDIR}/configure 32 | 33 | tcllibrary: modules 34 | @echo --- making Tcl shared-object libraries 35 | for dir in ${PROGRAMS}; do \ 36 | (cd $$dir && ${MAKE} tcl-main); done 37 | 38 | mains: modules 39 | @echo --- making main programs 40 | for dir in ${PROGRAMS}; do \ 41 | (cd $$dir && ${MAKE} main); done 42 | 43 | modules: 44 | @echo --- making modules 45 | for dir in ${MODULES}; do \ 46 | (cd $$dir && ${MAKE} module); done 47 | 48 | libs: 49 | @echo --- making libraries 50 | for dir in ${LIBRARIES}; do \ 51 | (cd $$dir && ${MAKE} lib); done 52 | 53 | depend: 54 | for dir in ${MODULES} ${PROGRAMS}; do \ 55 | (cd $$dir && ${MAKE} depend); done 56 | 57 | install: $(INSTALL_TARGET) 58 | 59 | install-irsim: 60 | @echo --- installing executables to $(DESTDIR)${INSTALL_BINDIR} 61 | @echo --- installing run-time files to $(DESTDIR)${INSTALL_LIBDIR} 62 | @${MAKE} install-real >> install.log 63 | 64 | install-real: install-dirs 65 | for dir in ${INSTALL_CAD_DIRS}; do \ 66 | (cd $$dir && ${MAKE} install); done 67 | for dir in ${PROGRAMS}; do \ 68 | (cd $$dir && ${MAKE} install); done 69 | 70 | install-tcl-dirs: 71 | ${IRSIMDIR}/scripts/mkdirs $(DESTDIR)${INSTALL_BINDIR} $(DESTDIR)${INSTALL_MANDIR} \ 72 | $(DESTDIR)${INSTALL_TCLDIR} $(DESTDIR)${INSTALL_PRMDIR} $(DESTDIR)${INSTALL_XBMDIR} 73 | 74 | install-dirs: 75 | ${IRSIMDIR}/scripts/mkdirs $(DESTDIR)${INSTALL_BINDIR} $(DESTDIR)${INSTALL_MANDIR} \ 76 | $(DESTDIR)${INSTALL_PRMDIR} 77 | 78 | install-tcl: 79 | @echo --- installing executables to $(DESTDIR)${INSTALL_BINDIR} 80 | @echo --- installing run-time files to $(DESTDIR)${INSTALL_LIBDIR} 81 | @${MAKE} install-tcl-real 2>&1 >> install.log 82 | 83 | install-tcl-real: install-tcl-dirs 84 | for dir in ${INSTALL_CAD_DIRS} ${PROGRAMS}; do \ 85 | (cd $$dir && ${MAKE} install-tcl); done 86 | 87 | clean: 88 | for dir in ${MODULES} ${PROGRAMS} ${UNUSED_MODULES}; do \ 89 | (cd $$dir && ${MAKE} clean); done 90 | ${RM} *.log 91 | 92 | distclean: 93 | touch defs.mak 94 | @${MAKE} clean 95 | ${RM} defs.mak old.defs.mak ${IRSIMDIR}/scripts/defs.mak 96 | ${RM} ${IRSIMDIR}/scripts/default.conf 97 | ${RM} ${IRSIMDIR}/scripts/config.log ${IRSIMDIR}/scripts/config.status 98 | ${RM} scripts/irsim.spec irsim-`cat VERSION` irsim-`cat VERSION`.tgz 99 | 100 | dist: 101 | ${RM} scripts/irsim.spec irsim-`cat VERSION` irsim-`cat VERSION`.tgz 102 | sed -e /@VERSION@/s%@VERSION@%`cat VERSION`% \ 103 | scripts/irsim.spec.in > scripts/irsim.spec 104 | ln -nsf . irsim-`cat VERSION` 105 | tar zchvf irsim-`cat VERSION`.tgz --exclude CVS \ 106 | --exclude irsim-`cat VERSION`/irsim-`cat VERSION` \ 107 | --exclude irsim-`cat VERSION`/irsim-`cat VERSION`.tgz \ 108 | irsim-`cat VERSION` 109 | 110 | clean-mains: 111 | for dir in ${PROGRAMS}; do \ 112 | (cd $$dir && ${RM} $$dir}; done 113 | 114 | tags: 115 | ${RM} tags 116 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 9.7.119 2 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/chk: -------------------------------------------------------------------------------- 1 | #define chk_width 6 2 | #define chk_height 8 3 | static char chk_bits[] = { 4 | 0x30, 0x10, 0x18, 0x09, 0x0d, 0x07, 0x06, 0x02}; 5 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/cursor: -------------------------------------------------------------------------------- 1 | #define cursor_width 16 2 | #define cursor_height 16 3 | #define cursor_x_hot 3 4 | #define cursor_y_hot 1 5 | static char cursor_bits[] = { 6 | 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, 7 | 0xf8, 0x01, 0xf8, 0x03, 0xf8, 0x07, 0xf8, 0x00, 0xd8, 0x00, 0x88, 0x01, 8 | 0x80, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00}; 9 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/cursor_mask: -------------------------------------------------------------------------------- 1 | #define cursor_mask_width 16 2 | #define cursor_mask_height 16 3 | static char cursor_mask_bits[] = { 4 | 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7c, 0x00, 0xfc, 0x00, 0xfc, 0x01, 5 | 0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x01, 0xdc, 0x03, 6 | 0xcc, 0x03, 0x80, 0x07, 0x80, 0x07, 0x00, 0x03}; 7 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/gray: -------------------------------------------------------------------------------- 1 | #define gray_width 16 2 | #define gray_height 16 3 | static char gray_bits[] = { 4 | 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 5 | 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55, 6 | 0xaa, 0xaa, 0x55, 0x55, 0xaa, 0xaa, 0x55, 0x55}; 7 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/icon: -------------------------------------------------------------------------------- 1 | #define icon_width 48 2 | #define icon_height 48 3 | static char icon_bits[] = { 4 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 5 | 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xdf, 6 | 0xfb, 0xff, 0xff, 0xff, 0xff, 0xdf, 0xfb, 0xff, 0x3f, 0xff, 0xff, 0xdf, 7 | 0xfb, 0xff, 0x7f, 0xff, 0xff, 0xdf, 0x1b, 0xcb, 0x71, 0x2d, 0xcc, 0xd2, 8 | 0x7b, 0xb3, 0x77, 0xed, 0xb5, 0xdc, 0x1b, 0xbb, 0x71, 0xed, 0xb6, 0xde, 9 | 0x6b, 0xbb, 0x76, 0x63, 0xc7, 0xde, 0x6b, 0xbb, 0x76, 0xaf, 0xf7, 0xde, 10 | 0x9b, 0xba, 0x29, 0x2e, 0x8c, 0xde, 0xfb, 0xff, 0xff, 0xf3, 0xff, 0xdf, 11 | 0xfb, 0xff, 0xff, 0xff, 0xff, 0xdf, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 12 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x57, 0x55, 0x55, 0x55, 0x55, 0xd5, 13 | 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 14 | 0x1b, 0xf0, 0x03, 0xfc, 0x00, 0xff, 0xff, 0xf7, 0xfb, 0xfd, 0x7e, 0xdf, 15 | 0xfb, 0xf7, 0xfb, 0xfd, 0x7e, 0xff, 0xff, 0xf7, 0xfb, 0xfd, 0x7e, 0xdf, 16 | 0xfb, 0x07, 0xf8, 0x01, 0x7e, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 17 | 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xfc, 0x03, 0xff, 0xd8, 18 | 0xfb, 0xef, 0xfd, 0x7b, 0xff, 0xfe, 0xff, 0xef, 0xfd, 0x7b, 0xff, 0xde, 19 | 0xfb, 0xef, 0xfd, 0x7b, 0xff, 0xfe, 0x1f, 0xe0, 0x01, 0x78, 0x00, 0xde, 20 | 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xdf, 21 | 0x1b, 0x0e, 0x00, 0x0e, 0xff, 0xfd, 0xff, 0xf5, 0xff, 0xf5, 0xe6, 0xda, 22 | 0xfb, 0xf5, 0xff, 0xf5, 0xd9, 0xfa, 0xff, 0xfb, 0xff, 0xfb, 0xbf, 0xda, 23 | 0xfb, 0xfb, 0xff, 0xfb, 0x7f, 0xff, 0xff, 0xf5, 0xff, 0xf5, 0xf1, 0xdf, 24 | 0xfb, 0xf5, 0xff, 0xf5, 0xee, 0xff, 0x1f, 0x0e, 0x00, 0x0e, 0xef, 0xdb, 25 | 0xfb, 0xff, 0xff, 0xff, 0xdf, 0xfd, 0xff, 0xff, 0xff, 0xff, 0x3f, 0xde, 26 | 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0x57, 0x55, 0x55, 0x55, 0x55, 0xd5, 27 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; 28 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/iconbox: -------------------------------------------------------------------------------- 1 | #define iconbox_width 13 2 | #define iconbox_height 13 3 | static char iconbox_bits[] = { 4 | 0xff, 0x1f, 0x01, 0x10, 0xbd, 0x17, 0xbd, 0x17, 0xbd, 0x17, 0xbd, 0x17, 5 | 0x01, 0x10, 0xbd, 0x17, 0xbd, 0x17, 0xbd, 0x17, 0xbd, 0x17, 0x01, 0x10, 6 | 0xff, 0x1f}; 7 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/left_arros: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RTimothyEdwards/irsim/34b1e7bbb1014346a5bbe9171bd25840ee020578/analyzer/Bitmaps/left_arros -------------------------------------------------------------------------------- /analyzer/Bitmaps/left_arrows: -------------------------------------------------------------------------------- 1 | #define left_arrows_width 32 2 | #define left_arrows_height 16 3 | static char left_arrows_bits[] = { 4 | 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x02, 0x80, 0x81, 0x08, 0x02, 0x82, 5 | 0xc1, 0x0c, 0x02, 0x83, 0xe1, 0x0e, 0x82, 0x83, 0xf1, 0x7f, 0xc2, 0x9f, 6 | 0xf9, 0x7f, 0xe2, 0x9f, 0xfd, 0x7f, 0xf2, 0x9f, 0xf9, 0x7f, 0xe2, 0x9f, 7 | 0xf1, 0x7f, 0xc2, 0x9f, 0xe1, 0x0e, 0x82, 0x83, 0xc1, 0x0c, 0x02, 0x83, 8 | 0x81, 0x08, 0x02, 0x82, 0x01, 0x00, 0x02, 0x80, 0x01, 0x00, 0x02, 0x80, 9 | 0xff, 0xff, 0xff, 0xff}; 10 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/left_curs: -------------------------------------------------------------------------------- 1 | #define left_curs_width 16 2 | #define left_curs_height 16 3 | #define left_curs_x_hot 2 4 | #define left_curs_y_hot 7 5 | static char left_curs_bits[] = { 6 | 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0xc0, 0x00, 0xe0, 0x00, 0xf0, 0x00, 7 | 0xf8, 0x3f, 0xfc, 0x3f, 0xf8, 0x3f, 0xf0, 0x00, 0xe0, 0x00, 0xc0, 0x00, 8 | 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 9 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/left_mask: -------------------------------------------------------------------------------- 1 | #define left_mask_width 16 2 | #define left_mask_height 16 3 | static char left_mask_bits[] = { 4 | 0x00, 0x01, 0x80, 0x01, 0xc0, 0x01, 0xe0, 0x01, 0xf0, 0x01, 0xf8, 0x7f, 5 | 0xfc, 0x7f, 0xfe, 0x7f, 0xfc, 0x7f, 0xf8, 0x7f, 0xf0, 0x01, 0xe0, 0x01, 6 | 0xc0, 0x01, 0x80, 0x01, 0x00, 0x01, 0x00, 0x00}; 7 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/opus: -------------------------------------------------------------------------------- 1 | #define opus_width 64 2 | #define opus_height 64 3 | static char opus_bits[] = { 4 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 5 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0x04, 0x00, 0x00, 0x00, 6 | 0x00, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 7 | 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 8 | 0x00, 0x80, 0xff, 0xff, 0x10, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 9 | 0x60, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0xc0, 0x01, 0x00, 0x00, 10 | 0x00, 0xe0, 0xff, 0x7f, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x3f, 11 | 0x0c, 0xf8, 0x03, 0x00, 0x00, 0xf0, 0xff, 0x3f, 0x0c, 0x00, 0x7c, 0x00, 12 | 0x00, 0xf8, 0xff, 0x3f, 0x0c, 0x00, 0x80, 0x00, 0x00, 0xf8, 0xff, 0x3f, 13 | 0x00, 0x00, 0x00, 0x01, 0x00, 0xfc, 0xff, 0x27, 0x00, 0x00, 0x00, 0x02, 14 | 0x00, 0xfc, 0xff, 0x27, 0x10, 0x00, 0x00, 0x04, 0x00, 0xfc, 0xff, 0x43, 15 | 0x10, 0x00, 0x00, 0x08, 0x00, 0xfe, 0xff, 0x43, 0x08, 0x00, 0x00, 0x10, 16 | 0x00, 0xfe, 0xff, 0x81, 0x07, 0x02, 0x00, 0x20, 0x00, 0xfe, 0xff, 0x01, 17 | 0x00, 0x01, 0x80, 0x41, 0x00, 0xfe, 0xff, 0x01, 0x80, 0x00, 0x00, 0x43, 18 | 0x00, 0xff, 0xff, 0x01, 0xe0, 0x00, 0x00, 0x40, 0x00, 0xff, 0xff, 0x00, 19 | 0xd0, 0x00, 0x00, 0x20, 0x00, 0xff, 0xff, 0x10, 0x6c, 0x01, 0x00, 0x10, 20 | 0x00, 0xff, 0xff, 0xe0, 0x63, 0xfe, 0xff, 0x0f, 0x80, 0xff, 0xff, 0x00, 21 | 0x30, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x00, 0x30, 0x00, 0x00, 0x00, 22 | 0x40, 0xff, 0xff, 0x00, 0x18, 0x00, 0x00, 0x00, 0x40, 0xfe, 0xff, 0x00, 23 | 0x18, 0x00, 0x00, 0x00, 0x20, 0xfc, 0xff, 0x01, 0x18, 0x0c, 0x00, 0x00, 24 | 0x20, 0xf8, 0xff, 0x01, 0x18, 0x0e, 0x00, 0x00, 0x20, 0xf0, 0xff, 0x03, 25 | 0x18, 0x03, 0x00, 0x00, 0x20, 0xe0, 0xff, 0x07, 0xf0, 0x01, 0x00, 0x00, 26 | 0x60, 0xc0, 0xff, 0x0f, 0xe0, 0x04, 0x00, 0x00, 0xe0, 0x80, 0xff, 0xff, 27 | 0x00, 0x02, 0x00, 0x00, 0xf0, 0x01, 0xff, 0xff, 0x00, 0x03, 0x00, 0x00, 28 | 0xf0, 0x03, 0xfe, 0x7f, 0x80, 0x01, 0x00, 0x00, 0xf0, 0x07, 0xfb, 0x1f, 29 | 0x80, 0x00, 0x00, 0x00, 0xf0, 0xcf, 0xf1, 0x0f, 0xc0, 0x00, 0x00, 0x00, 30 | 0xf8, 0x5f, 0xc0, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x80, 0x0f, 31 | 0xc0, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x00, 32 | 0xf8, 0x3f, 0x00, 0xe2, 0xc7, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x43, 33 | 0x80, 0x01, 0x00, 0x00, 0xf8, 0x2f, 0x00, 0x41, 0x00, 0x01, 0x00, 0x00, 34 | 0xf8, 0x2f, 0x80, 0x61, 0x00, 0x07, 0x00, 0x00, 0xf8, 0xcf, 0xe0, 0x36, 35 | 0x00, 0x0f, 0x00, 0x00, 0xfc, 0x07, 0x39, 0x1c, 0x00, 0x0f, 0x00, 0x00, 36 | 0xfc, 0x03, 0x0e, 0x10, 0x00, 0x1f, 0x00, 0x00, 0xfc, 0x03, 0x00, 0x60, 37 | 0x00, 0x1f, 0x00, 0x00, 0xfe, 0x03, 0x00, 0xc0, 0x81, 0x1f, 0x00, 0x00, 38 | 0xfe, 0x03, 0x00, 0x00, 0xff, 0x1e, 0x00, 0x00, 0xfe, 0x01, 0x00, 0x00, 39 | 0x00, 0x1e, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 40 | 0xff, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 41 | 0x00, 0x7c, 0x80, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x80, 0x00, 42 | 0xff, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x80, 0x01, 0x7f, 0x00, 0x06, 0xe0, 43 | 0x00, 0xfc, 0x80, 0x01, 0x7f, 0x00, 0x07, 0xa0, 0x01, 0xfc, 0x81, 0x03, 44 | 0x1f, 0x00, 0x09, 0x30, 0x01, 0xfc, 0xc3, 0x03, 0x1f, 0x80, 0x88, 0x13, 45 | 0x03, 0xe8, 0xe3, 0x07, 0x0f, 0xc0, 0x08, 0x11, 0x02, 0xe8, 0xf7, 0x07, 46 | 0x07, 0x40, 0x08, 0x10, 0x02, 0xc8, 0xff, 0x07}; 47 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/right_arrows: -------------------------------------------------------------------------------- 1 | #define right_arrows_width 32 2 | #define right_arrows_height 16 3 | static char right_arrows_bits[] = { 4 | 0xff, 0xff, 0xff, 0xff, 0x01, 0x40, 0x00, 0x80, 0x41, 0x40, 0x10, 0x81, 5 | 0xc1, 0x40, 0x30, 0x83, 0xc1, 0x41, 0x70, 0x87, 0xf9, 0x43, 0xfe, 0x8f, 6 | 0xf9, 0x47, 0xfe, 0x9f, 0xf9, 0x4f, 0xfe, 0xbf, 0xf9, 0x47, 0xfe, 0x9f, 7 | 0xf9, 0x43, 0xfe, 0x8f, 0xc1, 0x41, 0x70, 0x87, 0xc1, 0x40, 0x30, 0x83, 8 | 0x41, 0x40, 0x10, 0x81, 0x01, 0x40, 0x00, 0x80, 0x01, 0x40, 0x00, 0x80, 9 | 0xff, 0xff, 0xff, 0xff}; 10 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/right_curs: -------------------------------------------------------------------------------- 1 | #define right_curs_width 16 2 | #define right_curs_height 16 3 | #define right_curs_x_hot 14 4 | #define right_curs_y_hot 7 5 | static char right_curs_bits[] = { 6 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 7 | 0xf8, 0x3f, 0xf8, 0x7f, 0xf8, 0x3f, 0x00, 0x1e, 0x00, 0x0e, 0x00, 0x06, 8 | 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 9 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/right_mask: -------------------------------------------------------------------------------- 1 | #define right_mask_width 16 2 | #define right_mask_height 16 3 | static char right_mask_bits[] = { 4 | 0x00, 0x01, 0x00, 0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0xfc, 0x3f, 5 | 0xfc, 0x7f, 0xfc, 0xff, 0xfc, 0x7f, 0xfc, 0x3f, 0x00, 0x1f, 0x00, 0x0f, 6 | 0x00, 0x07, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00}; 7 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/select: -------------------------------------------------------------------------------- 1 | #define select_width 16 2 | #define select_height 16 3 | #define select_x_hot -1 4 | #define select_y_hot -1 5 | static char select_bits[] = { 6 | 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 7 | 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 8 | 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00}; 9 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/sizebox: -------------------------------------------------------------------------------- 1 | #define sizebox_width 13 2 | #define sizebox_height 13 3 | static char sizebox_bits[] = { 4 | 0xff, 0xff, 0x01, 0xf0, 0x01, 0xf0, 0x01, 0xf0, 0xff, 0xf1, 0x01, 0xf1, 5 | 0x01, 0xf1, 0x01, 0xf1, 0x1f, 0xf1, 0x11, 0xf1, 0x11, 0xf1, 0x11, 0xf1, 6 | 0xff, 0xff}; 7 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/timer: -------------------------------------------------------------------------------- 1 | #define timer_width 16 2 | #define timer_height 16 3 | #define timer_x_hot 8 4 | #define timer_y_hot 8 5 | static char timer_bits[] = { 6 | 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0f, 0x10, 0x04, 0x10, 0x04, 0xd0, 0x05, 7 | 0xa0, 0x02, 0x40, 0x01, 0x40, 0x01, 0xa0, 0x02, 0x90, 0x04, 0xd0, 0x05, 8 | 0xd0, 0x05, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00}; 9 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/timer_mask: -------------------------------------------------------------------------------- 1 | #define timer_mask_width 16 2 | #define timer_mask_height 16 3 | static char timer_mask_bits[] = { 4 | 0x00, 0x00, 0xfc, 0x1f, 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x0f, 0xf8, 0x0f, 5 | 0xf0, 0x07, 0xe0, 0x03, 0xe0, 0x03, 0xf0, 0x07, 0xf8, 0x0f, 0xf8, 0x0f, 6 | 0xfc, 0x1f, 0xfc, 0x1f, 0xfc, 0x1f, 0x00, 0x00}; 7 | -------------------------------------------------------------------------------- /analyzer/Bitmaps/xpat: -------------------------------------------------------------------------------- 1 | #define xpat_width 16 2 | #define xpat_height 16 3 | static char xpat_bits[] = { 4 | 0x11, 0x11, 0x11, 0x11, 0xaa, 0xaa, 0xaa, 0xaa, 0x44, 0x44, 0x44, 0x44, 5 | 0xaa, 0xaa, 0xaa, 0xaa, 0x11, 0x11, 0x11, 0x11, 0xaa, 0xaa, 0xaa, 0xaa, 6 | 0x44, 0x44, 0x44, 0x44, 0xaa, 0xaa, 0xaa, 0xaa}; 7 | -------------------------------------------------------------------------------- /analyzer/Depend: -------------------------------------------------------------------------------- 1 | coords.o: coords.c ana.h \ 2 | ../base/net.h ../base/defs.h ana_glob.h 3 | graphics.o: graphics.c \ 4 | ana_glob.h Bitmaps/gray Bitmaps/xpat Bitmaps/left_arrows \ 5 | Bitmaps/right_arrows Bitmaps/left_curs Bitmaps/left_mask \ 6 | Bitmaps/right_curs Bitmaps/right_mask Bitmaps/chk Bitmaps/iconbox \ 7 | Bitmaps/sizebox Bitmaps/select 8 | movetrace.o: movetrace.c ../base/globals.h ../base/net.h ana.h \ 9 | 10 | setsteps.o: setsteps.c ana.h \ 11 | ../base/net.h ../base/defs.h ana_glob.h 12 | analyzer.o: analyzer.c ../base/globals.h ../base/net.h ana.h \ 13 | 14 | defaults.o: defaults.c ana.h \ 15 | ../base/net.h ../base/defs.h ana_glob.h 16 | namelen.o: namelen.c ana.h \ 17 | ../base/net.h ../base/defs.h ana_glob.h 18 | textwind.o: textwind.c ana.h \ 19 | ../base/net.h ../base/defs.h ana_glob.h graphics.h 20 | zoom.o: zoom.c ana.h \ 21 | ../base/net.h ../base/defs.h ana_glob.h 22 | base.o: base.c ana.h \ 23 | ../base/net.h ../base/defs.h ana_glob.h graphics.h 24 | deltaT.o: deltaT.c ana.h \ 25 | ../base/net.h ../base/defs.h ana_glob.h graphics.h 26 | postscript.o: postscript.c ana.h \ 27 | ../base/net.h ../base/defs.h ana_glob.h 28 | update.o: update.c ana.h \ 29 | ../base/net.h ../base/defs.h ana_glob.h 30 | convert.o: convert.c ana.h \ 31 | ../base/net.h ../base/defs.h 32 | movetot.o: movetot.c ana.h \ 33 | ../base/net.h ../base/defs.h ana_glob.h 34 | tkana.o: tkana.c ana.h \ 35 | ../base/net.h ../base/defs.h graphics.h ana_glob.h ana_tk.h 36 | window.o: window.c ana.h \ 37 | ../base/net.h ../base/defs.h graphics.h ana_glob.h ana_tk.h 38 | -------------------------------------------------------------------------------- /analyzer/Makefile: -------------------------------------------------------------------------------- 1 | MODULE = analyzer 2 | IRSIMDIR = .. 3 | 4 | NULL_SRCS = noana.c 5 | X11_SRCS = coords.c graphics.c movetrace.c setsteps.c wm.c \ 6 | analyzer.c defaults.c icon.c namelen.c textwind.c zoom.c base.c \ 7 | deltaT.c menu.c postscript.c update.c convert.c event.c movetot.c \ 8 | scrollbar.c window.c 9 | TK_SRCS = coords.c graphics.c movetrace.c setsteps.c \ 10 | analyzer.c defaults.c namelen.c textwind.c zoom.c base.c \ 11 | deltaT.c postscript.c update.c convert.c movetot.c tkana.c \ 12 | window.c 13 | TOGL_SRCS = 14 | 15 | include ${IRSIMDIR}/defs.mak 16 | 17 | X11HELPER_SRCS = anXhelper.c 18 | X11HELP_PROG = anXhelper 19 | 20 | SRCS = ${GR_SRCS} 21 | OBJS = ${GR_SRCS:.c=.o} 22 | CFLAGS += ${GR_CFLAGS} -I${IRSIMDIR}/base 23 | DFLAGS += ${GR_DFLAGS} 24 | CLEANS += ${GR_HELPER_PROG} 25 | LIBS += ${GR_LIBS} 26 | 27 | main: ${GR_HELPER_PROG} 28 | 29 | ${GR_HELPER_PROG}: ${GR_HELPER_SRCS} 30 | @echo --- building main ${GR_HELPER_PROG} 31 | ${RM} ${GR_HELPER_PROG} 32 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${GR_HELPER_SRCS} -o ${GR_HELPER_PROG} ${LIBS} 33 | 34 | install: $(DESTDIR)${INSTALL_BINDIR}/${GR_HELPER_PROG} 35 | 36 | install-tcl: 37 | @echo --- Nothing to do for analyzer in Tcl version. 38 | 39 | $(DESTDIR)${INSTALL_BINDIR}/${GR_HELPER_PROG}: ${GR_HELPER_PROG} 40 | ${RM} $(DESTDIR)${INSTALL_BINDIR}/${GR_HELPER_PROG} 41 | ${CP} ${GR_HELPER_PROG} $(DESTDIR)${INSTALL_BINDIR} 42 | 43 | include ${IRSIMDIR}/rules.mak 44 | -------------------------------------------------------------------------------- /analyzer/anXhelper.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | /* 16 | * Helper process to simulate SIGIO signals from the X server to irsim's 17 | * analyzer. This problem is mostly due to ultrix's inability to generate 18 | * SIGIO for anything other than tty's "Gumby says Ultrix is snake oil". It 19 | * isn't needed for bsd - 4.3. 20 | * 21 | * The strategy is to wait for input from the X server by doing a select on 22 | * the server's file descriptor, which is set to be 0 by irsim, and sending 23 | * a SIGIO signal to the parent process whenever there's input to be read. 24 | * Handshaking is accomplished by waiting for a SIGINT signal from irsim. 25 | * This handshaking is needed since we don't know when the parent process 26 | * will decide to read the events and thus we avoid sending SIGIO signals 27 | * until irsim reads all events from the queue. 28 | */ 29 | 30 | #include 31 | #include 32 | #include 33 | #ifdef SYS_V 34 | # ifndef hpux 35 | # define signal( SIG, HAND ) sigset( SIG, HAND ) 36 | # endif 37 | # include 38 | #else 39 | # include 40 | #endif 41 | #include 42 | 43 | 44 | /* 45 | * SIGINT handler : Do nothing, just terminate pause 46 | */ 47 | 48 | #if defined( SYS_V ) || defined( LINUX ) 49 | 50 | void handler(int signo) 51 | { 52 | signal(SIGINT, handler); 53 | } 54 | 55 | #else 56 | 57 | int handler() 58 | { 59 | signal(SIGINT, handler); 60 | return(0); 61 | } 62 | 63 | #endif 64 | 65 | 66 | 67 | main() 68 | { 69 | int parent; /* parent process */ 70 | int f; 71 | #if defined(LINUX) || defined(SYSV) 72 | fd_set fdset; 73 | #else 74 | int fdset; /* fd-bit-set to check: fd == 0 always */ 75 | #endif 76 | struct timeval timx; 77 | 78 | for( f = 1; f < 15; f++ ) 79 | (void) close( f ); 80 | 81 | #ifdef TIOCNOTTY 82 | f = open( "/dev/tty", O_RDWR ); /* disconnect from terminal */ 83 | if( f > 0 ) 84 | { 85 | ioctl( f, TIOCNOTTY, 0 ); 86 | (void) close( f ); 87 | } 88 | #endif 89 | 90 | parent = getppid(); 91 | signal(SIGINT, handler); 92 | signal(SIGUSR1, SIG_IGN); 93 | 94 | do 95 | { 96 | #if defined(LINUX) || defined(SYSV) 97 | FD_ZERO(&fdset); 98 | FD_SET(1, &fdset); 99 | #else 100 | fdset = 1; 101 | #endif 102 | /* The code below is VERY important to LINUX. Linux select 103 | is different (see man select). It requires reset of timeval 104 | before EACH call. */ 105 | timx.tv_sec = 0; 106 | timx.tv_usec = 1; 107 | if( select( 1, &fdset, 0, 0, &timx ) != 1 ) 108 | continue; 109 | /* fprintf(stderr,"\nhandler SIGIO->parent\n"); */ 110 | if( kill( parent, SIGIO ) != 0 ) /* parent died */ 111 | break; 112 | (void) sigpause( 0 ); 113 | } 114 | while( 1 ); 115 | 116 | exit( 0 ); 117 | } 118 | -------------------------------------------------------------------------------- /analyzer/ana_tk.h: -------------------------------------------------------------------------------- 1 | /* ana_tk.h */ 2 | 3 | #ifdef TCL_IRSIM 4 | 5 | #include 6 | 7 | extern Tcl_Interp *irsiminterp; 8 | extern Tcl_Interp *consoleinterp; 9 | 10 | #endif 11 | -------------------------------------------------------------------------------- /analyzer/base.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | 17 | #include "ana.h" 18 | #include "ana_glob.h" 19 | #include "graphics.h" 20 | 21 | /*------------------------------------------------------*/ 22 | /* Change the base of the indicated vector trace */ 23 | /*------------------------------------------------------*/ 24 | 25 | public void ChangeTraceBase(trace, base) 26 | Trptr trace; 27 | char *base; 28 | { 29 | int change; 30 | short bdigits; 31 | 32 | if (!trace) { 33 | PRINT("\nSelect a trace first!"); 34 | XBell(display, 0); 35 | return; 36 | } 37 | 38 | switch (tolower(*base)) { 39 | case 'b' : 40 | bdigits = 1; 41 | break; 42 | case 'q' : 43 | bdigits = 2; 44 | break; 45 | case 'o' : 46 | bdigits = 3; 47 | break; 48 | case 'h' : 49 | bdigits = 4; 50 | break; 51 | case 'd' : /* special cases: unsigned & signed decimal */ 52 | bdigits = 5; 53 | break; 54 | case 's' : 55 | bdigits = 6; 56 | break; 57 | default: 58 | PRINT("\nUnknown base type!"); 59 | return; 60 | } 61 | 62 | if (IsVector(trace) && trace->bdigit != bdigits) { 63 | trace->bdigit = bdigits; 64 | change = WindowChanges(); 65 | if (change & RESIZED) 66 | return; /* will get ExposeWindow event later */ 67 | 68 | if (change & WIDTH_CHANGE) { /* reshape the trace window */ 69 | DrawScrollBar(FALSE); 70 | RedrawTimes(); 71 | DrawCursVal(cursorBox); 72 | DrawTraces(tims.start, tims.end); 73 | } 74 | else { 75 | BBox rb; 76 | 77 | rb.top = trace->top; 78 | rb.bot = trace->bot; 79 | rb.left = cursorBox.left; 80 | rb.right = cursorBox.right; 81 | DrawCursVal(rb); 82 | rb.left = traceBox.left; 83 | rb.right = traceBox.right; 84 | RedrawTraces(&rb); /* just redraw this trace */ 85 | } 86 | } 87 | } 88 | 89 | /*-----------------------------------------------------------------------*/ 90 | /* This is the original function usage---acts on the selected trace only */ 91 | /*-----------------------------------------------------------------------*/ 92 | 93 | public void ChangeBase(base) 94 | char *base; 95 | { 96 | ChangeTraceBase(selectedTrace, base); 97 | } 98 | -------------------------------------------------------------------------------- /analyzer/convert.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include "ana.h" 17 | 18 | private char result[ 200 ]; 19 | private char HexMap[] = "0123456789abcdefX"; 20 | 21 | 22 | /* 23 | * Convert a trace entry (vector) to an ascii string 24 | */ 25 | public char *HistToStr( hist, nbits, b_digit, offset ) 26 | hptr *hist; 27 | int nbits, b_digit, offset; 28 | { 29 | register char *p; 30 | register int i, j; 31 | Ulong digit; 32 | 33 | /* Handle decimal notation (special cases) */ 34 | /* Since decimal does not map directly to bits, */ 35 | /* we only print the result if no bits are unknown. */ 36 | 37 | if (b_digit == 5) { 38 | hptr *htmp = hist; 39 | for (i = nbits; i > 0; i--) { 40 | if ((*htmp)->val == X) { 41 | sprintf(result, "???"); 42 | return (result); 43 | } 44 | htmp += offset; 45 | } 46 | digit = (Ulong)0; 47 | for (i = nbits; i > 0; i--) { 48 | digit <<= 1; 49 | if ((*hist)->val == HIGH) digit |= 1; 50 | hist += offset; 51 | } 52 | if (digit < 0) 53 | sprintf(result, "(overflow)"); 54 | else 55 | sprintf(result, PRINTF_LLONG "u", digit); 56 | return (result); 57 | } 58 | 59 | /* Handle signed decimal notation */ 60 | 61 | else if (b_digit == 6) { 62 | hptr *htmp = hist; 63 | char negative; 64 | 65 | negative = ((*htmp)->val == HIGH) ? 1 : 0; 66 | for (i = nbits; i > 0; i--) { 67 | if ((*htmp)->val == X) { 68 | sprintf(result, "???"); 69 | return (result); 70 | } 71 | htmp += offset; 72 | } 73 | digit = (Ulong)0; 74 | for (i = nbits; i > 0; i--) { 75 | digit <<= 1; 76 | if (((negative == 1) && ((*hist)->val == LOW)) || 77 | ((negative == 0) && ((*hist)->val == HIGH))) 78 | digit |= 1; 79 | hist += offset; 80 | } 81 | if (negative) digit = -(digit + 1); 82 | sprintf(result, PRINTF_LLONG "d", digit); 83 | return (result); 84 | } 85 | 86 | p = result; 87 | j = nbits % b_digit; 88 | if( j == 0 ) 89 | j = b_digit; 90 | for( i = nbits; i > 0; i -= j ) 91 | { 92 | digit = 0; 93 | do 94 | { 95 | switch( (*hist)->val ) 96 | { 97 | case LOW : 98 | digit = (digit << 1); 99 | break; 100 | case HIGH : 101 | digit = (digit << 1) | 1; 102 | break; 103 | case X : 104 | digit = 16; 105 | while( j != 1 ) 106 | { 107 | j--; 108 | hist += offset; 109 | } 110 | break; 111 | } 112 | j--; 113 | hist += offset; 114 | } 115 | while( j > 0 ); 116 | *p++ = HexMap[ digit ]; 117 | j = b_digit; 118 | } 119 | *p = '\0'; 120 | return( result ); 121 | } 122 | -------------------------------------------------------------------------------- /analyzer/defaults.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #ifdef LINUX 16 | #include 17 | #endif 18 | #include "ana.h" 19 | #include "defs.h" 20 | #include "ana_glob.h" 21 | 22 | public 23 | #define DEFL_GEOM 0 24 | public 25 | #define DEFL_BG 1 26 | public 27 | #define DEFL_FG 2 28 | public 29 | #define DEFL_RV 3 30 | public 31 | #define DEFL_HIGL 4 32 | public 33 | #define DEFL_TRCOLOR 5 34 | public 35 | #define DEFL_BANN_BG 6 36 | public 37 | #define DEFL_BANN_FG 7 38 | public 39 | #define DEFL_BDRCOLOR 8 40 | public 41 | #define DEFL_FONT 9 42 | public 43 | #define DEFL_BDRWIDTH 10 44 | 45 | 46 | typedef struct 47 | { 48 | char *name; 49 | char *defl; 50 | } Assoc; 51 | 52 | 53 | private Assoc assoc[] = 54 | { 55 | { "geometry", "=1000x300+0+0" }, 56 | { "background", "black" }, 57 | { "foreground", "white" }, 58 | { "reverseVideo", "off" }, 59 | { "highlight", "red" }, 60 | { "traceColor", "white" }, 61 | { "bannerBg", "white" }, 62 | { "bannerFg", "black" }, 63 | { "borderColor", "black" }, 64 | { "font", "6x13" }, 65 | { "borderWidth", "2" }, 66 | }; 67 | 68 | 69 | private char *irsim = "irsim"; 70 | 71 | public char *GetXDefault( key ) 72 | int key; 73 | { 74 | char *val; 75 | 76 | val = XGetDefault( display, irsim, assoc[ key ].name ); 77 | return( (val != NULL) ? val : assoc[ key ].defl ); 78 | } 79 | 80 | 81 | public int IsDefault( key, val ) 82 | int key; 83 | char *val; 84 | { 85 | if( assoc[ key ].defl == val ) 86 | return( TRUE ); 87 | return( (strcmp( assoc[ key ].defl, val ) == 0) ? TRUE : FALSE ); 88 | } 89 | 90 | 91 | public char *ProgDefault( key ) 92 | int key; 93 | { 94 | return( assoc[ key ].defl ); 95 | } 96 | -------------------------------------------------------------------------------- /analyzer/graphics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | 16 | #define VLine( WIND, X, BOT, TOP, GCX ) \ 17 | XFillRectangle( display, WIND, GCX, X, TOP, 1, (BOT) - (TOP) + 1 ) 18 | 19 | #define HLine( WIND, LEFT, RIGHT, Y, GCX ) \ 20 | XFillRectangle( display, WIND, GCX, LEFT, Y, (RIGHT) - (LEFT) + 1, 1 ) 21 | 22 | #define FillAREA( WIND, X, Y, WIDTH, HEIGHT, GCX ) \ 23 | XFillRectangle( display, WIND, GCX, X, Y, WIDTH, HEIGHT ) 24 | 25 | #define InvAREA( WIND, X, Y, WIDTH, HEIGHT ) \ 26 | XFillRectangle( display, WIND, gcs.inv, X, Y, WIDTH, HEIGHT ) 27 | 28 | #define BWID( Bx ) ( (Bx).right - (Bx).left + 1 ) 29 | #define BHIG( Bx ) ( (Bx).bot - (Bx).top + 1 ) 30 | 31 | #define FillBox( WIND, B, GCX ) \ 32 | XFillRectangle( display, WIND, GCX, B.left, B.top, BWID(B), BHIG(B) ) 33 | 34 | #define InvBox( W, B ) \ 35 | XFillRectangle( display, W, gcs.invert, (B).left, (B).top, BWID(B), BHIG(B) ) 36 | 37 | #define OutlineBox( WIND, B, GCX ) \ 38 | XDrawRectangle( display, WIND, GCX, (B).left, (B).top, BWID(B)-1, BHIG(B)-1 ) 39 | 40 | #define StrLeft( WIND, S, LEN, LEFT, BOT, GCX ) \ 41 | XDrawImageString( display, WIND, GCX, LEFT, (BOT) - descent, S, LEN ) 42 | 43 | #define StrRight( WIND, S, LEN, RIGHT, BOT, GCX ) \ 44 | XDrawImageString( display, WIND, GCX, \ 45 | (RIGHT) - (LEN) * CHARWIDTH +1, (BOT) - descent, S, LEN ) 46 | 47 | #define StrCenter( WIND, S, LEN, LEFT, RIGHT, BOT, GCX ) \ 48 | XDrawImageString( display, WIND, GCX, \ 49 | ((RIGHT) + (LEFT) - CHARWIDTH * (LEN)) / 2, (BOT) - descent, S, LEN ) 50 | 51 | -------------------------------------------------------------------------------- /analyzer/helper.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Define NEED_HELPER if the system does not support SIGIO on sockets 4 | * and if we are not using pthreads. 5 | */ 6 | 7 | #if defined( ultrix ) 8 | # if !defined( ULTRIX_VERSION ) 9 | # define NEED_HELPER 10 | # elif ULTRIX_VERSION <= 3 11 | # define NEED_HELPER 12 | # endif 13 | #elif defined( hp9000s300 ) 14 | # define NEED_HELPER 15 | #else 16 | # ifdef NO_SIGIO /* this comes from CFLAGS at the top */ 17 | # define NEED_HELPER 18 | # endif 19 | #endif 20 | -------------------------------------------------------------------------------- /analyzer/icon.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include "ana.h" 16 | #include "graphics.h" 17 | #include 18 | #include "ana_glob.h" 19 | 20 | #include "Bitmaps/opus" 21 | 22 | 23 | public Pixmap InitIconBitmap() 24 | { 25 | return( XCreateBitmapFromData( display, DefaultRootWindow( display ), 26 | opus_bits, opus_width, opus_height ) ); 27 | } 28 | 29 | 30 | public void RedrawIcon( exv ) 31 | XEvent *exv; 32 | { 33 | XCopyPlane( display, pix.icon, iconW, gcs.black, 0, 0, opus_width, 34 | opus_height, 0, 0, 1 ); 35 | } 36 | 37 | 38 | public Window CreateIconWindow( x, y ) 39 | Coord x, y; 40 | { 41 | Window icw; 42 | 43 | icw = XCreateWindow( display, RootWindowOfScreen( screen ), x, y, 44 | opus_width, opus_height, 1, DefaultDepthOfScreen( screen ), InputOutput, 45 | (Visual *) CopyFromParent, 0L, (XSetWindowAttributes *) NULL ); 46 | 47 | XSetWindowBackground( display, icw, colors.white ); 48 | XSetWindowBorder( display, icw, colors.black ); 49 | 50 | XSelectInput( display, icw, ExposureMask ); 51 | 52 | return( icw ); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /analyzer/movetot.c: -------------------------------------------------------------------------------- 1 | /***** Copyright (C) 1989 Stanford University, Arturo Salz ****/ 2 | 3 | #include 4 | #include 5 | 6 | #include "ana.h" 7 | #include "ana_glob.h" 8 | 9 | public void MoveToTimeValue(TimeType start) 10 | { 11 | if (start == tims.start) 12 | return; 13 | else if (start < tims.first) 14 | start = tims.first; 15 | else if (start > tims.last) 16 | start = tims.last; 17 | 18 | tims.start = start; 19 | tims.end = start + tims.steps; 20 | RedrawTimes(); 21 | UpdateScrollBar(); 22 | DrawTraces(start, tims.end); 23 | } 24 | 25 | public void MoveToT(char *str) 26 | { 27 | double tmp; 28 | TimeType start; 29 | 30 | if (str == NULL) { 31 | XBell(display, 0); 32 | return; 33 | } 34 | tmp = atof(str); 35 | if (tmp < 0.0) tmp = 0.0; 36 | start = (TimeType) ns2d(tmp); 37 | MoveToTimeValue(start); 38 | } 39 | 40 | public void MoveToTime(char *s) 41 | { 42 | /* Argument "s" is the menu string; ignore it. */ 43 | Query( "\nEnter Time > ", MoveToT ); 44 | } 45 | 46 | /*----------------------------------------------------------------------*/ 47 | /* Determine if the indicated time (in ps) is valid. Return 0 if the */ 48 | /* time is within the simulation period and on-screen. Return -1 if */ 49 | /* the time is within the simulation period but outside the analyzer */ 50 | /* window bounds. Return -2 if the time is in the future of the */ 51 | /* simulation, and -3 if the time is invalid (< 0). */ 52 | /*----------------------------------------------------------------------*/ 53 | 54 | public int ValidTime(TimeType t) 55 | { 56 | if (t < tims.start) 57 | return -3; 58 | else if (t > tims.end) 59 | return -2; 60 | else if ((t < tims.first) || (t > tims.last)) 61 | return -1; 62 | else 63 | return 0; 64 | } 65 | -------------------------------------------------------------------------------- /analyzer/namelen.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include /* for atoi() */ 17 | #include /* for strlen() */ 18 | 19 | #include "ana.h" 20 | #include "ana_glob.h" 21 | 22 | public int max_name_len = 15; 23 | 24 | 25 | public void GetNameLen( str ) 26 | char *str; 27 | { 28 | Trptr t; 29 | int len, change, wasTooSmall; 30 | 31 | if( str == NULL ) 32 | { 33 | XBell( display, 0 ); 34 | return; 35 | } 36 | len = atoi( str ); 37 | if( len < 8 or len > 256 ) 38 | { 39 | XBell( display, 0 ); 40 | return; 41 | } 42 | 43 | if( len == max_name_len ) 44 | return; 45 | 46 | max_name_len = len; 47 | 48 | DisableInput(); 49 | 50 | for( t = traces.first; t != NULL; t = t->next ) 51 | { 52 | if( t->vector ) 53 | t->name = SetName( t->n.vec->name ); 54 | else 55 | t->name = SetName( t->n.nd->nname ); 56 | t->len = strlen( t->name ); 57 | } 58 | 59 | if( windowState.iconified ) 60 | { 61 | EnableInput(); 62 | return; 63 | } 64 | 65 | wasTooSmall = windowState.tooSmall; 66 | 67 | change = WindowChanges(); 68 | if( windowState.tooSmall ) 69 | { 70 | RedrawSmallW(); 71 | EnableInput(); 72 | return; 73 | } 74 | 75 | if( change & WIDTH_CHANGE ) 76 | { 77 | if( wasTooSmall ) 78 | { 79 | RedrawBanner(); 80 | RedrawText(); 81 | DrawCursVal( cursorBox ); 82 | } 83 | RedrawNames( namesBox ); 84 | DrawScrollBar( wasTooSmall ); 85 | RedrawTimes(); 86 | DrawTraces( tims.start, tims.end ); 87 | } 88 | 89 | EnableInput(); 90 | } 91 | 92 | 93 | public void SetNameLen( s ) 94 | char *s; /* the menu string => ignore it */ 95 | { 96 | PRINTF( "\nEnter max. length (%d) > ", max_name_len ); 97 | Query( " > ", GetNameLen ); 98 | } 99 | -------------------------------------------------------------------------------- /analyzer/noana.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include "defs.h" 17 | #include "net.h" 18 | 19 | 20 | extern void lprintf(); 21 | 22 | 23 | typedef long TimeType; 24 | 25 | 26 | public int AddNode( nd, flag ) 27 | nptr nd; 28 | int *flag; 29 | { 30 | return( 1 ); 31 | } 32 | 33 | public int AddVector( vec, flag ) 34 | bptr vec; 35 | int *flag; 36 | { 37 | return( 1 ); 38 | } 39 | 40 | public void DisplayTraces( isMapped ) int isMapped; {} 41 | 42 | public void StopAnalyzer() {} 43 | 44 | public void RestartAnalyzer( first_time, last_time, same_hist ) 45 | Ulong first_time, last_time; 46 | int same_hist; 47 | {} 48 | 49 | public void ClearTraces() {} 50 | 51 | public void RemoveVector( b ) bptr b; {} 52 | 53 | public void RemoveNode( n ) nptr n; {} 54 | 55 | public void RemoveAllDeleted() {} 56 | 57 | public void UpdateWindow( endT ) TimeType endT; {} 58 | 59 | public void TerminateAnalyzer() {} 60 | 61 | public int InitDisplay( fname, display_unit ) 62 | char *fname; 63 | char *display_unit; 64 | { 65 | (void) lprintf( stdout, "No analyzer in this version\n" ); 66 | return( FALSE ); 67 | } 68 | 69 | public void InitTimes( firstT, stepsize, lastT, reInit ) 70 | TimeType firstT, stepsize, lastT; 71 | {} 72 | -------------------------------------------------------------------------------- /analyzer/setsteps.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include 17 | 18 | #include "ana.h" 19 | #include "ana_glob.h" 20 | 21 | 22 | private void GetWidth( str ) 23 | char *str; 24 | { 25 | TimeType steps; 26 | double tmp; 27 | 28 | if( str == NULL ) 29 | { 30 | XBell( display, 0 ); 31 | return; 32 | } 33 | tmp = atof( str ); 34 | steps = ns2d( tmp ); 35 | if( steps < 10 or (tims.start + steps) > MAX_TIME ) 36 | { 37 | XBell( display, 0 ); 38 | return; 39 | } 40 | 41 | tims.steps = steps; 42 | tims.end = tims.start + steps; 43 | RedrawTimes(); 44 | UpdateScrollBar(); 45 | DrawTraces( tims.start, tims.end ); 46 | } 47 | 48 | 49 | public void SetWidth( s ) 50 | char *s; /* the menu string => ignore it */ 51 | { 52 | Query( "\nEnter Time Steps > ", GetWidth ); 53 | } 54 | 55 | #ifdef TCL_IRSIM 56 | 57 | public void SetTimeLeft(TimeType tx) 58 | { 59 | tims.start = tx; 60 | if (tims.start >= tims.end) 61 | tims.start = tims.end - 1; 62 | if (tims.start < tims.first) 63 | tims.start = tims.first; 64 | tims.steps = tims.end - tims.start; 65 | RedrawTimes(); 66 | DrawTraces(tims.start, tims.end); 67 | } 68 | 69 | public void SetTimeRight(TimeType tx) 70 | { 71 | tims.end = tx; 72 | if (tims.end < tims.start) 73 | tims.end = tims.start + 1; 74 | tims.steps = tims.end - tims.start; 75 | RedrawTimes(); 76 | DrawTraces(tims.start, tims.end); 77 | } 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /analyzer/update.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | 17 | #include "ana.h" 18 | #include "ana_glob.h" 19 | 20 | 21 | public int autoScroll = TRUE; 22 | public int updatePending = FALSE; 23 | public TimeType updPendTime; 24 | public int freezeWindow = FALSE; 25 | 26 | 27 | public void ScrollUpdate( m ) 28 | MenuItem *m; 29 | { 30 | autoScroll ^= TRUE; /* toggle flag */ 31 | 32 | if( autoScroll ) 33 | m->mark = MENU_MARK; 34 | else 35 | m->mark = MENU_UNMARK; 36 | } 37 | 38 | 39 | public void DisableScroll() 40 | { 41 | freezeWindow = TRUE; 42 | } 43 | 44 | 45 | public void RestoreScroll() 46 | { 47 | freezeWindow = FALSE; 48 | if( updatePending ) 49 | UpdateWindow( updPendTime ); 50 | 51 | updatePending = FALSE; 52 | } 53 | -------------------------------------------------------------------------------- /analyzer/zoom.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include "ana.h" 16 | #include "ana_glob.h" 17 | 18 | 19 | public void Zoom( what ) 20 | char *what; 21 | { 22 | TimeType start; 23 | int steps; 24 | 25 | switch( *what ) 26 | { 27 | case 'i' : /* zoom in */ 28 | steps = tims.steps / 2; 29 | if( steps < 10 ) 30 | steps = 10; 31 | start = tims.start + steps / 2; 32 | if( start > tims.last ) 33 | { 34 | start = tims.last - steps / 2; 35 | if( start < tims.first ) 36 | start = tims.first; 37 | } 38 | break; 39 | 40 | case 'o' : /* zoom out */ 41 | steps = tims.steps * 2; 42 | if (tims.start < tims.steps / 2) 43 | start = 0; 44 | else 45 | start = tims.start - tims.steps / 2; 46 | if( start < tims.first ) 47 | start = tims.first; 48 | if( steps > MAX_TIME or (start + steps) > MAX_TIME ) 49 | return; 50 | break; 51 | } 52 | 53 | if( tims.steps != steps ) 54 | { 55 | tims.start = start; 56 | tims.steps = steps; 57 | tims.end = start + steps; 58 | RedrawTimes(); 59 | UpdateScrollBar(); 60 | DrawTraces( start, tims.end ); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /base/ASSERT.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | 16 | #ifndef ASSERT 17 | 18 | #ifdef DEBUG 19 | 20 | #define ASSERT( EXP ) if( ! (EXP) ) 21 | 22 | #else 23 | 24 | #define ASSERT( EXP ) if( 0 ) 25 | 26 | #endif /* DEBUG */ 27 | 28 | #endif /* ASSERT */ 29 | -------------------------------------------------------------------------------- /base/Depend: -------------------------------------------------------------------------------- 1 | access.o: access.c defs.h 2 | binsim.o: binsim.c defs.h net.h globals.h rsim.h bin_io.h net_macros.h 3 | cad_dir.o: cad_dir.c defs.h 4 | config.o: config.c defs.h net.h globals.h 5 | conn_list.o: conn_list.c defs.h net.h net_macros.h ASSERT.h globals.h 6 | eval.o: eval.c defs.h net.h globals.h 7 | fio.o: fio.c defs.h net.h globals.h 8 | hist.o: hist.c defs.h net.h ASSERT.h globals.h 9 | hist_io.o: hist_io.c defs.h net.h ASSERT.h bin_io.h globals.h 10 | intr.o: intr.c defs.h 11 | mem.o: mem.c defs.h 12 | netupdate.o: netupdate.c defs.h net.h globals.h net_macros.h 13 | network.o: network.c defs.h net.h globals.h 14 | newrstep.o: newrstep.c defs.h net.h globals.h spiketbl.c 15 | nsubrs.o: nsubrs.c defs.h net.h globals.h 16 | parallel.o: parallel.c defs.h net.h globals.h net_macros.h 17 | prints.o: prints.c defs.h 18 | rsim.o: rsim.c defs.h net.h globals.h rsim.h 19 | sched.o: sched.c defs.h net.h globals.h ASSERT.h 20 | sim.o: sim.c defs.h net.h globals.h net_macros.h 21 | sstep.o: sstep.c net.h defs.h globals.h stables.c 22 | stack.o: stack.c defs.h net.h globals.h net_macros.h 23 | tpos.o: tpos.c defs.h net.h globals.h 24 | usage.o: usage.c defs.h 25 | -------------------------------------------------------------------------------- /base/Makefile: -------------------------------------------------------------------------------- 1 | MODULE = base 2 | IRSIMDIR = .. 3 | SRCS = access.c binsim.c cad_dir.c config.c conn_list.c eval.c fio.c \ 4 | hist.c hist_io.c intr.c mem.c netupdate.c network.c \ 5 | newrstep.c nsubrs.c parallel.c prints.c rsim.c sched.c sim.c \ 6 | sstep.c stack.c tpos.c usage.c ${OTHER_SRCS} 7 | 8 | include ${IRSIMDIR}/defs.mak 9 | include ${IRSIMDIR}/rules.mak 10 | -------------------------------------------------------------------------------- /base/access.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | /* 16 | * front-end to the more general 'access' facility. 17 | */ 18 | 19 | #include 20 | #include /* defines access() */ 21 | #include 22 | #include 23 | 24 | #include "defs.h" 25 | 26 | public typedef struct 27 | { 28 | char exist; 29 | char read; 30 | char write; 31 | } Fstat; 32 | 33 | 34 | public Fstat *FileStatus( name ) 35 | char *name; 36 | { 37 | static Fstat ret; 38 | char dir[ 256 ]; 39 | register char *s, *q, *p; 40 | 41 | if( access( name, R_OK ) == 0 ) 42 | ret.read = 1; /* file exists and is readable */ 43 | else 44 | ret.read = 0; 45 | 46 | if( access( name, W_OK ) == 0 ) /* file exists and is writeable */ 47 | { 48 | ret.exist = 1; 49 | ret.write = 1; 50 | return( &ret ); 51 | } 52 | 53 | if( access( name, F_OK ) == 0 ) /* file exists but isn't writeable */ 54 | { 55 | ret.exist = 1; 56 | ret.write = 0; 57 | return( &ret ); 58 | } 59 | /* file doesn't exist, check dir. */ 60 | p = name; 61 | for( s = p; *s != '\0'; s++ ); 62 | while( s > p and *s != '/' ) s--; 63 | if( *s == '/' ) s++; 64 | q = dir; 65 | while( p < s ) 66 | *q++ = *p++; 67 | *q++ = '.'; 68 | *q = '\0'; 69 | if( access( dir, W_OK ) == 0 ) 70 | ret.write = 1; /* dir. is writeable */ 71 | else 72 | ret.write = 0; 73 | ret.exist = 0; 74 | return( &ret ); 75 | } 76 | -------------------------------------------------------------------------------- /base/bin_io.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | /* 16 | * Macros to read/write machine-independent binary files. 17 | */ 18 | 19 | 20 | /* 21 | * Extract NBYTES from byte stream BUFF and place result in NUM. 22 | * Restriction is 1 <= NBYTES <= 4. (Force Unrolling of loops). 23 | */ 24 | #define UnpackBytes( BUFF, NUM, NBYTES ) \ 25 | { \ 26 | register unsigned char *B_S = (unsigned char *) (BUFF); \ 27 | register unsigned long RES = 0; \ 28 | \ 29 | if( NBYTES == 1 ) \ 30 | RES = *B_S; \ 31 | else if( NBYTES == 2 ) \ 32 | { \ 33 | RES = B_S[0]; \ 34 | RES += ( ((unsigned int) B_S[1]) << 8 ) & 0x0ff00; \ 35 | } \ 36 | else if( NBYTES == 3 ) \ 37 | { \ 38 | RES = B_S[0]; \ 39 | RES += ( ((unsigned int) B_S[1]) << 8 ) & 0x0ff00; \ 40 | RES += ( ((unsigned int) B_S[2]) << 16 ) & 0x0ff0000; \ 41 | } \ 42 | else if( NBYTES == 4 ) \ 43 | { \ 44 | RES = B_S[0]; \ 45 | RES += ( ((unsigned int) B_S[1]) << 8 ) & 0x0ff00; \ 46 | RES += ( ((unsigned int) B_S[2]) << 16 ) & 0x0ff0000; \ 47 | RES += ( ((unsigned int) B_S[3]) << 24 ) & 0xff000000; \ 48 | } \ 49 | NUM = RES; \ 50 | } \ 51 | 52 | 53 | /* 54 | * Pack NBYTES from NUM into byte stream pointed to by BUFF. 55 | * Restriction is 1 <= NBYTES <= 4. (Force Unrolling of loops). 56 | */ 57 | #define PackBytes( BUFF, NUM, NBYTES ) \ 58 | { \ 59 | register unsigned long B_T = (NUM); \ 60 | register unsigned char *B_S = (unsigned char *) (BUFF); \ 61 | \ 62 | if( NBYTES > 3 ) \ 63 | { \ 64 | *B_S++ = B_T & 0x0ff; \ 65 | B_T >>= 8; \ 66 | } \ 67 | if( NBYTES > 2 ) \ 68 | { \ 69 | *B_S++ = B_T & 0x0ff; \ 70 | B_T >>= 8; \ 71 | } \ 72 | if( NBYTES > 1 ) \ 73 | { \ 74 | *B_S++ = B_T & 0x0ff; \ 75 | B_T >>= 8; \ 76 | } \ 77 | *B_S = B_T & 0x0ff; \ 78 | } \ 79 | 80 | -------------------------------------------------------------------------------- /base/cad_dir.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | #include /* for strlen() */ 19 | #include 20 | #include 21 | 22 | #include "defs.h" 23 | 24 | public char *cad_lib; 25 | public char *cad_bin; 26 | 27 | extern char *getenv(); 28 | extern struct passwd *getpwnam(); 29 | extern char *Valloc(); 30 | 31 | 32 | public void InitCAD() 33 | { 34 | char *s; 35 | struct passwd *pwd; 36 | int len; 37 | 38 | /* Try CAD_ROOT environment variable */ 39 | 40 | if (s = getenv("CAD_ROOT")) 41 | { 42 | if (!access(s, F_OK) == 0) 43 | s = CAD_DIR; 44 | } 45 | 46 | /* Default is taken from CAD_DIR definition at compile time */ 47 | 48 | else 49 | s = CAD_DIR; 50 | 51 | len = strlen( s ); 52 | cad_lib = Valloc( len + 1, 1 ); 53 | (void) sprintf( cad_lib, "%s", s ); 54 | 55 | len = strlen( BIN_DIR ); 56 | cad_bin = Valloc( len + 1, 1 ); 57 | (void) sprintf( cad_bin, "%s", BIN_DIR ); 58 | } 59 | -------------------------------------------------------------------------------- /base/conn_list.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include "defs.h" 17 | #include "net.h" 18 | #include "net_macros.h" 19 | #include "ASSERT.h" 20 | #include "globals.h" 21 | 22 | public tptr parallel_xtors[ MAX_PARALLEL ]; 23 | 24 | /* 25 | * Build a linked-list of nodes (using nlink entry in Node structure) 26 | * which are electrically connected to node 'n'. No special order 27 | * is required so tree walk is performed non-recursively by doing a 28 | * breath-first traversal. The value caches for each transistor we 29 | * come across are reset here. Loops are broken at an arbitrary point 30 | * and parallel transistors are identified. 31 | */ 32 | public void BuildConnList( n ) 33 | register nptr n; 34 | { 35 | register nptr next, this, other; 36 | register tptr t; 37 | register lptr l; 38 | int n_par = 0; 39 | 40 | n->nflags &= ~VISITED; 41 | withdriven = FALSE; 42 | 43 | next = this = n->nlink = n; 44 | do 45 | { 46 | for( l = this->nterm; l != NULL; l = l->next ) 47 | { 48 | t = l->xtor; 49 | if( t->state == OFF ) 50 | continue; 51 | if( t->tflags & CROSSED ) /* Each transistor is crossed twice */ 52 | { 53 | t->tflags &= ~CROSSED; 54 | continue; 55 | } 56 | t->scache.r = t->dcache.r = NULL; 57 | 58 | other = other_node( t, this ); 59 | 60 | if( other->nflags & INPUT ) 61 | { 62 | withdriven = TRUE; 63 | continue; 64 | } 65 | 66 | t->tflags |= CROSSED; /* Crossing trans 1st time */ 67 | 68 | if( other->nlink == NULL ) /* New node in this stage */ 69 | { 70 | other->nflags &= ~VISITED; 71 | other->nlink = n; 72 | next->nlink = other; 73 | next = other; 74 | other->n.tran = t; /* we reach other through t */ 75 | } 76 | else if( model_num != LIN_MODEL ) 77 | continue; 78 | else if( hash_terms( other->n.tran ) == hash_terms( t ) ) 79 | { /* parallel transistors */ 80 | register tptr tran = other->n.tran; 81 | 82 | if( tran->tflags & PARALLEL ) 83 | t->dcache.t = par_list( tran ); 84 | else 85 | { 86 | if( n_par >= MAX_PARALLEL ) 87 | { 88 | WarnTooManyParallel( this->nname, other->nname ); 89 | t->tflags |= PBROKEN; /* simply ignore it */ 90 | continue; 91 | } 92 | tran->n_par = n_par++; 93 | tran->tflags |= PARALLEL; 94 | } 95 | par_list( tran ) = t; 96 | t->tflags |= PBROKEN; 97 | } 98 | else 99 | { /* we have a loop, break it */ 100 | t->tflags |= BROKEN; 101 | } 102 | } 103 | } 104 | while( (this = this->nlink) != n ); 105 | 106 | next->nlink = NULL; /* terminate connection list */ 107 | } 108 | 109 | 110 | public void WarnTooManyParallel( s1, s2 ) 111 | char *s1, *s2; 112 | { 113 | static int did_it = FALSE; 114 | 115 | if( did_it ) 116 | return; 117 | lprintf( stderr, 118 | "There are too many transistors in parallel (> %d)\n", MAX_PARALLEL ); 119 | lprintf( stderr, 120 | "Simulation results may be inaccurate, to fix this you may have to\n" ); 121 | lprintf( stderr, 122 | "increase this limit in '%s'.\n", __FILE__ ); 123 | lprintf( stderr, 124 | "Note: This condition often occurs when Vdd or Gnd are not connected\n" ); 125 | lprintf( stderr, 126 | " to all cells. Check the vicinity of the following 2 nodes:\n" ); 127 | lprintf( stderr, " %s\n %s\n", s1, s2 ); 128 | did_it = TRUE; 129 | } 130 | -------------------------------------------------------------------------------- /base/defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #ifndef _DEFS_H 16 | #define _DEFS_H 17 | 18 | /* Global definitions used by all modules */ 19 | 20 | #define or || 21 | #define and && 22 | #define not ! 23 | 24 | #define private static 25 | #define public 26 | 27 | #define SWAP( TYPE, A, B ) \ 28 | { \ 29 | register TYPE TMP; \ 30 | \ 31 | TMP = (A); \ 32 | (A) = (B); \ 33 | (B) = TMP; \ 34 | } \ 35 | 36 | #ifdef SYS_V 37 | #ifndef bcopy 38 | #define bcopy( A, B, C ) memcpy( B, A, C ) 39 | #endif 40 | #ifndef bcmp 41 | #define bcmp( A, B, C ) memcmp( B, A, C ) 42 | #endif 43 | #endif 44 | 45 | #endif /* _DEFS_H */ 46 | -------------------------------------------------------------------------------- /base/fio.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "defs.h" 20 | #include "net.h" 21 | #include "globals.h" 22 | 23 | #ifndef clearerr 24 | extern void clearerr(); 25 | #endif 26 | 27 | /* 28 | * My version of fgets, fread, and fwrite. These routines provide the same 29 | * functionality as the stdio ones; taking care of restarting the operation 30 | * upon an interrupt condition. This is mostly for system V. 31 | */ 32 | 33 | public char *fgetline( bp, len, fp ) 34 | char *bp; 35 | register int len; 36 | register FILE *fp; 37 | { 38 | register char *buff = bp; 39 | register int c; 40 | 41 | contline = 0; 42 | while( --len > 0 ) 43 | { 44 | again : 45 | 46 | c = getc( fp ); 47 | if( c == EOF ) { 48 | if( feof( fp ) == 0 ) { 49 | clearerr( fp ); 50 | goto again; 51 | } 52 | *buff = '\0'; 53 | return( NULL ); 54 | } 55 | if ((fp == stdin) && (c == '\b') && (buff > bp)) { 56 | printf("\b \b"); fflush(stdout); *buff--; 57 | } else { 58 | if((c == '\\') && (*bp != '|')){ 59 | c = getc(fp); 60 | contline++; 61 | if( isatty( (int) fileno( fp ) ) ) { 62 | printf("cont>"); 63 | fflush(stdout); 64 | } 65 | goto again; 66 | } 67 | if (c != '\b') 68 | *buff++ = c; 69 | } 70 | if((c == '\n') || (c == 0xd)) { 71 | c = '\n'; 72 | break; 73 | } 74 | } 75 | *buff = '\0'; 76 | if (len <= 0) { 77 | printf("Command line max length exceeded.\n"); 78 | exit(-1); 79 | } 80 | return( bp ); 81 | } 82 | 83 | 84 | public int Fread( ptr, size, fp ) 85 | char *ptr; 86 | int size; 87 | FILE *fp; 88 | { 89 | register int ret; 90 | 91 | again : 92 | ret = fread( ptr, 1, size, fp ); 93 | if( ret <= 0 and feof( fp ) == 0 ) 94 | { 95 | clearerr( fp ); 96 | goto again; 97 | } 98 | return( ret ); 99 | } 100 | 101 | 102 | public int Fwrite( ptr, size, fp ) 103 | char *ptr; 104 | int size; 105 | FILE *fp; 106 | { 107 | register int ret; 108 | 109 | again : 110 | ret = fwrite( ptr, 1, size, fp ); 111 | if( ret <= 0 and feof( fp ) == 0 ) 112 | { 113 | clearerr( fp ); 114 | goto again; 115 | } 116 | return( ret ); 117 | } 118 | -------------------------------------------------------------------------------- /base/incstub.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include "defs.h" 17 | #include "net.h" 18 | 19 | public long INC_RES = 5; 20 | public nptr inc_cause = (nptr) 1; 21 | public long nevals = 0; 22 | public long i_nevals = 0; 23 | public long nreval_ev = 0; 24 | public long npunted_ev = 0; 25 | public long nstimuli_ev = 0; 26 | public long ncheckpt_ev = 0; 27 | public long ndelaychk_ev = 0; 28 | public long ndelay_ev = 0; 29 | 30 | public void incsim( ch_list ) 31 | nptr ch_list; 32 | { 33 | lprintf( stderr, "Incremental simulation not supported in this version\n" ); 34 | } 35 | 36 | #ifdef FAULT_SIM 37 | 38 | public int fault_mode = FALSE; 39 | 40 | public void faultsim( n ) 41 | nptr n; 42 | { 43 | lprintf( stderr, "Fault simulation not supported in this version\n" ); 44 | } 45 | #endif /* FAULT_SIM */ 46 | -------------------------------------------------------------------------------- /base/intr.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "defs.h" 20 | 21 | #ifdef SYS_V 22 | # ifndef hpux 23 | # define signal( SIG, HAND ) sigset( SIG, HAND ) 24 | # endif 25 | #endif 26 | 27 | 28 | public int int_received = 0; 29 | 30 | 31 | private void int_handler() 32 | { 33 | if( int_received == 1 ) 34 | (void) fprintf( stderr, "\nok ... wait a second\n" ); 35 | if( int_received <= 1 ) 36 | int_received++; 37 | 38 | #ifdef SYS_V 39 | (void) signal( SIGINT, int_handler ); 40 | #endif 41 | } 42 | 43 | 44 | private void bye_bye() 45 | { 46 | extern void TerminateAnalyzer(); 47 | 48 | TerminateAnalyzer(); 49 | exit( 0 ); 50 | } 51 | 52 | 53 | public void InitSignals() 54 | { 55 | (void) signal( SIGQUIT, SIG_IGN ); /* ignore quit */ 56 | (void) signal( SIGINT, int_handler ); 57 | (void) signal( SIGHUP, bye_bye ); /* for magic's sake */ 58 | } 59 | -------------------------------------------------------------------------------- /base/loctypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | *--------------------------------------------------------------------- 3 | * loctypes.h --- determine what to use for 4 and 8 byte integers. 4 | * Specifically, time units in IRSIM need to be 8 byte unsigned. 5 | *--------------------------------------------------------------------- 6 | */ 7 | 8 | #ifndef _LOCTYPES_H 9 | #define _LOCTYPES_H 10 | 11 | /* Ulong is intended to be an 8-byte integer. Systems which have type */ 12 | /* "long" defined as 4 bytes (e.g., Linux) should define Ulong as type */ 13 | /* "unsigned long long". */ 14 | 15 | #ifdef HAVE_LIMITS_H 16 | #include 17 | #else 18 | #ifdef HAVE_SYS_PARAM_H 19 | #include 20 | #endif 21 | #endif 22 | 23 | #if defined(LONG_MAX) && defined(INT_MAX) 24 | #if LONG_MAX == INT_MAX 25 | typedef long long dlong; 26 | typedef unsigned long long Ulong; 27 | #define strtoUlong strtoull 28 | #define PRINTF_LLONG "%ll" 29 | #else 30 | typedef long dlong; 31 | typedef unsigned long Ulong; 32 | #define strtoUlong strtoul 33 | #define PRINTF_LLONG "%l" 34 | #endif 35 | #else 36 | typedef long long dlong; 37 | typedef unsigned long long Ulong; 38 | #define strtoUlong strtoull 39 | #define PRINTF_LLONG "%ll" 40 | #endif 41 | 42 | typedef unsigned int Uint; 43 | typedef unsigned char Uchar; 44 | typedef char *uptr; 45 | typedef int (*ifun)(); 46 | typedef void (*vfun)(); 47 | typedef uptr (*ufun)(); 48 | 49 | #if SIZEOF_VOID_P == SIZEOF_UNSIGNED_INT 50 | typedef Uint pointertype; 51 | #elif SIZEOF_VOID_P == SIZEOF_UNSIGNED_LONG 52 | typedef Ulong pointertype; 53 | #else 54 | ERROR: Cannot compile without knowing the size of a pointer. See base/net.h 55 | #endif 56 | 57 | #endif /* _LOCTYPES_H */ 58 | -------------------------------------------------------------------------------- /base/prints.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | /* 16 | * Prints various messages but deals with varargs correctly. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include "defs.h" 23 | 24 | extern FILE *logfile; 25 | 26 | 27 | public void logprint( s ) 28 | register char *s; 29 | { 30 | static int docomment = 1; 31 | 32 | while( *s != '\0' ) 33 | { 34 | if( docomment ) 35 | { 36 | (void) putc( '|', logfile ); 37 | (void) putc( ' ', logfile ); 38 | docomment = 0; 39 | } 40 | (void) putc( *s, logfile ); 41 | if( *s++ == '\n' ) 42 | docomment = 1; 43 | } 44 | } 45 | 46 | #ifndef TCL_IRSIM 47 | 48 | /* VARARGS */ 49 | 50 | public void lprintf(FILE *max, ...) 51 | { 52 | va_list args; 53 | char *fmt; 54 | char buff[300]; 55 | 56 | va_start(args, max); 57 | 58 | fmt = va_arg(args, char *); 59 | (void) vsprintf(buff, fmt, args); 60 | va_end(args); 61 | (void) fputs(buff, max); 62 | 63 | if (logfile != NULL) 64 | logprint(buff); 65 | } 66 | 67 | /* VARARGS */ 68 | 69 | public void rsimerror(char *filename, ...) 70 | { 71 | va_list args; 72 | int lineno; 73 | char *fmt; 74 | char buf1[ 100 ], buf2[ 200 ]; 75 | 76 | va_start(args, filename); 77 | lineno = va_arg(args, int); 78 | fmt = va_arg(args, char *); 79 | (void) sprintf(buf1, "(%s,%d): ", filename, lineno); 80 | (void) vsprintf(buf2, fmt, args); 81 | va_end(args); 82 | 83 | (void) fputs(buf1, stderr); 84 | (void) fputs(buf2, stderr); 85 | if(logfile != NULL) 86 | { 87 | logprint(buf1); 88 | logprint(buf2); 89 | } 90 | } 91 | 92 | #endif /* TCL_IRSIM */ 93 | -------------------------------------------------------------------------------- /base/rsim.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #ifndef _RSIM_H 16 | #define _RSIM_H 17 | 18 | #ifndef _NET_H 19 | #include "net.h" 20 | #endif 21 | 22 | 23 | /* front end for mos simulator -- Chris Terman (6/84) */ 24 | /* substantial changes: Arturo Salz (88) */ 25 | /* split definitions into rsim.h: Tim Edwards (02) */ 26 | 27 | #define LSIZE 2000 /* max size of command line (in chars) */ 28 | #define MAXARGS 100 /* maximum number of command-line arguments */ 29 | #define CMDTBLSIZE 64 /* size of command hash-table */ 30 | #define MAXCOL 80 /* maximum width of print line */ 31 | 32 | #define ITERATOR_START '{' 33 | #define ITERATOR_END '}' 34 | 35 | #define SIZEOF( X ) ( (int) sizeof( X ) ) 36 | 37 | typedef struct _Cmd 38 | { 39 | char *name; /* name of this command */ 40 | int (*handler)(); /* handler for this command */ 41 | short nmin, nmax; /* min and max number of arguments */ 42 | char *help; /* command description */ 43 | struct _Cmd *next; /* list of commands in bucket */ 44 | } Command; 45 | 46 | typedef struct _Path 47 | { 48 | struct _Path *next; 49 | char name[1]; 50 | } Path; 51 | 52 | 53 | typedef struct sequence *sptr; 54 | 55 | typedef struct sequence 56 | { 57 | sptr next; /* next vector in linked list */ 58 | int which; /* 0 => node; 1 => vector */ 59 | union 60 | { 61 | nptr n; 62 | bptr b; 63 | } ptr; /* pointer to node/vector */ 64 | int vsize; /* size of each value */ 65 | int nvalues; /* number of values specified */ 66 | char values[1]; /* array of values */ 67 | } sequence; 68 | 69 | /* variable external references */ 70 | 71 | extern Command *cmdtbl[]; /* command hash-table */ 72 | extern int contline; 73 | extern int analyzerON; /* set when analyzer is running */ 74 | extern Ulong sim_time0; /* starting time (see flush_hist) */ 75 | extern FILE *logfile; /* log file of transactions */ 76 | 77 | extern char *filename; 78 | extern char *first_file; 79 | extern int lineno; 80 | extern int stack_txtors; 81 | extern int debug; 82 | extern int targc; 83 | 84 | #ifdef POWER_EST 85 | extern FILE *caplogfile; /* log file of cap transitions */ 86 | extern double toggled_cap; /* indicative of total power of chip */ 87 | extern float vsupply; /* supply voltage for pwr estimation */ 88 | extern float capstarttime; 89 | extern float capstoptime; 90 | extern float captime; 91 | extern float powermult; /* to do power estimate in milliWatts */ 92 | extern float power; /* power estimate logged after powquery */ 93 | extern int pstep; /* Bool - end of step power display */ 94 | extern float step_cap_x_trans; /* Stepwise C*trans count */ 95 | #endif /* POWER_EST */ 96 | 97 | /* function prototype forward references */ 98 | 99 | #ifdef TCL_IRSIM 100 | extern void Usage( char *, ... ); 101 | #else 102 | extern void Usage(); 103 | #endif 104 | 105 | extern char *BaseName(); 106 | 107 | extern int cmdfile(); 108 | extern int docmdpath(); 109 | extern int start_analyzer(); 110 | 111 | extern void parse_line(); 112 | extern int exec_cmd(); 113 | extern int expand(); 114 | extern int input(); 115 | extern void shift_args(); 116 | 117 | #endif /* _RSIM_H */ 118 | -------------------------------------------------------------------------------- /base/symbol.map: -------------------------------------------------------------------------------- 1 | IRSIM_9.6 { 2 | global: Tclirsim_Init; Random_Init; 3 | local: *; 4 | }; 5 | -------------------------------------------------------------------------------- /base/tpos.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include "defs.h" 17 | #include "net.h" 18 | #include "globals.h" 19 | 20 | #define HASHSIZE 1021 21 | #define HN1 1103515245 22 | #define HN2 12345 23 | 24 | 25 | public int txt_coords = 0; /* # of trans. with coordinates */ 26 | 27 | private tptr tpostbl[ HASHSIZE ]; /* hash table of trans position */ 28 | 29 | private tptr other_t = NULL; /* transistors without coords */ 30 | private struct Trans OtherT; 31 | 32 | 33 | #define UN( N ) ( (Ulong) ( N ) ) 34 | #define HashPos( X, Y ) ( UN( UN( X ) * HN1 + UN( Y ) + HN2 ) % HASHSIZE ) 35 | 36 | 37 | public void EnterPos( tran, is_pos ) 38 | tptr tran; 39 | int is_pos; 40 | { 41 | long n; 42 | 43 | if( is_pos ) 44 | { 45 | n = HashPos( tran->x.pos, tran->y.pos ); 46 | 47 | tran->tlink = tpostbl[n]; 48 | tpostbl[n] = tran; 49 | txt_coords ++; 50 | } 51 | else 52 | { 53 | if( other_t == NULL ) 54 | other_t = OtherT.x.ptr = OtherT.y.ptr = &OtherT; 55 | tran->y.ptr = other_t; 56 | tran->x.ptr = other_t->x.ptr; 57 | other_t->x.ptr->y.ptr = tran; 58 | other_t->y.ptr = tran; 59 | tran->tlink = tran; 60 | } 61 | } 62 | 63 | 64 | public tptr FindTxtorPos( x, y ) 65 | register long x, y; 66 | { 67 | register tptr t; 68 | long n; 69 | 70 | n = HashPos( x, y ); 71 | 72 | for( t = tpostbl[n]; t != NULL; t = t->tlink ) 73 | { 74 | if( t->x.pos == x and t->y.pos == y ) 75 | return( t ); 76 | } 77 | return( NULL ); 78 | } 79 | 80 | 81 | public void DeleteTxtorPos( tran ) 82 | tptr tran; 83 | { 84 | register tptr *t; 85 | long n; 86 | 87 | n = HashPos( tran->x.pos, tran->y.pos ); 88 | 89 | for( t = &(tpostbl[n]); *t != NULL; t = &((*t)->tlink) ) 90 | { 91 | if( *t == tran ) 92 | { 93 | *t = tran->tlink; 94 | tran->tlink = tran; 95 | txt_coords --; 96 | break; 97 | } 98 | } 99 | } 100 | 101 | 102 | public nptr FindNode_TxtorPos( s ) 103 | char *s; 104 | { 105 | long x, y; 106 | tptr t; 107 | 108 | if( sscanf( &s[3], "%ld,%ld", &x, &y ) != 2 ) 109 | return( NULL ); 110 | 111 | if( (t = FindTxtorPos( x, y )) == NULL ) 112 | return( NULL ); 113 | 114 | switch( s[2] ) 115 | { 116 | case 'g': return( t->gate ); 117 | case 'd': return( t->drain ); 118 | case 's': return( t->source ); 119 | } 120 | return( NULL ); 121 | } 122 | 123 | 124 | public void walk_trans( func, arg ) 125 | void (*func)(); 126 | char *arg; 127 | { 128 | register int index; 129 | register tptr t; 130 | 131 | for( index = 0; index < HASHSIZE; index++ ) 132 | { 133 | for( t = tpostbl[ index ]; t != NULL; t = t->tlink ) 134 | (*func)( t, arg ); 135 | } 136 | 137 | if( other_t != NULL ) 138 | { 139 | for( t = other_t->x.ptr; t != other_t; t = t->x.ptr ) 140 | (*func)( t, arg ); 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /base/units.h: -------------------------------------------------------------------------------- 1 | /* 2 | * units.h --- Defines the time size of internal units by declaring 3 | * their relationship to nanoseconds and picoseconds. 4 | * Previously these definitions were in "net.h". 5 | */ 6 | 7 | #ifndef _UNITS_H 8 | #define _UNITS_H 9 | 10 | /* Conversion macros between various time units */ 11 | 12 | #define PSEC_TIME /* 1 delta = 1 ps */ 13 | 14 | #ifdef PSEC_TIME 15 | #define d2ns( D ) ( (D) * 0.001 ) /* deltas to ns */ 16 | #define d2ps( D ) ( (D) * 1.0 ) /* deltas to ps */ 17 | #define ns2d( N ) ( (N) * 1000.0 ) /* ns to deltas */ 18 | #define ps2d( P ) ( (P) * 1.0 ) /* ps to deltas */ 19 | #define DEFLT_STEP 10000 20 | #else 21 | #define d2ns( D ) ( (D) * 0.1 ) /* deltas to ns */ 22 | #define d2ps( D ) ( (D) * 100.0 ) /* deltas to ps */ 23 | #define ns2d( N ) ( (N) * 10.0 ) /* ns to deltas */ 24 | #define ps2d( P ) ( (P) * 0.01 ) /* ps to deltas */ 25 | #define DEFAULT_STEP 100 26 | #endif 27 | #define ps2ns( P ) ( (P) * 0.001 ) /* ps to ns */ 28 | 29 | #endif /* _UNITS_H */ 30 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # This script is a workaround to GNU autoconf which can't deal with having 4 | # all of its config scripts in a different directory than the configure 5 | # script itself. 6 | 7 | ( CFLAGS="-g" ; export CFLAGS ; cd scripts ; ./configure "$@" ) 8 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | IRSIMDIR = .. 2 | 3 | include ${IRSIMDIR}/defs.mak 4 | 5 | MANDIRS = $(DESTDIR)${INSTALL_MANDIR} \ 6 | $(DESTDIR)${INSTALL_MANDIR}/man1 \ 7 | $(DESTDIR)${INSTALL_MANDIR}/man3 \ 8 | $(DESTDIR)${INSTALL_MANDIR}/man5 9 | DOCDIRS = $(DESTDIR)${INSTALL_DOCDIR} 10 | 11 | MANFILES = $(DESTDIR)${INSTALL_MANDIR}/man3/irsim-analyzer.3 \ 12 | $(DESTDIR)${INSTALL_MANDIR}/man1/irsim.1 \ 13 | $(DESTDIR)${INSTALL_MANDIR}/man5/netchange.5 14 | 15 | DOCFILES = $(DESTDIR)${INSTALL_DOCDIR}/irsim-analyzer.doc \ 16 | $(DESTDIR)${INSTALL_DOCDIR}/irsim.doc \ 17 | $(DESTDIR)${INSTALL_DOCDIR}/netchange.doc \ 18 | $(DESTDIR)${INSTALL_DOCDIR}/powerEst.doc 19 | 20 | install: ${MANDIRS} ${MANFILES} ${DOCDIRS} ${DOCFILES} 21 | 22 | install-tcl: ${MANDIRS} ${MANFILES} ${DOCDIRS} ${DOCFILES} 23 | 24 | ${MANDIRS}: make-man-dirs 25 | 26 | make-man-dirs: 27 | ${SCRIPTS}/mkdirs ${MANDIRS} 28 | 29 | ${DOCDIRS}: make-doc-dirs 30 | 31 | make-doc-dirs: 32 | ${SCRIPTS}/mkdirs ${DOCDIRS} 33 | 34 | $(DESTDIR)${INSTALL_MANDIR}/man1/%: % ${MANDIRS} 35 | ${CP} $* $(DESTDIR)${INSTALL_MANDIR}/man1/$* 36 | 37 | $(DESTDIR)${INSTALL_MANDIR}/man3/%: % ${MANDIRS} 38 | ${CP} $* $(DESTDIR)${INSTALL_MANDIR}/man3/$* 39 | 40 | $(DESTDIR)${INSTALL_MANDIR}/man5/%: % ${MANDIRS} 41 | ${CP} $* $(DESTDIR)${INSTALL_MANDIR}/man5/$* 42 | 43 | $(DESTDIR)${INSTALL_DOCDIR}/%: % ${DOCDIRS} 44 | ${CP} $* $(DESTDIR)${INSTALL_DOCDIR}/$* 45 | -------------------------------------------------------------------------------- /doc/faultsim/fsim.tex: -------------------------------------------------------------------------------- 1 | \documentstyle[12pt,greekfix]{myarticle} 2 | 3 | \hoffset=-.5cm \voffset=-1cm 4 | \textwidth 16.5cm \textheight 22.5cm 5 | \topmargin -0.5in 6 | 7 | \title{Fault Simulation Using Irsim} 8 | \author{Arturo Salz \\ 9 | Computer Systems Laboratory \\ 10 | Stanford University 11 | } 12 | 13 | \begin{titlepage} 14 | 15 | \end{titlepage} 16 | 17 | \pagestyle{plain} 18 | 19 | \begin{document} 20 | \maketitle 21 | 22 | \input{doc} 23 | \end{document} 24 | 25 | -------------------------------------------------------------------------------- /faultsim/Depend: -------------------------------------------------------------------------------- 1 | faultsim.o: faultsim.c ../base/defs.h ../base/net.h ../base/net_macros.h \ 2 | ../base/globals.h 3 | incsim.o: incsim.c ../base/defs.h ../base/net.h ../base/globals.h 4 | -------------------------------------------------------------------------------- /faultsim/Makefile: -------------------------------------------------------------------------------- 1 | MODULE = faultsim 2 | IRSIMDIR = .. 3 | SRCS = faultsim.c incsim.c 4 | 5 | include ${IRSIMDIR}/defs.mak 6 | 7 | CFLAGS += -I${IRSIMDIR}/base 8 | 9 | include ${IRSIMDIR}/rules.mak 10 | -------------------------------------------------------------------------------- /irsim/Depend: -------------------------------------------------------------------------------- 1 | irsim.o: irsim.c ../base/defs.h ../base/net.h ../base/globals.h \ 2 | ../base/rsim.h 3 | -------------------------------------------------------------------------------- /irsim/Makefile: -------------------------------------------------------------------------------- 1 | MODULE = irsim 2 | IRSIMDIR = .. 3 | SRCS = irsim.c 4 | 5 | include ${IRSIMDIR}/defs.mak 6 | 7 | EXTRA_LIBS = ${IRSIMDIR}/analyzer/libanalyzer.o \ 8 | ${IRSIMDIR}/base/libbase.o \ 9 | ${MAIN_EXTRA_LIBS} 10 | 11 | DFLAGS += -DIRSIM_DATE="\"`date`\"" 12 | 13 | CFLAGS += -I${IRSIMDIR}/base 14 | LIBS += ${GR_LIBS} -lm 15 | CLEANS += genspktbl gentbl tclirsim${SHDLIB_EXT} 16 | SRCS += ${OTHER_SRCS} 17 | 18 | main: irsim gentbl genspktbl 19 | 20 | tcl-main: tclirsim${SHDLIB_EXT} 21 | 22 | tclirsim${SHDLIB_EXT}: ${EXTRA_LIBS} 23 | @echo --- making irsim Tcl library \(tclirsim${SHDLIB_EXT}\) 24 | ${RM} tclirsim${SHDLIB_EXT} 25 | ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o $@ ${LDDL_FLAGS} ${LD_RUN_PATH} \ 26 | ${EXTRA_LIBS} -lc ${LIBS} ${LD_EXTRA_LIBS} 27 | 28 | $(DESTDIR)${INSTALL_BINDIR}/irsim: 29 | ${RM} $(DESTDIR)${INSTALL_BINDIR}/irsim 30 | ${CP} irsim $(DESTDIR)${INSTALL_BINDIR}/irsim 31 | 32 | $(DESTDIR)${INSTALL_BINDIR}/gentbl: 33 | ${RM} $(DESTDIR)${INSTALL_BINDIR}/gentbl 34 | ${CP} gentbl $(DESTDIR)${INSTALL_BINDIR}/gentbl 35 | 36 | $(DESTDIR)${INSTALL_BINDIR}/genspktbl: 37 | ${RM} $(DESTDIR)${INSTALL_BINDIR}/genspktbl 38 | ${CP} genspktbl $(DESTDIR)${INSTALL_BINDIR}/genspktbl 39 | 40 | gentbl: 41 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} gentbl.c -o $@ ${LIBS} 42 | 43 | genspktbl: 44 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} genspktbl.c -o $@ ${LIBS} 45 | 46 | install: $(DESTDIR)${INSTALL_BINDIR}/irsim $(DESTDIR)${INSTALL_BINDIR}/gentbl \ 47 | $(DESTDIR)${INSTALL_BINDIR}/genspktbl 48 | 49 | install-tcl: $(DESTDIR)${INSTALL_TCLDIR}/tclirsim${SHDLIB_EXT} 50 | 51 | $(DESTDIR)${INSTALL_TCLDIR}/tclirsim${SHDLIB_EXT}: tclirsim${SHDLIB_EXT} 52 | ${RM} $(DESTDIR)${INSTALL_TCLDIR}/tclirsim${SHDLIB_EXT} 53 | ${CP} tclirsim${SHDLIB_EXT} $(DESTDIR)${INSTALL_TCLDIR}/tclirsim${SHDLIB_EXT} 54 | 55 | include ${IRSIMDIR}/rules.mak 56 | -------------------------------------------------------------------------------- /irsim/irsim.c: -------------------------------------------------------------------------------- 1 | /* 2 | * ********************************************************************* 3 | * * Copyright (C) 1988, 1990 Stanford University. * 4 | * * Permission to use, copy, modify, and distribute this * 5 | * * software and its documentation for any purpose and without * 6 | * * fee is hereby granted, provided that the above copyright * 7 | * * notice appear in all copies. Stanford University * 8 | * * makes no representations about the suitability of this * 9 | * * software for any purpose. It is provided "as is" without * 10 | * * express or implied warranty. Export of this software outside * 11 | * * of the United States of America may require an export license. * 12 | * ********************************************************************* 13 | */ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #include "defs.h" 20 | #include "net.h" 21 | #include "globals.h" 22 | #include "rsim.h" 23 | #ifdef USER_SUBCKT 24 | #include "../usersubckt/subckt.h" 25 | #endif 26 | 27 | /* VARARGS1 */ 28 | public void Usage( msg, s1 ) 29 | char *msg, *s1; 30 | { 31 | (void) fprintf( stderr, msg, s1 ); 32 | (void) fprintf( stderr, "usage:\n irsim " ); 33 | (void) fprintf( stderr, "[-s] prm_file {sim_file ..} [-cmd_file ..]\n" ); 34 | (void) fprintf( stderr, "\t-s\t\tstack series transistors\n" ); 35 | (void) fprintf( stderr, "\tprm_file\telectrical parameters file\n" ); 36 | (void) fprintf( stderr, "\tsim_file\tsim (network) file[s]\n" ); 37 | (void) fprintf( stderr, "\tcmd_file\texecute command file[s]\n" ); 38 | exit( 1 ); 39 | } 40 | 41 | /* Main routine for irsim */ 42 | 43 | public main( argc, argv ) 44 | char *argv[]; 45 | { 46 | int i, arg1, has_param_file; 47 | 48 | InitSignals(); 49 | InitUsage(); 50 | InitThevs(); 51 | InitCAD(); 52 | InitCmdPath(); 53 | init_hist(); 54 | (void) fprintf( stdout, "*** IRSIM %s.%s *** @ %s\n", 55 | IRSIM_VERSION, IRSIM_REVISION, IRSIM_DATE); 56 | (void) fflush( stdout ); 57 | 58 | filename = "*initialization*"; 59 | 60 | for( arg1 = 1; arg1 < argc; arg1++ ) 61 | { 62 | if( argv[arg1][0] == '-' ) 63 | { 64 | switch( argv[arg1][1] ) 65 | { 66 | case 's' : /* stack series transistors */ 67 | stack_txtors = TRUE; 68 | break; 69 | default : 70 | Usage( "unknown switch: %s\n", argv[arg1] ); 71 | } 72 | } 73 | else 74 | break; 75 | } 76 | 77 | /* read in the electrical configuration file */ 78 | if( arg1 < argc ) 79 | has_param_file = config( argv[arg1++] ); 80 | else 81 | has_param_file = -1; 82 | 83 | 84 | /* Read network files (sim files) */ 85 | for( i = arg1; i < argc; i += 1 ) 86 | { 87 | if( argv[i][0] != '-' and argv[i][0] != '+' ) 88 | { 89 | rd_network( argv[i], (char *)NULL, has_param_file ); 90 | if( first_file == NULL ) 91 | first_file = BaseName( argv[i] ); 92 | } 93 | } 94 | 95 | if( first_file == NULL ) 96 | { 97 | (void) fprintf( stderr, "No network, no work. Bye...\n" ); 98 | exit( 1 ); 99 | } 100 | 101 | ConnectNetwork(); /* connect all txtors to corresponding nodes */ 102 | InitTimes(sim_time0, stepsize, cur_delta, 0); 103 | 104 | init_commands(); /* set up command table */ 105 | 106 | init_event(); 107 | 108 | /* search for -filename for command files to process. */ 109 | filename = "command line"; 110 | lineno = 1; 111 | for( i = arg1; i < argc; i++ ) 112 | if( argv[i][0] == '-' and not finput( &argv[i][1] ) ) 113 | rsimerror( filename, lineno, "cannot open %s for input\n", 114 | &argv[i][1] ); 115 | 116 | /* finally (assuming we get this far) read commands from user */ 117 | debug = 0; 118 | filename = "tty"; 119 | lineno = 0; 120 | (void) input( stdin ); 121 | 122 | TerminateAnalyzer(); 123 | exit( 0 ); 124 | /* NOTREACHED */ 125 | } 126 | 127 | -------------------------------------------------------------------------------- /irsim/symbol.map: -------------------------------------------------------------------------------- 1 | IRSIM_9.7 { 2 | global: Tclirsim_Init; 3 | Tclirsim_SafeInit; 4 | Random_Init; 5 | Random_SafeInit; 6 | Diglib_Init; 7 | Diglib_SafeInit; 8 | init_subs; 9 | cur_delta; 10 | lprintf; 11 | local: *; 12 | }; 13 | -------------------------------------------------------------------------------- /lib/Makefile: -------------------------------------------------------------------------------- 1 | IRSIMDIR = .. 2 | 3 | include ${IRSIMDIR}/defs.mak 4 | 5 | FILES = \ 6 | amiabn.80.n99z.5.prm \ 7 | amic5.30.n98s.3.3.prm \ 8 | amicwl.50.n97l.5.prm \ 9 | hpcmos10.20.n98v.3.3.prm \ 10 | hpcmos14.30.n9ae.3.3.prm \ 11 | hpcmos26.40.n88x.5.prm \ 12 | orbit.60.n96e.5.prm \ 13 | scmos100.prm \ 14 | scmos1_6um.prm \ 15 | scmos2um.prm \ 16 | scmos30.prm \ 17 | scmos35.prm \ 18 | scmos50_3v.prm \ 19 | scmos50_5v.prm \ 20 | scmos60.prm \ 21 | tsmc18.10.nxxx.1.8.prm \ 22 | tsmc25.15.n99y.2.5.prm \ 23 | tsmc35.20.n98t.3.3.prm \ 24 | tsmc35p.20.n98tp.3.3.prm 25 | 26 | BITMAPS = left.xbm right.xbm lleft.xbm rright.xbm center.xbm 27 | 28 | INST_FILES= $(FILES:%=$(DESTDIR)${INSTALL_PRMDIR}/%) 29 | 30 | INST_BITMAPS= $(BITMAPS:%=$(DESTDIR)${INSTALL_XBMDIR}/%) 31 | 32 | install-tcl: ${INST_FILES} ${INST_BITMAPS} 33 | 34 | install: ${INST_FILES} 35 | 36 | $(DESTDIR)${INSTALL_PRMDIR}/%: prm/% 37 | (cd prm; ${CP} $* $(DESTDIR)${INSTALL_PRMDIR}/$*) 38 | 39 | $(DESTDIR)${INSTALL_XBMDIR}/%: bitmaps/% 40 | (cd bitmaps; ${CP} $* $(DESTDIR)${INSTALL_XBMDIR}/$*) 41 | -------------------------------------------------------------------------------- /lib/bitmaps/center.xbm: -------------------------------------------------------------------------------- 1 | #define center_width 13 2 | #define center_height 13 3 | static unsigned char center_bits[] = { 4 | 0xf0, 0x01, 0xf8, 0x03, 0x1c, 0x07, 0x06, 0x0c, 0x47, 0x1c, 0xe3, 0x18, 5 | 0xf3, 0x19, 0xe3, 0x18, 0x47, 0x1c, 0x06, 0x0c, 0x1c, 0x07, 0xf8, 0x03, 6 | 0xf0, 0x01}; 7 | -------------------------------------------------------------------------------- /lib/bitmaps/left.xbm: -------------------------------------------------------------------------------- 1 | #define left_width 13 2 | #define left_height 13 3 | static unsigned char left_bits[] = { 4 | 0x40, 0x00, 0x60, 0x00, 0x70, 0x00, 0x78, 0x00, 0x7c, 0x00, 0xfe, 0x1f, 5 | 0xff, 0x1f, 0xfe, 0x1f, 0x7c, 0x00, 0x78, 0x00, 0x70, 0x00, 0x60, 0x00, 6 | 0x40, 0x00}; 7 | -------------------------------------------------------------------------------- /lib/bitmaps/lleft.xbm: -------------------------------------------------------------------------------- 1 | #define lleft_width 20 2 | #define lleft_height 13 3 | static unsigned char lleft_bits[] = { 4 | 0x40, 0x40, 0x00, 0x60, 0x60, 0x00, 0x70, 0x70, 0x00, 0x78, 0x78, 0x00, 5 | 0x7c, 0x7c, 0x00, 0xfe, 0xff, 0x0f, 0xff, 0xff, 0x0f, 0xfe, 0xff, 0x0f, 6 | 0x7c, 0x7c, 0x00, 0x78, 0x78, 0x00, 0x70, 0x70, 0x00, 0x60, 0x60, 0x00, 7 | 0x40, 0x40, 0x00}; 8 | -------------------------------------------------------------------------------- /lib/bitmaps/right.xbm: -------------------------------------------------------------------------------- 1 | #define right_width 13 2 | #define right_height 13 3 | static unsigned char right_bits[] = { 4 | 0x40, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0xc0, 0x03, 0xc0, 0x07, 0xff, 0x0f, 5 | 0xff, 0x1f, 0xff, 0x0f, 0xc0, 0x07, 0xc0, 0x03, 0xc0, 0x01, 0xc0, 0x00, 6 | 0x40, 0x00}; 7 | -------------------------------------------------------------------------------- /lib/bitmaps/rright.xbm: -------------------------------------------------------------------------------- 1 | #define rright_width 20 2 | #define rright_height 13 3 | static unsigned char rright_bits[] = { 4 | 0x20, 0x20, 0x00, 0x60, 0x60, 0x00, 0xe0, 0xe0, 0x00, 0xe0, 0xe1, 0x01, 5 | 0xe0, 0xe3, 0x03, 0xff, 0xff, 0x07, 0xff, 0xff, 0x0f, 0xff, 0xff, 0x07, 6 | 0xe0, 0xe3, 0x03, 0xe0, 0xe1, 0x01, 0xe0, 0xe0, 0x00, 0x60, 0x60, 0x00, 7 | 0x20, 0x20, 0x00}; 8 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/README: -------------------------------------------------------------------------------- 1 | This directory does the calibration run for hspice based models. 2 | It uses the measure capability of hspice to extract resistances 3 | the same way the ../calibrate_spice3 programs do. 4 | 5 | You might need to tune the script a bit for you local environment. 6 | Since it assumes that hspice is called with a library called 7 | opConditions.lib which defines the supply voltage (Supply) based 8 | on the parameter Sup (which is in turn defined in the dev.example 9 | file). 10 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/ckt.hsp: -------------------------------------------------------------------------------- 1 | * hspice test file for generating .prm files. 2 | * 3 | * out1 - Output of Inverter to measure step response. 4 | 5 | .param Sup=SUPPLYV 6 | * It is assumed that opConditions.lib uses Sup to produce Supply 7 | * eg. for SS corner the lib defines Supply='0.9*Sup' 8 | .lib 'opConditions.lib' LIBCORNER 9 | 10 | M0 out1 in1 GND GND NMOS L=N_LENU W=N_WITHU 11 | M1 out1 in1 VDD VDD PMOS L=P_LENU W=P_WITHU 12 | * 13 | * out2 - Output of Inverter driven by out1 to determine slow-input effect. 14 | * 15 | M6 out2 out1 GND GND NMOS L=N_LENU W=N_WITHU 16 | M7 out2 out1 VDD VDD PMOS L=P_LENU W=P_WITHU 17 | * 18 | * out3 - Output of a NMOS pulling up to determine dynamic-high resistance. 19 | * 20 | M2 out3 in2 VDD GND NMOS L=N_LENU W=N_WITHU 21 | * 22 | * out4 - Output of a PMOS pulling down to determine dynamic-low resistance. 23 | * 24 | M3 out4 in3 GND VDD PMOS L=P_LENU W=P_WITHU 25 | * 26 | * loading capacitors 27 | * 28 | C0 out1 GND C_LOADFF 29 | C1 out2 GND C_LOADFF 30 | C2 out3 GND C_LOADFF 31 | C3 out4 GND C_LOADFF 32 | 33 | Rgnd Gnd 0 0.001 34 | VDD VDD 0 DC 'Supply' 35 | Vmid mid 0 DC 'Supply/2' 36 | 37 | Vin1 in1 0 0 pwl (0ns 0 0.1ns 'Supply' 40ns 'Supply' 40.1ns 0) 38 | Vin2 in2 0 0 pwl (0ns 0 0.1ns 'Supply') 39 | Vin3 in3 0 5 pwl (0ns 'Supply' 0.1ns 0) 40 | 41 | .ic V(out4)='Supply' V(out3)=0 42 | 43 | .opt post autostop accurate 44 | .tran 0.05ns 100ns 45 | 46 | * measurements 47 | * DO NOT CHANGE THEIR ORDER - getres depends on them 48 | * 49 | .measure tplh1 trig v(in1) val='Supply/2' fall=1 50 | + targ v(out1) val='Supply/2' rise=1 51 | .measure tphl1 trig v(in1) val='Supply/2' rise=1 52 | + targ v(out1) val='Supply/2' fall=1 53 | 54 | .measure tplh2 trig v(out1) val='Supply/2' fall=1 55 | + targ v(out2) val='Supply/2' rise=1 56 | .measure tphl2 trig v(out1) val='Supply/2' rise=1 57 | + targ v(out2) val='Supply/2' fall=1 58 | 59 | .measure tplhN trig v(in2) val='Supply/2' rise=1 60 | + targ v(out3) val='Supply/2' rise=1 61 | 62 | .measure tphlP trig v(in3) val='Supply/2' fall=1 63 | + targ v(out4) val='Supply/2' fall=1 64 | 65 | .end 66 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/cktCap.hsp: -------------------------------------------------------------------------------- 1 | * spice test file for generating capacitance for .prm files. 2 | 3 | 4 | .param Sup=5 5 | .lib 'opConditions.lib' tt 6 | 7 | .GLOBAL Vdd Gnd 8 | Vdd Vdd Gnd DC 'Supply' 9 | .param sc=1u 10 | .opt scale=1u 11 | 12 | .param area=10000 perim=10000 cur=100u 13 | 14 | Madn adn Gnd Gnd Gnd NMOS L=3 W=1 15 | + AD='area' PD=0 16 | Iadn Vdd adn DC 'cur' 17 | Madp adp Vdd Vdd Vdd PMOS L=3 W=1 18 | + AD='area' PD=0 19 | Iadp adp Gnd DC 'cur' 20 | Mpdn pdn Gnd Gnd Gnd NMOS L=3 W=1 21 | + AD=0 PD='perim' 22 | Ipdn Vdd pdn DC 'cur' 23 | Mpdp pdp Vdd Vdd Vdd PMOS L=3 W=1 24 | + AD=0 PD='perim' 25 | Ipdp pdp Gnd DC 'cur' 26 | 27 | 28 | .ic V(adn)=0 V(adp)='Supply' 29 | .ic V(pdn)=0 V(pdp)='Supply' 30 | 31 | .opt nomod post autostop 32 | .tran 0.01ns 500ns 33 | 34 | 35 | .measure tran tadn when v(adn)='Supply' rise=1 36 | .measure tran tpdn when v(pdn)='Supply' rise=1 37 | .measure tran tadp when v(adp)='0' fall=1 38 | .measure tran tpdp when v(pdp)='0' fall=1 39 | * pf/um pf/um^2 40 | .measure tran cpdn param='tpdn*cur/Supply/perim/sc*1e12/1e6' 41 | .measure tran cadn param='tadn*cur/Supply/area/sc/sc*1e12/1e6/1e6' 42 | .measure tran cpdp param='tpdp*cur/Supply/perim/sc*1e12/1e6' 43 | .measure tran cadp param='tadp*cur/Supply/area/sc/sc*1e12/1e6/1e6' 44 | 45 | .end 46 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/dev.example: -------------------------------------------------------------------------------- 1 | set pwidth = 6.5 # width of p-device in um 2 | set plen = 1.0 # length of p-device in um 3 | set nwidth = 2.5 # width of n-device in um 4 | set nlen = 1.0 # lenght of n-device in um 5 | set cap = 500 # loading capacitance in fF 6 | set supplyV = 3.3 # the operating voltage 7 | set libCorner = tm # the corner within the library 8 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/getres: -------------------------------------------------------------------------------- 1 | #! /bin/csh -f 2 | unset noclobber 3 | 4 | if( $#argv != 1 ) then 5 | echo "usage: getres dev_file" 6 | exit 1 7 | endif 8 | 9 | 10 | if( -f $argv[1] ) then 11 | source $argv[1] 12 | else 13 | echo "can't open device configuratin file '"$argv[1]"'" 14 | exit 1 15 | endif 16 | 17 | cat ckt.hsp > tmp.hsp 18 | 19 | ed - <& /dev/null 20 | g/SUPPLYV/s/SUPPLYV/$supplyV/g 21 | g/LIBCORNER/s/LIBCORNER/$libCorner/g 22 | g/C_LOAD/s/C_LOAD/$cap/g 23 | g/N_WITH/s/N_WITH/$nwidth/g 24 | g/N_LEN/s/N_LEN/$nlen/g 25 | g/P_WITH/s/P_WITH/$pwidth/g 26 | g/P_LEN/s/P_LEN/$plen/g 27 | w 28 | q 29 | end 30 | 31 | echo Running hspice 32 | hspice tmp.hsp > tmp.lis 33 | 34 | if ( ! -f tmp.mt0 ) then 35 | echo "Error: No measurement file from hspice aborting\n" 36 | echo " Check the file tmp.lis" 37 | exit 1 38 | endif 39 | 40 | echo "DEVICE-INFO " $cap $nwidth $nlen $pwidth $plen >! /tmp/awkIn.$$ 41 | cat tmp.mt0 >> /tmp/awkIn.$$ 42 | 43 | # The following awk script extracts and calculates the resistances 44 | cat << AWK_END >! /tmp/awk.$$ 45 | #!/bin/awk -f 46 | BEGIN { 47 | found = 0; 48 | cap = -1; 49 | } 50 | 51 | 52 | { 53 | if ( substr(\$1, 1, 1) ~ /^[0-9]/ && found == 0 ) { 54 | found = 1; 55 | if ( NF < 6 ) { 56 | printf "Error: less than 6 fields in mt0 file\n"; 57 | exit 1; 58 | } 59 | tplh1 = \$1; tphl1 = \$2; 60 | tplh2 = \$3; tphl2 = \$4; 61 | tplhN = \$5; tphlP = \$6; 62 | } 63 | # this line is fed to it by the shellscript 64 | if ( \$1 == "DEVICE-INFO" ) { 65 | cap = \$2*1E-15; 66 | wn = \$3; 67 | ln = \$4; 68 | wp = \$5; 69 | lp = \$6; 70 | } 71 | } 72 | 73 | 74 | END { 75 | dynL_n = tphl1 / cap ; 76 | dynH_p = tplh1 / cap ; 77 | st_n = ( tphl2*tphl2 - tphl1*tphl1 ) / ( tplh1*cap); 78 | st_p = ( tplh2*tplh2 - tplh1*tplh1 ) / ( tphl1*cap); 79 | 80 | dynH_n = tplhN / cap ; 81 | dynL_p = tphlP / cap ; 82 | 83 | printf "; C=%.2ffF, P(w=%.2f, l=%.2f), N(w=%.2f, l=%.2f)\n", cap*1e15, wp, lp, wn, ln 84 | printf "resistance n-channel dynamic-high\t%.1f\t%.2f\t%.1f\n", wn,ln, dynH_n 85 | printf "resistance n-channel dynamic-low\t%.1f\t%.2f\t%.1f\n", wn, ln, dynL_n 86 | printf "resistance n-channel static \t%.1f\t%.2f\t%.1f\n", wn,ln, st_n 87 | printf "\n" 88 | printf "resistance p-channel dynamic-high\t%.1f\t%.2f\t%.1f\n", wp,lp, dynH_p 89 | printf "resistance p-channel dynamic-low\t%.1f\t%.2f\t%.1f\n", wp, lp, dynL_p 90 | printf "resistance p-channel static \t%.1f\t%.2f\t%.1f\n", wp,lp, st_p 91 | printf "\n" 92 | } 93 | AWK_END 94 | 95 | # this second awk scripts merges numerical lines in the mt0 file 96 | cat << AWK_END2 > /tmp/awk2.$$ 97 | BEGIN { i = 0 } 98 | { 99 | if ( substr(\$1, 1, 1) ~ /^[0-9]/ && i == 0 ) { 100 | printf "%s ", \$0; i=1; 101 | } else { print \$0; i = 0; } 102 | } 103 | AWK_END2 104 | 105 | 106 | cat /tmp/awkIn.$$ | awk -f /tmp/awk2.$$ | awk -f /tmp/awk.$$ 107 | 108 | /bin/rm -f /tmp/awk.$$ /tmp/awkIn.$$ tmp.* /tmp/awk2.$$ 109 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/scmos100.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; Configuration file for 2.0um SCMOS (lambda=1.0um) 3 | ; parameters extracted from spice MOSIS supplied BSIM models 4 | ; 5 | ; Resistance values are for med temp (70 C) and nom voltage (5 V) 6 | ; 7 | ; Yang 7/95 8 | 9 | lambda 1.0 ; microns/lambda 10 | 11 | capga .00105 ; gate capacitance -- area, pf/sq-micron 12 | 13 | capda .000042 ; n-diffusion capacitance -- area, pf/sq-micron 14 | capdp .000300 ; n-diffusion capacitance -- perimeter, pf/micron 15 | cappda .000195 ; p-diffusion capacitance -- area, pf/sq-micron 16 | cappdp .000176 ; p-diffusion capacitance -- perimeter, pf/micron 17 | 18 | 19 | lowthresh 0.4 ; 20 | highthresh 0.6 ; 21 | 22 | cntpullup 0 ; irelevant (no depletion devices) 23 | 24 | subparea 0 ; count poly over diff as bulk poly cap. 25 | 26 | diffperim 0 ; include diff. perims that border on xtror gates 27 | 28 | diffext 0 ; dont put default cap. 29 | 30 | ;5V Supply 31 | ; C=500.00fF, P(w=6.50, l=2.00), N(w=2.50, l=2.00) 32 | resistance n-channel dynamic-high 2.5 2.00 26580.0 33 | resistance n-channel dynamic-low 2.5 2.00 9214.0 34 | resistance n-channel static 2.5 2.00 12234.3 35 | 36 | resistance p-channel dynamic-high 6.5 2.00 8090.0 37 | resistance p-channel dynamic-low 6.5 2.00 19368.0 38 | resistance p-channel static 6.5 2.00 8240.1 39 | ; C=500.00fF, P(w=15.00, l=2.00), N(w=5.00, l=2.00) 40 | resistance n-channel dynamic-high 5.0 2.00 11260.0 41 | resistance n-channel dynamic-low 5.0 2.00 5140.0 42 | resistance n-channel static 5.0 2.00 5340.5 43 | 44 | resistance p-channel dynamic-high 15.0 2.00 3834.0 45 | resistance p-channel dynamic-low 15.0 2.00 8340.0 46 | resistance p-channel static 15.0 2.00 3320.0 47 | ; C=1000.00fF, P(w=30.00, l=2.00), N(w=15.00, l=2.00) 48 | resistance n-channel dynamic-high 15.0 2.00 3443.0 49 | resistance n-channel dynamic-low 15.0 2.00 1775.0 50 | resistance n-channel static 15.0 2.00 1679.8 51 | 52 | resistance p-channel dynamic-high 30.0 2.00 1956.0 53 | resistance p-channel dynamic-low 30.0 2.00 4145.0 54 | resistance p-channel static 30.0 2.00 1615.0 55 | 56 | ; C=1000.00fF, P(w=30.00, l=3.00), N(w=15.00, l=3.00) 57 | resistance n-channel dynamic-high 15.0 3.00 5624.0 58 | resistance n-channel dynamic-low 15.0 3.00 2529.0 59 | resistance n-channel static 15.0 3.00 2830.8 60 | 61 | resistance p-channel dynamic-high 30.0 3.00 3244.0 62 | resistance p-channel dynamic-low 30.0 3.00 8339.0 63 | resistance p-channel static 30.0 3.00 3072.0 64 | 65 | ; C=1000.00fF, P(w=30.00, l=4.00), N(w=15.00, l=4.00) 66 | resistance n-channel dynamic-high 15.0 4.00 8007.0 67 | resistance n-channel dynamic-low 15.0 4.00 3416.0 68 | resistance n-channel static 15.0 4.00 3975.5 69 | 70 | resistance p-channel dynamic-high 30.0 4.00 4785.0 71 | resistance p-channel dynamic-low 30.0 4.00 13040.0 72 | resistance p-channel static 30.0 4.00 4373.1 73 | 74 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/scmos30.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; configuration file for scmos with lamba = 0.35 (0.6um process + 1um) 3 | ; 4 | ; The results have been extracted with TM at 3.3 5 | ; The bsim models by hp have been used 6 | 7 | lambda 0.30 ; 8 | 9 | capga .0031 ; gate capacitance -- area, pf/sq-micron 10 | 11 | capda 0.000240 12 | capdp 0.000250 13 | cappda 0.000570 14 | cappdp 0.000175 15 | 16 | lowthresh 0.4 ; logic low threshold as a normalized voltage 17 | highthresh 0.6 ; logic high threshold as a normalized voltage 18 | 19 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 20 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 21 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 22 | diffext 0 ; diffusion extension for each transistor 23 | 24 | ;0.6um channel 25 | ; C=500.00fF, P(w=6.50, l=0.60), N(w=2.50, l=0.60) 26 | resistance n-channel dynamic-high 2.5 0.60 5064.0 27 | resistance n-channel dynamic-low 2.5 0.60 2212.0 28 | resistance n-channel static 2.5 0.60 2914.5 29 | 30 | resistance p-channel dynamic-high 6.5 0.60 1799.6 31 | resistance p-channel dynamic-low 6.5 0.60 4056.0 32 | resistance p-channel static 6.5 0.60 1999.7 33 | 34 | ; C=500.00fF, P(w=20.00, l=0.60), N(w=10.00, l=0.60) 35 | resistance n-channel dynamic-high 10.0 0.60 1028.6 36 | resistance n-channel dynamic-low 10.0 0.60 561.6 37 | resistance n-channel static 10.0 0.60 505.7 38 | 39 | resistance p-channel dynamic-high 20.0 0.60 662.8 40 | resistance p-channel dynamic-low 20.0 0.60 1281.8 41 | resistance p-channel static 20.0 0.60 453.3 42 | ; C=500.00fF, P(w=20.00, l=0.90), N(w=10.00, l=0.90) 43 | resistance n-channel dynamic-high 10.0 0.90 1714.4 44 | resistance n-channel dynamic-low 10.0 0.90 833.8 45 | resistance n-channel static 10.0 0.90 734.6 46 | 47 | resistance p-channel dynamic-high 20.0 0.90 1067.2 48 | resistance p-channel dynamic-low 20.0 0.90 2488.0 49 | resistance p-channel static 20.0 0.90 851.7 50 | ; C=500.00fF, P(w=20.00, l=1.20), N(w=10.00, l=1.20) 51 | resistance n-channel dynamic-high 10.0 1.20 2524.0 52 | resistance n-channel dynamic-low 10.0 1.20 1098.8 53 | resistance n-channel static 10.0 1.20 1030.2 54 | 55 | resistance p-channel dynamic-high 20.0 1.20 1524.8 56 | resistance p-channel dynamic-low 20.0 1.20 3772.0 57 | resistance p-channel static 20.0 1.20 1148.7 58 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/scmos35.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; configuration file for scmos with lamba = 0.35 (0.6um process + 1um) 3 | ; 4 | 5 | lambda 0.35 ; 6 | 7 | capga .00315 ; gate capacitance -- area, pf/sq-micron 8 | 9 | capda 0.00024 10 | capdp 0.00026 11 | cappda 0.000580 12 | cappdp 0.000170 13 | 14 | lowthresh 0.4 ; logic low threshold as a normalized voltage 15 | highthresh 0.6 ; logic high threshold as a normalized voltage 16 | 17 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 18 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 19 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 20 | diffext 0 ; diffusion extension for each transistor 21 | 22 | 23 | ;0.7um channel 24 | ; C=500.00fF, P(w=6.50, l=0.70), N(w=2.50, l=0.70) 25 | resistance n-channel dynamic-high 2.5 0.70 6316.0 26 | resistance n-channel dynamic-low 2.5 0.70 2718.0 27 | resistance n-channel static 2.5 0.70 3340.0 28 | 29 | resistance p-channel dynamic-high 6.5 0.70 2148.0 30 | resistance p-channel dynamic-low 6.5 0.70 5354.0 31 | resistance p-channel static 6.5 0.70 2560.6 32 | ; C=500.00fF, P(w=20.00, l=0.70), N(w=10.00, l=0.70) 33 | resistance n-channel dynamic-high 10.0 0.70 1267.0 34 | resistance n-channel dynamic-low 10.0 0.70 672.0 35 | resistance n-channel static 10.0 0.70 577.8 36 | 37 | resistance p-channel dynamic-high 20.0 0.70 791.6 38 | resistance p-channel dynamic-low 20.0 0.70 1688.4 39 | resistance p-channel static 20.0 0.70 607.8 40 | ; C=500.00fF, P(w=20.00, l=1.05), N(w=10.00, l=1.05) 41 | resistance n-channel dynamic-high 10.0 1.05 2124.0 42 | resistance n-channel dynamic-low 10.0 1.05 961.6 43 | resistance n-channel static 10.0 1.05 884.8 44 | 45 | resistance p-channel dynamic-high 20.0 1.05 1294.0 46 | resistance p-channel dynamic-low 20.0 1.05 3124.0 47 | resistance p-channel static 20.0 1.05 1012.2 48 | 49 | ; C=500.00fF, P(w=20.00, l=1.40), N(w=10.00, l=1.40) 50 | resistance n-channel dynamic-high 10.0 1.40 3052.0 51 | resistance n-channel dynamic-low 10.0 1.40 1295.6 52 | resistance n-channel static 10.0 1.40 1210.4 53 | 54 | resistance p-channel dynamic-high 20.0 1.40 1856.0 55 | resistance p-channel dynamic-low 20.0 1.40 4626.0 56 | resistance p-channel static 20.0 1.40 1297.4 57 | 58 | ; C=800.00ff, P(w=26.00u,l= 0.70u), n(w=10.00u,l= 0.70u) 59 | resistance n-channel dynamic-high 10.0 0.7 1267.0 60 | resistance n-channel dynamic-low 10.0 0.7 634.0 61 | resistance n-channel static 10.0 0.7 598.0 62 | 63 | resistance p-channel dynamic-high 26.0 0.7 576.0 64 | resistance p-channel dynamic-low 26.0 0.7 1282.0 65 | resistance p-channel static 26.0 0.7 667.0 66 | 67 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/scmos50_3v.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; configuration file for scmos with lamba = 0.5 (0.8um process) 3 | ; 4 | ; The results have been extracted with 3.3V supply and 85 degrees temp. 5 | ; The Hewlet Packard models have been used 6 | 7 | lambda 0.5 ; 8 | 9 | capga .0017 ; gate capacitance -- area, pf/sq-micron 10 | 11 | capda 0.000075 12 | capdp 0.000340 13 | cappda 0.000430 14 | cappdp 0.000230 15 | 16 | lowthresh 0.4 ; logic low threshold as a normalized voltage 17 | highthresh 0.6 ; logic high threshold as a normalized voltage 18 | 19 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 20 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 21 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 22 | diffext 0 ; diffusion extension for each transistor 23 | 24 | ; 3.3V 25 | ; C=500.00fF, P(w=6.50, l=1.00), N(w=2.50, l=1.00) 26 | resistance n-channel dynamic-high 2.5 1.00 8960.0 27 | resistance n-channel dynamic-low 2.5 1.00 4082.0 28 | resistance n-channel static 2.5 1.00 4868.0 29 | 30 | resistance p-channel dynamic-high 6.5 1.00 3612.0 31 | resistance p-channel dynamic-low 6.5 1.00 10428.0 32 | resistance p-channel static 6.5 1.00 4486.4 33 | 34 | ; C=500.00fF, P(w=20.00, l=1.00), N(w=10.00, l=1.00) 35 | resistance n-channel dynamic-high 10.0 1.00 1946.2 36 | resistance n-channel dynamic-low 10.0 1.00 1039.4 37 | resistance n-channel static 10.0 1.00 918.1 38 | 39 | resistance p-channel dynamic-high 20.0 1.00 1320.0 40 | resistance p-channel dynamic-low 20.0 1.00 3338.0 41 | resistance p-channel static 20.0 1.00 1113.3 42 | 43 | ; C=500.00fF, P(w=20.00, l=1.50), N(w=10.00, l=1.50) 44 | resistance n-channel dynamic-high 10.0 1.50 4050.0 45 | resistance n-channel dynamic-low 10.0 1.50 1814.2 46 | resistance n-channel static 10.0 1.50 1716.8 47 | 48 | resistance p-channel dynamic-high 20.0 1.50 2424.0 49 | resistance p-channel dynamic-low 20.0 1.50 6928.0 50 | resistance p-channel static 20.0 1.50 1949.5 51 | 52 | ; C=500.00fF, P(w=20.00, l=2.00), N(w=10.00, l=2.00) 53 | resistance n-channel dynamic-high 10.0 2.00 7468.0 54 | resistance n-channel dynamic-low 10.0 2.00 2346.0 55 | resistance n-channel static 10.0 2.00 2681.6 56 | 57 | resistance p-channel dynamic-high 20.0 2.00 3992.0 58 | resistance p-channel dynamic-low 20.0 2.00 14542.0 59 | resistance p-channel static 20.0 2.00 3167.7 60 | 61 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/scmos50_5v.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; configuration file for scmos with lamba = 0.5 (0.8um process) 3 | ; 4 | ; The results have been extracted with 3.3V supply and 125 degrees temp. 5 | ; The Hewlett Packard models (cmos26) have been used 6 | ; 85C - TM - 5V 7 | ; 8 | 9 | lambda 0.5 ; 10 | 11 | capga .0018 ; gate capacitance -- area, pf/sq-micron 12 | 13 | capda 0.000066 14 | capdp 0.000310 15 | cappda 0.000395 16 | cappdp 0.000220 17 | 18 | lowthresh 0.4 ; logic low threshold as a normalized voltage 19 | highthresh 0.6 ; logic high threshold as a normalized voltage 20 | 21 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 22 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 23 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 24 | diffext 0 ; diffusion extension for each transistor 25 | 26 | 27 | ; 5V 28 | ; C=500.00fF, P(w=6.50, l=1.00), N(w=2.50, l=1.00) 29 | resistance n-channel dynamic-high 2.5 1.00 5572.0 30 | resistance n-channel dynamic-low 2.5 1.00 3484.0 31 | resistance n-channel static 2.5 1.00 2952.3 32 | 33 | resistance p-channel dynamic-high 6.5 1.00 2584.0 34 | resistance p-channel dynamic-low 6.5 1.00 5118.0 35 | resistance p-channel static 6.5 1.00 2298.3 36 | 37 | ; C=500.00fF, P(w=20.00, l=1.00), N(w=10.00, l=1.00) 38 | resistance n-channel dynamic-high 10.0 1.00 1206.2 39 | resistance n-channel dynamic-low 10.0 1.00 881.4 40 | resistance n-channel static 10.0 1.00 495.7 41 | 42 | resistance p-channel dynamic-high 20.0 1.00 946.2 43 | resistance p-channel dynamic-low 20.0 1.00 1630.6 44 | resistance p-channel static 20.0 1.00 572.6 45 | 46 | ; C=500.00fF, P(w=20.00, l=1.50), N(w=10.00, l=1.50) 47 | resistance n-channel dynamic-high 10.0 1.50 2154.0 48 | resistance n-channel dynamic-low 10.0 1.50 1454.0 49 | resistance n-channel static 10.0 1.50 862.1 50 | 51 | resistance p-channel dynamic-high 20.0 1.50 1631.0 52 | resistance p-channel dynamic-low 20.0 1.50 3038.0 53 | resistance p-channel static 20.0 1.50 949.1 54 | 55 | ; C=500.00fF, P(w=20.00, l=2.00), N(w=10.00, l=2.00) 56 | resistance n-channel dynamic-high 10.0 2.00 3114.0 57 | resistance n-channel dynamic-low 10.0 2.00 1564.6 58 | resistance n-channel static 10.0 2.00 1382.8 59 | 60 | resistance p-channel dynamic-high 20.0 2.00 2514.0 61 | resistance p-channel dynamic-low 20.0 2.00 5404.0 62 | resistance p-channel static 20.0 2.00 1440.0 63 | 64 | -------------------------------------------------------------------------------- /lib/calibrate_hspice/scmos60.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; Configuration file for 1.2um SCMOS (lambda=0.6um) 3 | ; parameters extracted from spice BSIM models 4 | ; 5 | ; This file corresponds to a mosis parametric 6 | ; test results report for the 1.2um HP CMOS34 run. 7 | ; 8 | ; Resistance values are for med temp (70 C) and low voltage (5 V) 9 | ; 10 | ; Yang 7/95 11 | ; 12 | 13 | 14 | lambda 0.6 ; microns/lambda 15 | 16 | capda .000090 ; n-diffusion capacitance -- area, pf/sq-micron 17 | capdp .000125 ; n-diffusion capacitance -- perimeter, pf/micron 18 | cappda .000280 ; p-diffusion capacitance -- area, pf/sq-micron 19 | cappdp .000125 ; p-diffusion capacitance -- perimeter, pf/micron 20 | capga .0015 ; gate capacitance -- area, pf/sq-micron 21 | 22 | 23 | lowthresh 0.4 ; 24 | highthresh 0.6 ; 25 | 26 | cntpullup 0 ; irelevant (no depletion devices) 27 | subparea 0 ; count poly over diff as bulk poly cap. 28 | diffperim 0 ; include diff. perims that border on xtror gates 29 | diffext 0 ; dont put default cap. 30 | 31 | ; Supply 5.0 32 | ; C=500.00fF, P(w=10.00, l=1.20), N(w=3.00, l=1.20) 33 | resistance n-channel dynamic-high 3.0 1.20 8744.0 34 | resistance n-channel dynamic-low 3.0 1.20 4256.0 35 | resistance n-channel static 3.0 1.20 4211.1 36 | 37 | resistance p-channel dynamic-high 10.0 1.20 3066.0 38 | resistance p-channel dynamic-low 10.0 1.20 6922.0 39 | resistance p-channel static 10.0 1.20 2986.0 40 | ; C=500.00fF, P(w=30.00, l=1.20), N(w=15.00, l=1.20) 41 | resistance n-channel dynamic-high 15.0 1.20 1432.2 42 | resistance n-channel dynamic-low 15.0 1.20 910.2 43 | resistance n-channel static 15.0 1.20 513.4 44 | 45 | resistance p-channel dynamic-high 30.0 1.20 1194.8 46 | resistance p-channel dynamic-low 30.0 1.20 2244.0 47 | resistance p-channel static 30.0 1.20 602.2 48 | ; C=500.00fF, P(w=30.00, l=1.80), N(w=15.00, l=1.80) 49 | resistance n-channel dynamic-high 15.0 1.80 2178.0 50 | resistance n-channel dynamic-low 15.0 1.80 1163.6 51 | resistance n-channel static 15.0 1.80 901.9 52 | 53 | resistance p-channel dynamic-high 30.0 1.80 1821.8 54 | resistance p-channel dynamic-low 30.0 1.80 3744.0 55 | resistance p-channel static 30.0 1.80 823.0 56 | ; C=500.00fF, P(w=30.00, l=2.40), N(w=15.00, l=2.40) 57 | resistance n-channel dynamic-high 15.0 2.40 3080.0 58 | resistance n-channel dynamic-low 15.0 2.40 1557.2 59 | resistance n-channel static 15.0 2.40 1301.2 60 | 61 | resistance p-channel dynamic-high 30.0 2.40 2600.0 62 | resistance p-channel dynamic-low 30.0 2.40 5424.0 63 | resistance p-channel static 30.0 2.40 904.3 64 | 65 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/Makefindr: -------------------------------------------------------------------------------- 1 | CFLAGS = -g 2 | 3 | findr : findr.c 4 | cc $(CFLAGS) -o findr findr.c 5 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/ckt.spi: -------------------------------------------------------------------------------- 1 | * 2 | * spice test file for generating .prm files. 3 | * 4 | * out1 - Output of Inverter to measure step response. 5 | * 6 | M0 out1 in1 GND GND N_FET L=N_LENU W=N_WITHU 7 | M1 out1 in1 VDD VDD P_FET L=P_LENU W=P_WITHU 8 | * 9 | * out2 - Output of Inverter driven by out1 to determine slow-input effect. 10 | * 11 | M6 out2 out1 GND GND N_FET L=N_LENU W=N_WITHU 12 | M7 out2 out1 VDD VDD P_FET L=P_LENU W=P_WITHU 13 | * 14 | * out3 - Output of a N_FET pulling up to determine dynamic-high resistance. 15 | * 16 | M2 out3 in2 VDD GND N_FET L=N_LENU W=N_WITHU 17 | * 18 | * out4 - Output of a P_FET pulling down to determine dynamic-low resistance. 19 | * 20 | M3 out4 in3 GND VDD P_FET L=P_LENU W=P_WITHU 21 | * 22 | * loading capacitors 23 | * 24 | C0 out1 GND C_LOADFF 25 | C1 out2 GND C_LOADFF 26 | C2 out3 GND C_LOADFF 27 | C3 out4 GND C_LOADFF 28 | 29 | VDD VDD 0 DC 5 30 | VGnd GND 0 DC 0 31 | Vmid mid 0 DC 2.5 32 | 33 | Vin1 in1 0 0 pwl (0ns 0 0.1ns 5 40ns 5 40.1ns 0) 34 | Vin2 in2 0 0 pwl (0ns 0 0.1ns 5) 35 | Vin3 in3 0 5 pwl (0ns 5 0.1ns 0) 36 | 37 | .ic V(out4)=5 38 | 39 | .tran 0.01ns 80ns 40 | 41 | .end 42 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/cs.spi: -------------------------------------------------------------------------------- 1 | *MOSIS Charge Sharing for 2U CMOS MODELS 2 | 3 | .MODEL nfet NMOS LEVEL=2 LD=0.115U TOX=423E-10 4 | +NSUB=1.0125225E+16 VTO=0.822163 KP=4.893760E-5 GAMMA=0.47 5 | +PHI=0.6 UO=599.496 UEXP=5.324966E-3 UCRIT=12714.2 6 | +DELTA=3.39718E-5 VMAX=65466.1 XJ=0.55U LAMBDA=1.991479e-2 7 | +NFS=5.666758E+11 NEFF=1.0010E-2 NSS=0.0 TPG=1.00 8 | +RSH=0 CGSO=0.9388E-10 CGDO=0.9388E-10 CJ=1.4563E-4 9 | +MJ=0.6 CJSW=6.617E-10 MJSW=0.31 10 | 11 | .MODEL pfet PMOS LEVEL=2 LD=0.18U TOX=423E-10 12 | +NSUB=1.421645E+15 VTO=-0.776658 KP=1.916950E-5 GAMMA=0.52 13 | +PHI=0.6 UO=234.831 UEXP=0.142293 UCRIT=20967 14 | +DELTA=1.0E-6 VMAX=34600.2 XJ=0.41U LAMBDA=4.921086E-2 15 | +NFS=4.744781E+11 NEFF=1.0010E-2 NSS=0.0 TPG=-1.00 16 | +RSH=0 CGSO=1.469E-10 CGDO=1.469E-10 CJ=2.4E-4 17 | +MJ=0.5 CJSW=3.62E-10 MJSW=0.29 18 | * 19 | M0 N1 in N2 GND nfet L=2.0U W=10.0U 20 | C0 N1 GND0 1000FF 21 | C1 N2 GND1 4000FF 22 | 23 | VGnd GND 0 DC 0 24 | VGnd0 GND0 0 DC 0 25 | VGnd1 GND1 0 DC 0 26 | 27 | Vin in 0 0 pwl (0ns 0 0.01ns 5) 28 | 29 | .ic V(N1)=5 30 | .ic V(N2)=0 31 | 32 | .tran 0.01ns 10ns 33 | 34 | .end 35 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/dev.1_6um: -------------------------------------------------------------------------------- 1 | # 2 | set pwith = 20.0 # with of p-device in um 3 | set plen = 1.6 # length of p-device in um 4 | set nwith = 10.0 # with of n-device in um 5 | set nlen = 1.6 # lenght of n-device in um 6 | set cap = 1000 # loading capacitance in fF 7 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/dev.2um: -------------------------------------------------------------------------------- 1 | # 2 | set pwith = 20.0 # with of p-device in um 3 | set plen = 2.0 # length of p-device in um 4 | set nwith = 10.0 # with of n-device in um 5 | set nlen = 2.0 # lenght of n-device in um 6 | set cap = 1000 # loading capacitance in fF 7 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/findr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RTimothyEdwards/irsim/34b1e7bbb1014346a5bbe9171bd25840ee020578/lib/calibrate_spice3/findr -------------------------------------------------------------------------------- /lib/calibrate_spice3/getres: -------------------------------------------------------------------------------- 1 | #! /bin/csh 2 | 3 | set spice = ~cad/bin/spice 4 | 5 | if( $#argv != 2 ) then 6 | echo "usage: getres model_file dev_file" 7 | exit 1 8 | endif 9 | 10 | if( ! -f $1 ) then 11 | echo "can't open spice model file '"$1"'" 12 | exit 1 13 | endif 14 | 15 | if( -f $argv[2] ) then 16 | source $argv[2] 17 | else 18 | echo "can't open device configuratin file '"$argv[2]"'" 19 | exit 1 20 | endif 21 | 22 | set nmos = `grep -i "\.MODEL" $1 | grep -i NMOS` 23 | set pmos = `grep -i "\.MODEL" $1 | grep -i PMOS` 24 | 25 | if( $#nmos == 0 ) then 26 | echo "can't find nmos .MODEL card in '"$1"'" 27 | exit 1 28 | endif 29 | if( $#pmos == 0 ) then 30 | echo "can't find pmos .MODEL card in '"$1"'" 31 | exit 1 32 | endif 33 | 34 | cat $1 ckt.spi > tmp.spi 35 | 36 | ed - <& /dev/null 37 | g/N_FET/s/N_FET/$nmos[2]/g 38 | g/P_FET/s/P_FET/$pmos[2]/g 39 | g/C_LOAD/s/C_LOAD/$cap/g 40 | g/N_WITH/s/N_WITH/$nwith/g 41 | g/N_LEN/s/N_LEN/$nlen/g 42 | g/P_WITH/s/P_WITH/$pwith/g 43 | g/P_LEN/s/P_LEN/$plen/g 44 | w 45 | q 46 | end 47 | 48 | $spice -n -b -r spi.out tmp.spi 49 | 50 | if( $status != 0 ) then 51 | echo "something went wrong with spice, look at 'tmp.spi'" 52 | exit 1 53 | endif 54 | 55 | ./findr -c $cap -n $nwith,$nlen -p $pwith,$plen spi.out |& tee resists 56 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/mosis1_6u.spi: -------------------------------------------------------------------------------- 1 | .model m98u_du2 r rsh = 137.8 defw = 0 narrow = 0 2 | .model m98u_du2 c cj = 0.0004213 cjsw = 1.925e-10 defw = 0 narrow = 0 3 | .model m98u_du1 r rsh = 73.79 defw = 0 narrow = 0 4 | .model m98u_du1 c cj = 0.0001154 cjsw = 5.376e-10 defw = 0 narrow = 0 5 | .model m98u_ml2 r rsh = 0.028 defw = 0 narrow = 0 6 | .model m98u_ml2 c cj = 0 cjsw = 0 defw = 0 narrow = 0 7 | .model m98u_ml1 r rsh = 0.054 defw = 0 narrow = 0 8 | .model m98u_ml1 c cj = 0 cjsw = 0 defw = 0 narrow = 0 9 | .model pm1 pmos level=4 10 | + vfb = -0.42297 lvfb = 0.0179715 wvfb = 0.0434289 11 | + phi = 0.732559 lphi = 0 wphi = 0 12 | + k1 = 0.493218 lk1 = -0.063134 wk1 = 0.309532 13 | + k2 = -0.023484 lk2 = 0.00657988 wk2 = 0.0861925 14 | + eta = -0.0071262 leta = 0.0233634 weta = 0.0117427 15 | + muz = 194.389 dl = 0.413759 dw = 0.415865 16 | + u0 = 0.129648 lu0 = 0.0651435 wu0 = -0.084048 17 | + u1 = 0.00132397 lu1 = 0.127142 wu1 = 0.0157641 18 | + x2mz = 9.21433 lx2mz = -1.6723 wx2mz = 2.4635 19 | + x2e = 0.000112942 lx2e = -0.0015519 wx2e = -0.00069824 20 | + x3e = 0.00093695 lx3e = -0.0020473 wx3e = -0.0010492 21 | + x2u0 = 0.00701452 lx2u0 = -0.00055748 wx2u0 = 0.000568603 22 | + x2u1 = 0.00495105 lx2u1 = -0.0047192 wx2u1 = 0.00772334 23 | + mus = 186.412 lmus = 88.6957 wmus = 13.9146 24 | + x2ms = 7.7035 lx2ms = 2.17351 wx2ms = 8.71539 25 | + x3ms = -1.6679 lx3ms = 6.72368 wx3ms = 0.591897 26 | + x3u1 = -0.042787 lx3u1 = 0.0399626 wx3u1 = 0.00117455 27 | + tox = 0.0261 temp = 27 vdd = 5 28 | + cgdo = 4.10566e-10 cgso = 4.10566e-10 cgbo = 7.48472e-10 29 | + xpart = 1 30 | + n0 = 1 ln0 = 0 wn0 = 0 31 | + nb = 0 lnb = 0 wnb = 0 32 | + nd = 0 lnd = 0 wnd = 0 33 | + rsh = 137.8 cj = 0.0004213 cjsw = 1.925e-10 34 | + js = 0 pb = 0.85 pbsw = 0.85 35 | + mj = 0.4706 mjsw = 0.3224 wdf = 0 36 | + dell = 0 37 | .model nm1 nmos level=4 38 | + vfb = -1.0201 lvfb = 0.163663 wvfb = 0.061989 39 | + phi = 0.788032 lphi = 0 wphi = 0 40 | + k1 = 1.3137 lk1 = -0.18261 wk1 = -0.12209 41 | + k2 = 0.245245 lk2 = 0.0147686 wk2 = -0.13972 42 | + eta = -0.009158 leta = 0.0218873 weta = 0.00243441 43 | + muz = 533.387 dl = 0.616906 dw = 0.248091 44 | + u0 = 0.0605701 lu0 = 0.0588901 wu0 = -0.057239 45 | + u1 = 0.0701602 lu1 = 0.389641 wu1 = -0.13923 46 | + x2mz = 2.89222 lx2mz = -4.3296 wx2mz = 36.8633 47 | + x2e = -0.0030054 lx2e = -0.0040516 wx2e = -0.00033448 48 | + x3e = 0.000688347 lx3e = -0.0015262 wx3e = -0.0044141 49 | + x2u0 = -0.0011753 lx2u0 = -0.0007348 wx2u0 = 0.0165173 50 | + x2u1 = -0.016385 lx2u1 = 0.0219971 wx2u1 = 0.0124124 51 | + mus = 694.783 lmus = 229.454 wmus = -204.53 52 | + x2ms = -10.156 lx2ms = 20.505 wx2ms = 62.192 53 | + x3ms = 12.5275 lx3ms = 49.102 wx3ms = -46.021 54 | + x3u1 = 0.0208261 lx3u1 = 0.03636 wx3u1 = -0.040294 55 | + tox = 0.0261 temp = 27 vdd = 5 56 | + cgdo = 6.12145e-10 cgso = 6.12145e-10 cgbo = 6.9872e-10 57 | + xpart = 1 58 | + n0 = 1 ln0 = 0 wn0 = 0 59 | + nb = 0 lnb = 0 wnb = 0 60 | + nd = 0 lnd = 0 wnd = 0 61 | + rsh = 73.79 cj = 0.0001154 cjsw = 5.376e-10 62 | + js = 0 pb = 0.8 pbsw = 0.8 63 | + mj = 0.551 mjsw = 0.275 wdf = 0 64 | + dell = 0 65 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/mosis2u.spi: -------------------------------------------------------------------------------- 1 | *MOSIS 2U CMOS MODELS 2 | 3 | .MODEL nfet NMOS LEVEL=2 LD=0.115U TOX=423E-10 4 | +NSUB=1.0125225E+16 VTO=0.822163 KP=4.893760E-5 GAMMA=0.47 5 | +PHI=0.6 UO=599.496 UEXP=5.324966E-3 UCRIT=12714.2 6 | +DELTA=3.39718E-5 VMAX=65466.1 XJ=0.55U LAMBDA=1.991479e-2 7 | +NFS=5.666758E+11 NEFF=1.0010E-2 NSS=0.0 TPG=1.00 8 | +RSH=0 CGSO=0.9388E-10 CGDO=0.9388E-10 CJ=1.4563E-4 9 | +MJ=0.6 CJSW=6.617E-10 MJSW=0.31 10 | 11 | .MODEL pfet PMOS LEVEL=2 LD=0.18U TOX=423E-10 12 | +NSUB=1.421645E+15 VTO=-0.776658 KP=1.916950E-5 GAMMA=0.52 13 | +PHI=0.6 UO=234.831 UEXP=0.142293 UCRIT=20967 14 | +DELTA=1.0E-6 VMAX=34600.2 XJ=0.41U LAMBDA=4.921086E-2 15 | +NFS=4.744781E+11 NEFF=1.0010E-2 NSS=0.0 TPG=-1.00 16 | +RSH=0 CGSO=1.469E-10 CGDO=1.469E-10 CJ=2.4E-4 17 | +MJ=0.5 CJSW=3.62E-10 MJSW=0.29 18 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/scmos1_6um.prm: -------------------------------------------------------------------------------- 1 | ; configuration file for scmos with lamba = 1.0 (1.6um process) 2 | ; parameters extracted from spice BSIM models for use with ext2sim. 3 | ; 4 | 5 | capga .001321 ; gate capacitance -- area, pf/sq-micron 6 | 7 | lambda 0.8 ; microns/lambda 8 | 9 | lowthresh 0.4 ; logic low threshold as a normalized voltage 10 | 11 | highthresh 0.6 ; logic high threshold as a normalized voltage 12 | 13 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 14 | 15 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 16 | 17 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 18 | 19 | diffext 0 ; diffusion extension for each transistor 20 | 21 | ; n-channel resistance 22 | resistance n-channel dynamic-high 10.0 1.6 2271.0 23 | resistance n-channel dynamic-low 10.0 1.6 1264.0 24 | resistance n-channel static 10.0 1.6 1201.0 25 | 26 | ; p-channel resistance 27 | resistance p-channel dynamic-high 20.0 1.6 1752.0 28 | resistance p-channel dynamic-low 20.0 1.6 3374.0 29 | resistance p-channel static 20.0 1.6 1466.0 30 | -------------------------------------------------------------------------------- /lib/calibrate_spice3/scmos2um.prm: -------------------------------------------------------------------------------- 1 | ; configuration file for scmos with lamba = 1.0 (2um process) 2 | ; 3 | 4 | capm2a .00000 ; 2nd metal capacitance -- area, pf/sq-micron 5 | capm2p .00020 ; 2nd metal capacitance -- perimeter, pf/micron 6 | capma .00003 ; 1st metal capacitance -- area, pf/sq-micron 7 | capmp .00020 ; 1st metal capacitance -- perimeter, pf/micron 8 | cappa .00007 ; poly capacitance -- area, pf/sq-micron 9 | cappp .00020 ; poly capacitance -- perimeter, pf/micron 10 | capda .00030 ; n-diffusion capacitance -- area, pf/sq-micron 11 | capdp .00030 ; n-diffusion capacitance -- perimeter, pf/micron 12 | cappda .00030 ; p-diffusion capacitance -- area, pf/sq-micron 13 | cappdp .00030 ; p-diffusion capacitance -- perimeter, pf/micron 14 | 15 | capga .000816 ; gate capacitance -- area, pf/sq-micron 16 | 17 | lambda 1.0 ; microns/lambda 18 | 19 | lowthresh 0.4 ; logic low threshold as a normalized voltage 20 | 21 | highthresh 0.6 ; logic high threshold as a normalized voltage 22 | 23 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 24 | 25 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 26 | 27 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 28 | 29 | diffext 0 ; diffusion extension for each transistor 30 | 31 | ; n-channel resistance 32 | resistance n-channel dynamic-high 10.0 2.0 3847.0 33 | resistance n-channel dynamic-low 10.0 2.0 1856.0 34 | resistance n-channel static 10.0 2.0 2472.0 35 | 36 | ; p-channel resistance 37 | resistance p-channel dynamic-high 20.0 2.0 2020.0 38 | resistance p-channel dynamic-low 20.0 2.0 3969.0 39 | resistance p-channel static 20.0 2.0 2011.0 40 | -------------------------------------------------------------------------------- /lib/prm/amiabn.80.n99z.5.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 8 1.6 2134.30 2 | resistance p-channel dynamic-high 23.2 1.6 1736.00 3 | resistance n-channel static 8 1.6 2432.57 4 | resistance p-channel static 23.2 1.6 1930.88 5 | resistance n-channel dynamic-high 8 1.6 4424.00 6 | resistance p-channel dynamic-low 23.2 1.6 3806.80 7 | -------------------------------------------------------------------------------- /lib/prm/amic5.30.n98s.3.3.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 3 0.6 2959.60 2 | resistance p-channel dynamic-high 8.7 0.6 1965.70 3 | resistance n-channel static 3 0.6 3858.26 4 | resistance p-channel static 8.7 0.6 2874.04 5 | resistance n-channel dynamic-high 3 0.6 7794.00 6 | resistance p-channel dynamic-low 8.7 0.6 6568.70 7 | -------------------------------------------------------------------------------- /lib/prm/amicwl.50.n97l.5.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 5 1 1251.10 2 | resistance p-channel dynamic-high 13.5 1 943.97 3 | resistance n-channel static 5 1 1206.74 4 | resistance p-channel static 13.5 1 970.84 5 | resistance n-channel dynamic-high 5 1 2302.30 6 | resistance p-channel dynamic-low 13.5 1 1820.00 7 | -------------------------------------------------------------------------------- /lib/prm/hpcmos10.20.n98v.3.3.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 2 0.4 1712.80 2 | resistance p-channel dynamic-high 6.8 0.4 1351.30 3 | resistance n-channel static 2 0.4 2092.97 4 | resistance p-channel static 6.8 0.4 1643.51 5 | resistance n-channel dynamic-high 2 0.4 3616.90 6 | resistance p-channel dynamic-low 6.8 0.4 3401.20 7 | -------------------------------------------------------------------------------- /lib/prm/hpcmos14.30.n9ae.3.3.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 3 0.6 1647.90 2 | resistance p-channel dynamic-high 8.1 0.6 1174.10 3 | resistance n-channel static 3 0.6 2051.58 4 | resistance p-channel static 8.1 0.6 1503.97 5 | resistance n-channel dynamic-high 3 0.6 3417.40 6 | resistance p-channel dynamic-low 8.1 0.6 2729.60 7 | -------------------------------------------------------------------------------- /lib/prm/hpcmos26.40.n88x.5.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 4 0.8 1658.60 2 | resistance p-channel dynamic-high 11.2 0.8 1304.90 3 | resistance n-channel static 4 0.8 1799.76 4 | resistance p-channel static 11.2 0.8 1340.87 5 | resistance n-channel dynamic-high 4 0.8 3084.10 6 | resistance p-channel dynamic-low 11.2 0.8 2686.10 7 | -------------------------------------------------------------------------------- /lib/prm/orbit.60.n96e.5.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 6 1.2 1352.50 2 | resistance p-channel dynamic-high 6 1.2 1270.60 3 | resistance n-channel static 6 1.2 1734.94 4 | resistance p-channel static 6 1.2 562.57 5 | resistance n-channel dynamic-high 6 1.2 2398.20 6 | resistance p-channel dynamic-low 6 1.2 1837.30 7 | -------------------------------------------------------------------------------- /lib/prm/scmos100.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; Configuration file for 2.0um SCMOS (lambda=1.0um) 3 | ; parameters extracted from spice MOSIS supplied BSIM models 4 | ; 5 | ; Resistance values are for med temp (70 C) and nom voltage (5 V) 6 | ; 7 | ; Yang 7/95 8 | 9 | lambda 1.0 ; microns/lambda 10 | 11 | capga .00105 ; gate capacitance -- area, pf/sq-micron 12 | 13 | capda .000042 ; n-diffusion capacitance -- area, pf/sq-micron 14 | capdp .000300 ; n-diffusion capacitance -- perimeter, pf/micron 15 | cappda .000195 ; p-diffusion capacitance -- area, pf/sq-micron 16 | cappdp .000176 ; p-diffusion capacitance -- perimeter, pf/micron 17 | 18 | 19 | lowthresh 0.4 ; 20 | highthresh 0.6 ; 21 | 22 | cntpullup 0 ; irelevant (no depletion devices) 23 | 24 | subparea 0 ; count poly over diff as bulk poly cap. 25 | 26 | diffperim 0 ; include diff. perims that border on xtror gates 27 | 28 | diffext 0 ; dont put default cap. 29 | 30 | ;5V Supply 31 | ; C=500.00fF, P(w=6.50, l=2.00), N(w=2.50, l=2.00) 32 | resistance n-channel dynamic-high 2.5 2.00 26580.0 33 | resistance n-channel dynamic-low 2.5 2.00 9214.0 34 | resistance n-channel static 2.5 2.00 12234.3 35 | 36 | resistance p-channel dynamic-high 6.5 2.00 8090.0 37 | resistance p-channel dynamic-low 6.5 2.00 19368.0 38 | resistance p-channel static 6.5 2.00 8240.1 39 | ; C=500.00fF, P(w=15.00, l=2.00), N(w=5.00, l=2.00) 40 | resistance n-channel dynamic-high 5.0 2.00 11260.0 41 | resistance n-channel dynamic-low 5.0 2.00 5140.0 42 | resistance n-channel static 5.0 2.00 5340.5 43 | 44 | resistance p-channel dynamic-high 15.0 2.00 3834.0 45 | resistance p-channel dynamic-low 15.0 2.00 8340.0 46 | resistance p-channel static 15.0 2.00 3320.0 47 | ; C=1000.00fF, P(w=30.00, l=2.00), N(w=15.00, l=2.00) 48 | resistance n-channel dynamic-high 15.0 2.00 3443.0 49 | resistance n-channel dynamic-low 15.0 2.00 1775.0 50 | resistance n-channel static 15.0 2.00 1679.8 51 | 52 | resistance p-channel dynamic-high 30.0 2.00 1956.0 53 | resistance p-channel dynamic-low 30.0 2.00 4145.0 54 | resistance p-channel static 30.0 2.00 1615.0 55 | 56 | ; C=1000.00fF, P(w=30.00, l=3.00), N(w=15.00, l=3.00) 57 | resistance n-channel dynamic-high 15.0 3.00 5624.0 58 | resistance n-channel dynamic-low 15.0 3.00 2529.0 59 | resistance n-channel static 15.0 3.00 2830.8 60 | 61 | resistance p-channel dynamic-high 30.0 3.00 3244.0 62 | resistance p-channel dynamic-low 30.0 3.00 8339.0 63 | resistance p-channel static 30.0 3.00 3072.0 64 | 65 | ; C=1000.00fF, P(w=30.00, l=4.00), N(w=15.00, l=4.00) 66 | resistance n-channel dynamic-high 15.0 4.00 8007.0 67 | resistance n-channel dynamic-low 15.0 4.00 3416.0 68 | resistance n-channel static 15.0 4.00 3975.5 69 | 70 | resistance p-channel dynamic-high 30.0 4.00 4785.0 71 | resistance p-channel dynamic-low 30.0 4.00 13040.0 72 | resistance p-channel static 30.0 4.00 4373.1 73 | 74 | -------------------------------------------------------------------------------- /lib/prm/scmos1_6um.prm: -------------------------------------------------------------------------------- 1 | ; configuration file for scmos with lamba = 1.0 (1.6um process) 2 | ; parameters extracted from spice BSIM models for use with ext2sim. 3 | ; 4 | 5 | capga .001321 ; gate capacitance -- area, pf/sq-micron 6 | 7 | lambda 0.8 ; microns/lambda 8 | 9 | lowthresh 0.4 ; logic low threshold as a normalized voltage 10 | 11 | highthresh 0.6 ; logic high threshold as a normalized voltage 12 | 13 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 14 | 15 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 16 | 17 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 18 | 19 | diffext 0 ; diffusion extension for each transistor 20 | 21 | ; n-channel resistance 22 | resistance n-channel dynamic-high 10.0 1.6 2271.0 23 | resistance n-channel dynamic-low 10.0 1.6 1264.0 24 | resistance n-channel static 10.0 1.6 1201.0 25 | 26 | ; p-channel resistance 27 | resistance p-channel dynamic-high 20.0 1.6 1752.0 28 | resistance p-channel dynamic-low 20.0 1.6 3374.0 29 | resistance p-channel static 20.0 1.6 1466.0 30 | -------------------------------------------------------------------------------- /lib/prm/scmos2um.prm: -------------------------------------------------------------------------------- 1 | ; configuration file for scmos with lamba = 1.0 (2um process) 2 | ; 3 | 4 | capm2a .00000 ; 2nd metal capacitance -- area, pf/sq-micron 5 | capm2p .00020 ; 2nd metal capacitance -- perimeter, pf/micron 6 | capma .00003 ; 1st metal capacitance -- area, pf/sq-micron 7 | capmp .00020 ; 1st metal capacitance -- perimeter, pf/micron 8 | cappa .00007 ; poly capacitance -- area, pf/sq-micron 9 | cappp .00020 ; poly capacitance -- perimeter, pf/micron 10 | capda .00030 ; n-diffusion capacitance -- area, pf/sq-micron 11 | capdp .00030 ; n-diffusion capacitance -- perimeter, pf/micron 12 | cappda .00030 ; p-diffusion capacitance -- area, pf/sq-micron 13 | cappdp .00030 ; p-diffusion capacitance -- perimeter, pf/micron 14 | 15 | capga .000816 ; gate capacitance -- area, pf/sq-micron 16 | 17 | lambda 1.0 ; microns/lambda 18 | 19 | lowthresh 0.4 ; logic low threshold as a normalized voltage 20 | 21 | highthresh 0.6 ; logic high threshold as a normalized voltage 22 | 23 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 24 | 25 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 26 | 27 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 28 | 29 | diffext 0 ; diffusion extension for each transistor 30 | 31 | ; n-channel resistance 32 | resistance n-channel dynamic-high 10.0 2.0 3847.0 33 | resistance n-channel dynamic-low 10.0 2.0 1856.0 34 | resistance n-channel static 10.0 2.0 2472.0 35 | 36 | ; p-channel resistance 37 | resistance p-channel dynamic-high 20.0 2.0 2020.0 38 | resistance p-channel dynamic-low 20.0 2.0 3969.0 39 | resistance p-channel static 20.0 2.0 2011.0 40 | -------------------------------------------------------------------------------- /lib/prm/scmos30.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; configuration file for scmos with lamba = 0.35 (0.6um process + 1um) 3 | ; 4 | ; The results have been extracted with TM at 3.3 5 | ; The bsim models by hp have been used 6 | 7 | lambda 0.30 ; 8 | 9 | capga .0031 ; gate capacitance -- area, pf/sq-micron 10 | 11 | capda 0.000240 12 | capdp 0.000250 13 | cappda 0.000570 14 | cappdp 0.000175 15 | 16 | lowthresh 0.4 ; logic low threshold as a normalized voltage 17 | highthresh 0.6 ; logic high threshold as a normalized voltage 18 | 19 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 20 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 21 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 22 | diffext 0 ; diffusion extension for each transistor 23 | 24 | ;0.6um channel 25 | ; C=500.00fF, P(w=6.50, l=0.60), N(w=2.50, l=0.60) 26 | resistance n-channel dynamic-high 2.5 0.60 5064.0 27 | resistance n-channel dynamic-low 2.5 0.60 2212.0 28 | resistance n-channel static 2.5 0.60 2914.5 29 | 30 | resistance p-channel dynamic-high 6.5 0.60 1799.6 31 | resistance p-channel dynamic-low 6.5 0.60 4056.0 32 | resistance p-channel static 6.5 0.60 1999.7 33 | 34 | ; C=500.00fF, P(w=20.00, l=0.60), N(w=10.00, l=0.60) 35 | resistance n-channel dynamic-high 10.0 0.60 1028.6 36 | resistance n-channel dynamic-low 10.0 0.60 561.6 37 | resistance n-channel static 10.0 0.60 505.7 38 | 39 | resistance p-channel dynamic-high 20.0 0.60 662.8 40 | resistance p-channel dynamic-low 20.0 0.60 1281.8 41 | resistance p-channel static 20.0 0.60 453.3 42 | ; C=500.00fF, P(w=20.00, l=0.90), N(w=10.00, l=0.90) 43 | resistance n-channel dynamic-high 10.0 0.90 1714.4 44 | resistance n-channel dynamic-low 10.0 0.90 833.8 45 | resistance n-channel static 10.0 0.90 734.6 46 | 47 | resistance p-channel dynamic-high 20.0 0.90 1067.2 48 | resistance p-channel dynamic-low 20.0 0.90 2488.0 49 | resistance p-channel static 20.0 0.90 851.7 50 | ; C=500.00fF, P(w=20.00, l=1.20), N(w=10.00, l=1.20) 51 | resistance n-channel dynamic-high 10.0 1.20 2524.0 52 | resistance n-channel dynamic-low 10.0 1.20 1098.8 53 | resistance n-channel static 10.0 1.20 1030.2 54 | 55 | resistance p-channel dynamic-high 20.0 1.20 1524.8 56 | resistance p-channel dynamic-low 20.0 1.20 3772.0 57 | resistance p-channel static 20.0 1.20 1148.7 58 | -------------------------------------------------------------------------------- /lib/prm/scmos35.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; configuration file for scmos with lamba = 0.35 (0.6um process + 1um) 3 | ; 4 | 5 | lambda 0.35 ; 6 | 7 | capga .00315 ; gate capacitance -- area, pf/sq-micron 8 | 9 | capda 0.00024 10 | capdp 0.00026 11 | cappda 0.000580 12 | cappdp 0.000170 13 | 14 | lowthresh 0.4 ; logic low threshold as a normalized voltage 15 | highthresh 0.6 ; logic high threshold as a normalized voltage 16 | 17 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 18 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 19 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 20 | diffext 0 ; diffusion extension for each transistor 21 | 22 | 23 | ;0.7um channel 24 | ; C=500.00fF, P(w=6.50, l=0.70), N(w=2.50, l=0.70) 25 | resistance n-channel dynamic-high 2.5 0.70 6316.0 26 | resistance n-channel dynamic-low 2.5 0.70 2718.0 27 | resistance n-channel static 2.5 0.70 3340.0 28 | 29 | resistance p-channel dynamic-high 6.5 0.70 2148.0 30 | resistance p-channel dynamic-low 6.5 0.70 5354.0 31 | resistance p-channel static 6.5 0.70 2560.6 32 | ; C=500.00fF, P(w=20.00, l=0.70), N(w=10.00, l=0.70) 33 | resistance n-channel dynamic-high 10.0 0.70 1267.0 34 | resistance n-channel dynamic-low 10.0 0.70 672.0 35 | resistance n-channel static 10.0 0.70 577.8 36 | 37 | resistance p-channel dynamic-high 20.0 0.70 791.6 38 | resistance p-channel dynamic-low 20.0 0.70 1688.4 39 | resistance p-channel static 20.0 0.70 607.8 40 | ; C=500.00fF, P(w=20.00, l=1.05), N(w=10.00, l=1.05) 41 | resistance n-channel dynamic-high 10.0 1.05 2124.0 42 | resistance n-channel dynamic-low 10.0 1.05 961.6 43 | resistance n-channel static 10.0 1.05 884.8 44 | 45 | resistance p-channel dynamic-high 20.0 1.05 1294.0 46 | resistance p-channel dynamic-low 20.0 1.05 3124.0 47 | resistance p-channel static 20.0 1.05 1012.2 48 | 49 | ; C=500.00fF, P(w=20.00, l=1.40), N(w=10.00, l=1.40) 50 | resistance n-channel dynamic-high 10.0 1.40 3052.0 51 | resistance n-channel dynamic-low 10.0 1.40 1295.6 52 | resistance n-channel static 10.0 1.40 1210.4 53 | 54 | resistance p-channel dynamic-high 20.0 1.40 1856.0 55 | resistance p-channel dynamic-low 20.0 1.40 4626.0 56 | resistance p-channel static 20.0 1.40 1297.4 57 | 58 | ; C=800.00ff, P(w=26.00u,l= 0.70u), n(w=10.00u,l= 0.70u) 59 | resistance n-channel dynamic-high 10.0 0.7 1267.0 60 | resistance n-channel dynamic-low 10.0 0.7 634.0 61 | resistance n-channel static 10.0 0.7 598.0 62 | 63 | resistance p-channel dynamic-high 26.0 0.7 576.0 64 | resistance p-channel dynamic-low 26.0 0.7 1282.0 65 | resistance p-channel static 26.0 0.7 667.0 66 | 67 | -------------------------------------------------------------------------------- /lib/prm/scmos50_3v.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; configuration file for scmos with lamba = 0.5 (0.8um process) 3 | ; 4 | ; The results have been extracted with 3.3V supply and 85 degrees temp. 5 | ; The Hewlet Packard models have been used 6 | 7 | lambda 0.5 ; 8 | 9 | capga .0017 ; gate capacitance -- area, pf/sq-micron 10 | 11 | capda 0.000075 12 | capdp 0.000340 13 | cappda 0.000430 14 | cappdp 0.000230 15 | 16 | lowthresh 0.4 ; logic low threshold as a normalized voltage 17 | highthresh 0.6 ; logic high threshold as a normalized voltage 18 | 19 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 20 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 21 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 22 | diffext 0 ; diffusion extension for each transistor 23 | 24 | ; 3.3V 25 | ; C=500.00fF, P(w=6.50, l=1.00), N(w=2.50, l=1.00) 26 | resistance n-channel dynamic-high 2.5 1.00 8960.0 27 | resistance n-channel dynamic-low 2.5 1.00 4082.0 28 | resistance n-channel static 2.5 1.00 4868.0 29 | 30 | resistance p-channel dynamic-high 6.5 1.00 3612.0 31 | resistance p-channel dynamic-low 6.5 1.00 10428.0 32 | resistance p-channel static 6.5 1.00 4486.4 33 | 34 | ; C=500.00fF, P(w=20.00, l=1.00), N(w=10.00, l=1.00) 35 | resistance n-channel dynamic-high 10.0 1.00 1946.2 36 | resistance n-channel dynamic-low 10.0 1.00 1039.4 37 | resistance n-channel static 10.0 1.00 918.1 38 | 39 | resistance p-channel dynamic-high 20.0 1.00 1320.0 40 | resistance p-channel dynamic-low 20.0 1.00 3338.0 41 | resistance p-channel static 20.0 1.00 1113.3 42 | 43 | ; C=500.00fF, P(w=20.00, l=1.50), N(w=10.00, l=1.50) 44 | resistance n-channel dynamic-high 10.0 1.50 4050.0 45 | resistance n-channel dynamic-low 10.0 1.50 1814.2 46 | resistance n-channel static 10.0 1.50 1716.8 47 | 48 | resistance p-channel dynamic-high 20.0 1.50 2424.0 49 | resistance p-channel dynamic-low 20.0 1.50 6928.0 50 | resistance p-channel static 20.0 1.50 1949.5 51 | 52 | ; C=500.00fF, P(w=20.00, l=2.00), N(w=10.00, l=2.00) 53 | resistance n-channel dynamic-high 10.0 2.00 7468.0 54 | resistance n-channel dynamic-low 10.0 2.00 2346.0 55 | resistance n-channel static 10.0 2.00 2681.6 56 | 57 | resistance p-channel dynamic-high 20.0 2.00 3992.0 58 | resistance p-channel dynamic-low 20.0 2.00 14542.0 59 | resistance p-channel static 20.0 2.00 3167.7 60 | 61 | -------------------------------------------------------------------------------- /lib/prm/scmos50_5v.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; configuration file for scmos with lamba = 0.5 (0.8um process) 3 | ; 4 | ; The results have been extracted with 3.3V supply and 125 degrees temp. 5 | ; The Hewlett Packard models (cmos26) have been used 6 | ; 85C - TM - 5V 7 | ; 8 | 9 | lambda 0.5 ; 10 | 11 | capga .0018 ; gate capacitance -- area, pf/sq-micron 12 | 13 | capda 0.000066 14 | capdp 0.000310 15 | cappda 0.000395 16 | cappdp 0.000220 17 | 18 | lowthresh 0.4 ; logic low threshold as a normalized voltage 19 | highthresh 0.6 ; logic high threshold as a normalized voltage 20 | 21 | cntpullup 0 ; irrelevant, cmos technology; no depletion transistors 22 | diffperim 0 ; don't include diffusion perimeters for sidewall cap. 23 | subparea 0 ; poly over transistor won't count as part pf bulk-poly cap. 24 | diffext 0 ; diffusion extension for each transistor 25 | 26 | 27 | ; 5V 28 | ; C=500.00fF, P(w=6.50, l=1.00), N(w=2.50, l=1.00) 29 | resistance n-channel dynamic-high 2.5 1.00 5572.0 30 | resistance n-channel dynamic-low 2.5 1.00 3484.0 31 | resistance n-channel static 2.5 1.00 2952.3 32 | 33 | resistance p-channel dynamic-high 6.5 1.00 2584.0 34 | resistance p-channel dynamic-low 6.5 1.00 5118.0 35 | resistance p-channel static 6.5 1.00 2298.3 36 | 37 | ; C=500.00fF, P(w=20.00, l=1.00), N(w=10.00, l=1.00) 38 | resistance n-channel dynamic-high 10.0 1.00 1206.2 39 | resistance n-channel dynamic-low 10.0 1.00 881.4 40 | resistance n-channel static 10.0 1.00 495.7 41 | 42 | resistance p-channel dynamic-high 20.0 1.00 946.2 43 | resistance p-channel dynamic-low 20.0 1.00 1630.6 44 | resistance p-channel static 20.0 1.00 572.6 45 | 46 | ; C=500.00fF, P(w=20.00, l=1.50), N(w=10.00, l=1.50) 47 | resistance n-channel dynamic-high 10.0 1.50 2154.0 48 | resistance n-channel dynamic-low 10.0 1.50 1454.0 49 | resistance n-channel static 10.0 1.50 862.1 50 | 51 | resistance p-channel dynamic-high 20.0 1.50 1631.0 52 | resistance p-channel dynamic-low 20.0 1.50 3038.0 53 | resistance p-channel static 20.0 1.50 949.1 54 | 55 | ; C=500.00fF, P(w=20.00, l=2.00), N(w=10.00, l=2.00) 56 | resistance n-channel dynamic-high 10.0 2.00 3114.0 57 | resistance n-channel dynamic-low 10.0 2.00 1564.6 58 | resistance n-channel static 10.0 2.00 1382.8 59 | 60 | resistance p-channel dynamic-high 20.0 2.00 2514.0 61 | resistance p-channel dynamic-low 20.0 2.00 5404.0 62 | resistance p-channel static 20.0 2.00 1440.0 63 | 64 | -------------------------------------------------------------------------------- /lib/prm/scmos60.prm: -------------------------------------------------------------------------------- 1 | ; 2 | ; Configuration file for 1.2um SCMOS (lambda=0.6um) 3 | ; parameters extracted from spice BSIM models 4 | ; 5 | ; This file corresponds to a mosis parametric 6 | ; test results report for the 1.2um HP CMOS34 run. 7 | ; 8 | ; Resistance values are for med temp (70 C) and low voltage (5 V) 9 | ; 10 | ; Yang 7/95 11 | ; 12 | 13 | 14 | lambda 0.6 ; microns/lambda 15 | 16 | capda .000090 ; n-diffusion capacitance -- area, pf/sq-micron 17 | capdp .000125 ; n-diffusion capacitance -- perimeter, pf/micron 18 | cappda .000280 ; p-diffusion capacitance -- area, pf/sq-micron 19 | cappdp .000125 ; p-diffusion capacitance -- perimeter, pf/micron 20 | capga .0015 ; gate capacitance -- area, pf/sq-micron 21 | 22 | 23 | lowthresh 0.4 ; 24 | highthresh 0.6 ; 25 | 26 | cntpullup 0 ; irelevant (no depletion devices) 27 | subparea 0 ; count poly over diff as bulk poly cap. 28 | diffperim 0 ; include diff. perims that border on xtror gates 29 | diffext 0 ; dont put default cap. 30 | 31 | ; Supply 5.0 32 | ; C=500.00fF, P(w=10.00, l=1.20), N(w=3.00, l=1.20) 33 | resistance n-channel dynamic-high 3.0 1.20 8744.0 34 | resistance n-channel dynamic-low 3.0 1.20 4256.0 35 | resistance n-channel static 3.0 1.20 4211.1 36 | 37 | resistance p-channel dynamic-high 10.0 1.20 3066.0 38 | resistance p-channel dynamic-low 10.0 1.20 6922.0 39 | resistance p-channel static 10.0 1.20 2986.0 40 | ; C=500.00fF, P(w=30.00, l=1.20), N(w=15.00, l=1.20) 41 | resistance n-channel dynamic-high 15.0 1.20 1432.2 42 | resistance n-channel dynamic-low 15.0 1.20 910.2 43 | resistance n-channel static 15.0 1.20 513.4 44 | 45 | resistance p-channel dynamic-high 30.0 1.20 1194.8 46 | resistance p-channel dynamic-low 30.0 1.20 2244.0 47 | resistance p-channel static 30.0 1.20 602.2 48 | ; C=500.00fF, P(w=30.00, l=1.80), N(w=15.00, l=1.80) 49 | resistance n-channel dynamic-high 15.0 1.80 2178.0 50 | resistance n-channel dynamic-low 15.0 1.80 1163.6 51 | resistance n-channel static 15.0 1.80 901.9 52 | 53 | resistance p-channel dynamic-high 30.0 1.80 1821.8 54 | resistance p-channel dynamic-low 30.0 1.80 3744.0 55 | resistance p-channel static 30.0 1.80 823.0 56 | ; C=500.00fF, P(w=30.00, l=2.40), N(w=15.00, l=2.40) 57 | resistance n-channel dynamic-high 15.0 2.40 3080.0 58 | resistance n-channel dynamic-low 15.0 2.40 1557.2 59 | resistance n-channel static 15.0 2.40 1301.2 60 | 61 | resistance p-channel dynamic-high 30.0 2.40 2600.0 62 | resistance p-channel dynamic-low 30.0 2.40 5424.0 63 | resistance p-channel static 30.0 2.40 904.3 64 | 65 | -------------------------------------------------------------------------------- /lib/prm/tsmc18.10.nxxx.1.8.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 1 0.2 2534.80 2 | resistance p-channel dynamic-high 6.9 0.2 899.15 3 | resistance n-channel static 1 0.2 3415.50 4 | resistance p-channel static 6.9 0.2 1154.06 5 | resistance n-channel dynamic-high 1 0.2 7651.60 6 | resistance p-channel dynamic-low 6.9 0.2 3322.10 7 | -------------------------------------------------------------------------------- /lib/prm/tsmc25.15.n99y.2.5.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 1.5 0.3 1623.10 2 | resistance p-channel dynamic-high 5.55 0.3 1276.00 3 | resistance n-channel static 1.5 0.3 2020.45 4 | resistance p-channel static 5.55 0.3 1654.71 5 | resistance n-channel dynamic-high 1.5 0.3 3561.30 6 | resistance p-channel dynamic-low 5.55 0.3 3875.80 7 | -------------------------------------------------------------------------------- /lib/prm/tsmc35.20.n98t.3.3.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 2 0.4 1844.70 2 | resistance p-channel dynamic-high 6.2 0.4 1489.10 3 | resistance n-channel static 2 0.4 2203.94 4 | resistance p-channel static 6.2 0.4 1693.37 5 | resistance n-channel dynamic-high 2 0.4 3971.50 6 | resistance p-channel dynamic-low 6.2 0.4 3337.70 7 | -------------------------------------------------------------------------------- /lib/prm/tsmc35p.20.n98tp.3.3.prm: -------------------------------------------------------------------------------- 1 | resistance n-channel dynamic-low 2 0.4 1918.00 2 | resistance p-channel dynamic-high 7.8 0.4 1392.40 3 | resistance n-channel static 2 0.4 2338.46 4 | resistance p-channel static 7.8 0.4 1845.48 5 | resistance n-channel dynamic-high 2 0.4 4155.00 6 | resistance p-channel dynamic-low 7.8 0.4 3626.80 7 | -------------------------------------------------------------------------------- /lib/test/foo.sim: -------------------------------------------------------------------------------- 1 | | 2 | 3 | C xx Gnd 2 4 | C o Gnd 2 5 | -------------------------------------------------------------------------------- /lib/test/z.test/control.ps: -------------------------------------------------------------------------------- 1 | %! 2 | /MSAVE { /mStat save def } def 3 | /MRESTORE { mStat restore } def 4 | /SET { exch def } def 5 | /SF { /wi SET theFont [wi 0 0 FSIZE 0 0] makefont setfont } def 6 | /L { newpath moveto lineto stroke } def 7 | /VL { 2 index exch L } def 8 | /HL { 1 index L } def 9 | /BOX { /@yb SET /@xb SET /@yt SET /@xt SET newpath 10 | @xb @yb moveto @xb @yt lineto @xt @yt lineto @xt @yb lineto closepath } def 11 | /SL { moveto show } def 12 | /SR { exch dup /@xr SET 2 index stringwidth pop sub dup 13 | 0 le { pop 0 @xr 3 -1 roll SC } { exch FSIZE 2 div sub moveto show } 14 | ifelse } def 15 | /SCP { /@s SET @s stringwidth pop /@sw SET @sw 2 div sub 16 | dup @sw add maxX gt { pop maxX @sw sub } if exch moveto @s show } def 17 | /SC { FSIZE 2 div sub /@y SET /@x2 SET /@x1 SET /@s SET 18 | /@l @x2 @x1 sub def /@x @x1 @x2 add 2 div def 19 | /@w @s stringwidth pop def @l @w gt 20 | { @y @x @s SCP } 21 | { @l FSIZE mul @w 1 add div dup MINFSIZE lt 22 | { pop } { /svf currentfont def SF @y @x @s SCP svf setfont } ifelse }ifelse 23 | } def 24 | /LE { exch GX GY FSIZE 2 div add SR /@x GX def 25 | { dup stringwidth pop /@w SET /@x @x FSIZE add def @x @w add 26 | 720 ge { /@x GX FSIZE add def /GY GY FSIZE 2 add sub def } if 27 | @x GY SL /@x @x @w add def } repeat /GY GY FSIZE 4 add sub def } def 28 | /FSIZE 9 def /MINFSIZE 4 def /maxX 718 def 29 | 612 0 translate 30 | 90 rotate 31 | 36 8 translate 32 | 1 setlinecap 0.6 setlinewidth 33 | /theFont /Helvetica findfont def FSIZE SF 34 | MSAVE 35 | 0.82 setgray 36 | 0 553 720 568 BOX fill 37 | 0 setgray 38 | 0 553 720 568 BOX stroke 39 | (control)6 561 FSIZE 2 div sub SL 40 | (Wed Apr 16 17:29:31 1997 41 | ) 715 561 SR 42 | 0 28 720 568 BOX stroke 43 | 0 setlinewidth [1 3] 0 setdash /svfnt currentfont def 44 | theFont 0.7 FSIZE mul scalefont setfont 45 | (time \(ns\)) 0 44 48 SC 46 | 45 551 43 VL 47 | 60 551 43 VL 48 | (690.00) 0 120 38 SC 49 | 144 551 43 VL 50 | (695.00) 0 288 38 SC 51 | 228 551 43 VL 52 | (700.00) 0 456 38 SC 53 | 312 551 43 VL 54 | (705.00) 0 624 38 SC 55 | 396 551 43 VL 56 | (710.00) 0 792 38 SC 57 | 480 551 43 VL 58 | (715.00) 0 960 38 SC 59 | 564 551 43 VL 60 | (720.00) 0 1128 38 SC 61 | 647 551 43 VL 62 | (725.00) 0 1294 38 SC 63 | 717 551 43 VL 64 | (729.10) 717 38 SR 65 | 43 48 718 HL 66 | 0.6 setlinewidth [] 0 setdash svfnt setfont 67 | (clkc)43 535 SR 68 | (clkc_b)43 508 SR 69 | (reset)43 480 SR 70 | (upc)43 453 SR 71 | (dnc)43 426 SR 72 | (upe)43 399 SR 73 | (dne)43 371 SR 74 | (evenearly)43 344 SR 75 | (ictl)43 312 SR 76 | (selE)43 275 SR 77 | (inve)43 241 SR 78 | (selO)43 210 SR 79 | (invo)43 176 SR 80 | (uppd)43 149 SR 81 | (upi)43 122 SR 82 | (oflow)43 95 SR 83 | (uflow)43 68 SR 84 | 45 524 45 HL 85 | 45 524 545 VL 86 | 45 545 113 HL 87 | 113 524 545 VL 88 | 113 524 179 HL 89 | 179 524 545 VL 90 | 179 545 247 HL 91 | 247 524 545 VL 92 | 247 524 313 HL 93 | 313 524 545 VL 94 | 313 545 381 HL 95 | 381 524 545 VL 96 | 381 524 447 HL 97 | 45 518 45 HL 98 | 45 497 518 VL 99 | 45 497 113 HL 100 | 113 497 518 VL 101 | 113 518 179 HL 102 | 179 497 518 VL 103 | 179 497 247 HL 104 | 247 497 518 VL 105 | 247 518 313 HL 106 | 313 497 518 VL 107 | 313 497 381 HL 108 | 381 497 518 VL 109 | 381 518 447 HL 110 | 45 470 447 HL 111 | 45 443 193 HL 112 | 193 443 464 VL 113 | 193 464 326 HL 114 | 326 443 464 VL 115 | 326 443 447 HL 116 | 45 415 447 HL 117 | 45 388 447 HL 118 | 45 361 447 HL 119 | 45 355 447 HL 120 | 47 328 318 HL 121 | 47 296 318 HL 122 | 319 299 325 VL 123 | 318 328 319 325 L 124 | 318 296 319 299 L 125 | 319 325 321 328 L 126 | 319 299 321 296 L 127 | (ffc0)45 319 312 SC 128 | 321 328 447 HL 129 | 321 296 447 HL 130 | (ffe0)319 447 312 SC 131 | 47 290 447 HL 132 | 47 258 447 HL 133 | (100)45 447 275 SC 134 | 45 231 447 HL 135 | 47 225 447 HL 136 | 47 193 447 HL 137 | (100)45 447 210 SC 138 | 45 166 447 HL 139 | 45 160 447 HL 140 | 45 133 447 HL 141 | 45 84 447 HL 142 | 45 57 447 HL 143 | showpage MRESTORE 144 | -------------------------------------------------------------------------------- /lib/test/z.test/foo.c: -------------------------------------------------------------------------------- 1 | 2 | #ifdef _ansii 3 | sadksdklj skljsdjkl 4 | #endif 5 | -------------------------------------------------------------------------------- /lib/test/z.test/foo.ps: -------------------------------------------------------------------------------- 1 | %! 2 | /MSAVE { /mStat save def } def 3 | /MRESTORE { mStat restore } def 4 | /SET { exch def } def 5 | /SF { /wi SET theFont [wi 0 0 FSIZE 0 0] makefont setfont } def 6 | /L { newpath moveto lineto stroke } def 7 | /VL { 2 index exch L } def 8 | /HL { 1 index L } def 9 | /BOX { /@yb SET /@xb SET /@yt SET /@xt SET newpath 10 | @xb @yb moveto @xb @yt lineto @xt @yt lineto @xt @yb lineto closepath } def 11 | /SL { moveto show } def 12 | /SR { exch dup /@xr SET 2 index stringwidth pop sub dup 13 | 0 le { pop 0 @xr 3 -1 roll SC } { exch FSIZE 2 div sub moveto show } 14 | ifelse } def 15 | /SCP { /@s SET @s stringwidth pop /@sw SET @sw 2 div sub 16 | dup @sw add maxX gt { pop maxX @sw sub } if exch moveto @s show } def 17 | /SC { FSIZE 2 div sub /@y SET /@x2 SET /@x1 SET /@s SET 18 | /@l @x2 @x1 sub def /@x @x1 @x2 add 2 div def 19 | /@w @s stringwidth pop def @l @w gt 20 | { @y @x @s SCP } 21 | { @l FSIZE mul @w 1 add div dup MINFSIZE lt 22 | { pop } { /svf currentfont def SF @y @x @s SCP svf setfont } ifelse }ifelse 23 | } def 24 | /LE { exch GX GY FSIZE 2 div add SR /@x GX def 25 | { dup stringwidth pop /@w SET /@x @x FSIZE add def @x @w add 26 | 720 ge { /@x GX FSIZE add def /GY GY FSIZE 2 add sub def } if 27 | @x GY SL /@x @x @w add def } repeat /GY GY FSIZE 4 add sub def } def 28 | /FSIZE 9 def /MINFSIZE 4 def /maxX 718 def 29 | 612 0 translate 30 | 90 rotate 31 | 36 8 translate 32 | 1 setlinecap 0.6 setlinewidth 33 | /theFont /Helvetica findfont def FSIZE SF 34 | MSAVE 35 | 0.82 setgray 36 | 0 553 720 568 BOX OP 37 | 0 setgray 38 | 0 553 720 568 BOX OP 39 | (control)6 561 FSIZE 2 div sub SL 40 | (Wed Apr 16 17:07:12 1997 41 | ) 715 561 SR 42 | 0 28 720 568 BOX OP 43 | 0 setlinewidth [1 3] 0 setdash /svfnt currentfont def 44 | theFont 0.7 FSIZE mul scalefont setfont 45 | (time \(ns\)) 0 44 48 SC 46 | 45 551 43 VL 47 | (0.00) 0 90 38 SC 48 | 129 551 43 VL 49 | (5.00) 0 258 38 SC 50 | 213 551 43 VL 51 | (10.00) 0 426 38 SC 52 | 297 551 43 VL 53 | (15.00) 0 594 38 SC 54 | 381 551 43 VL 55 | (20.00) 0 762 38 SC 56 | 465 551 43 VL 57 | (25.00) 0 930 38 SC 58 | 548 551 43 VL 59 | (30.00) 0 1096 38 SC 60 | 633 551 43 VL 61 | (35.00) 0 1266 38 SC 62 | 717 551 43 VL 63 | (40.00) 0 1434 38 SC 64 | 43 48 718 HL 65 | 0.6 setlinewidth [] 0 setdash svfnt setfont 66 | (clkc)43 535 SR 67 | (clkc_b)43 508 SR 68 | (reset)43 480 SR 69 | (upc)43 453 SR 70 | (dnc)43 426 SR 71 | (upe)43 399 SR 72 | (dne)43 371 SR 73 | (evenearly)43 344 SR 74 | (ictl)43 312 SR 75 | (selE)43 275 SR 76 | (inve)43 241 SR 77 | (selO)43 210 SR 78 | (invo)43 176 SR 79 | (uppd)43 149 SR 80 | (upi)43 122 SR 81 | (oflow)43 95 SR 82 | (uflow)43 68 SR 83 | 0.68 setgray 84 | 45 545 213 524 BOX fill 85 | 0 setgray 86 | 0.68 setgray 87 | 45 518 213 497 BOX fill 88 | 0 setgray 89 | 0.68 setgray 90 | 45 491 213 470 BOX fill 91 | 0 setgray 92 | 0.68 setgray 93 | 45 464 213 443 BOX fill 94 | 0 setgray 95 | 0.68 setgray 96 | 45 436 213 415 BOX fill 97 | 0 setgray 98 | 0.68 setgray 99 | 45 409 213 388 BOX fill 100 | 0 setgray 101 | 0.68 setgray 102 | 45 382 213 361 BOX fill 103 | 0 setgray 104 | 0.68 setgray 105 | 45 355 213 334 BOX fill 106 | 0 setgray 107 | 47 328 213 HL 108 | 47 296 213 HL 109 | (XXXX)45 213 312 SC 110 | 47 290 213 HL 111 | 47 258 213 HL 112 | (XXX)45 213 275 SC 113 | 0.68 setgray 114 | 45 252 213 231 BOX fill 115 | 0 setgray 116 | 47 225 213 HL 117 | 47 193 213 HL 118 | (XXX)45 213 210 SC 119 | 0.68 setgray 120 | 45 187 213 166 BOX fill 121 | 0 setgray 122 | 0.68 setgray 123 | 45 160 213 139 BOX fill 124 | 0 setgray 125 | 0.68 setgray 126 | 45 133 213 111 BOX fill 127 | 0 setgray 128 | 0.68 setgray 129 | 45 105 213 84 BOX fill 130 | 0 setgray 131 | 0.68 setgray 132 | 45 78 213 57 BOX fill 133 | 0 setgray 134 | showpage MRESTORE 135 | -------------------------------------------------------------------------------- /other/README: -------------------------------------------------------------------------------- 1 | This directory contains programs for converting the binary files generated 2 | by irsim into ascii. 3 | 4 | h2a Converts a history dump file into ascii. 5 | 6 | inet2sim Converts an .inet file into a .sim file 7 | 8 | -------------------------------------------------------------------------------- /other/h2a/Makefile: -------------------------------------------------------------------------------- 1 | OSRCS = access.c binsim.c cad_dir.c config.c fio.c hist_io.c mem.c \ 2 | prints.c sim.c tpos.c 3 | 4 | LSRCS = h2a.c Hist.c Nsubrs.c sort.c 5 | 6 | SRCS = $(LSRCS) $(OSRCS) 7 | 8 | OBJS = access.o binsim.o cad_dir.o config.o fio.o h2a.o Hist.o hist_io.o \ 9 | Nsubrs.o mem.o prints.o sim.o sort.o tpos.o 10 | 11 | CC = cc 12 | MAKEDEP = ../../utils/makedep 13 | EXPORT = ../../utils/export 14 | 15 | # sources included in the above SRCS 16 | ISRCS = nsubrs.c 17 | 18 | CDIRS = -I../../include 19 | LIBS = 20 | 21 | OPTIM = -O 22 | DBX = -g 23 | 24 | CSW = $(OPTIM) 25 | #CSW = $(DBX) 26 | 27 | EXPORTS = globals.h 28 | 29 | h2a : MAKEFILE $(EXPORTS) $(SRCS) 30 | make -f MAKEFILE CSW="$(CSW)" h2a 31 | 32 | $(EXPORTS) : $(SRCS) $(ISRCS) 33 | $(EXPORT) $(SRCS) $(ISRCS) globals.h 34 | 35 | $(OSRCS) $(ISRCS) : 36 | ln -s ../../irsim/$@ . 37 | 38 | $(LSRCS) : 39 | co $@ 40 | 41 | MAKEFILE : Makefile $(SRCS) $(ISRCS) 42 | @echo making MAKEFILE 43 | @echo SRCS = $(SRCS) > MAKEFILE 44 | @echo OBJS = $(OBJS) >> MAKEFILE 45 | @echo HDSR = $(HDRS) >> MAKEFILE 46 | @echo CSW = $(CSW) >> MAKEFILE 47 | @echo CDIRS = $(CDIRS) >> MAKEFILE 48 | @echo LIBS = $(LIBS) >> MAKEFILE 49 | @echo CFLAGS = '$$(CDIRS) $$(CSW) -DCAP_ADJUST_LIMIT=1e8' >> MAKEFILE 50 | @echo 'h2a : $$(OBJS)' >> MAKEFILE 51 | @echo ' cc $$(CFLAGS) -o h2a $$(OBJS) $(LIBS)' >> MAKEFILE 52 | @echo '$(OSRCS) $(ISRCS): ' >> MAKEFILE 53 | @echo ' ln -s ../../irsim/$$@ .' >> MAKEFILE 54 | @echo '$(LSRCS) : ' >> MAKEFILE 55 | @echo ' co $$@' >> MAKEFILE 56 | @/bin/csh ../../utils/CO $(LSRCS) 57 | @$(MAKEDEP) -I ../../include -N -o - $(SRCS) >> MAKEFILE 58 | 59 | clean : 60 | rm -f MAKEFILE $(EXPORTS) $(OSRCS) $(ISRCS) $(OBJS) 61 | -------------------------------------------------------------------------------- /other/h2a/Nsubrs.c: -------------------------------------------------------------------------------- 1 | #define Index2node INDEX2NODE 2 | 3 | #include "nsubrs.c" 4 | 5 | #undef Index2node 6 | 7 | nptr Index2node( index ) 8 | Ulong index; 9 | { 10 | nptr n = INDEX2NODE( index ); 11 | if( n == NULL ) 12 | { 13 | static nptr node = NULL; 14 | static char buff[30]; 15 | register Uint ma, mi; 16 | 17 | ma = index & ((1 << NBIT_HASH) - 1); 18 | mi = index >> NBIT_HASH; 19 | 20 | (void) sprintf( buff, "<%d,%d>", ma, mi ); 21 | 22 | if( node == NULL ) 23 | node = GetNewNode( "?" ); 24 | if( do_sort ) 25 | { 26 | node->nname = Valloc( strlen( buff ) + 1, 1 ); 27 | (void) strcpy( node->nname, buff ); 28 | } 29 | else 30 | node->nname = buff; 31 | n = node; 32 | } 33 | return( n ); 34 | } 35 | -------------------------------------------------------------------------------- /other/h2a/h2a.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "defs.h" 3 | #include "net.h" 4 | #include "globals.h" 5 | 6 | 7 | public int do_delay = FALSE; 8 | public int do_rtime = FALSE; 9 | public int do_punts = TRUE; 10 | public int do_names = FALSE; /* node name on every line */ 11 | public int do_sort = FALSE; 12 | public char *only_name = NULL; 13 | 14 | /* stuff needed by irsim modules (not used by this program) */ 15 | public long sim_time0 = 0; 16 | public iptr o_hinputs, o_linputs, o_uinputs; 17 | public nptr cur_node = NULL; 18 | public long cur_delta = 0; 19 | public FILE *logfile = NULL; 20 | public int stack_txtors = 0; 21 | public 22 | #define compute_trans_state( X ) ( 0 ) 23 | 24 | public void NoInit() {} 25 | public double StackCap( t ) tptr t; { return 0; } 26 | public void free_event( e ) evptr e; {} 27 | public void ClearInputs() {} 28 | public void iinsert( n, list ) nptr n; iptr list; {} 29 | public void init_listTbl() {} 30 | public void make_parallel( n, f ) nptr n; long f; {} 31 | public void pParallelTxtors() {} 32 | public void make_stacks( n ) nptr n; {} 33 | public void pStackedTxtors() {} 34 | 35 | 36 | private char *sim_file = NULL; 37 | private char *hist_file = NULL; 38 | 39 | 40 | main( argc, argv ) 41 | int argc; 42 | char *argv[]; 43 | { 44 | int i; 45 | char *s; 46 | 47 | for( i = 1; i < argc; i++ ) 48 | { 49 | if( argv[i][0] != '-' ) 50 | { 51 | hist_file = argv[i]; 52 | if( i + 1 != argc ) 53 | Usage( "Arguments follow hist_file: %s...\n", argv[i+1] ); 54 | break; 55 | } 56 | if( argv[i][1] == '\0' ) 57 | Usage( "No switch specified\n", 0 ); 58 | 59 | for( s = &(argv[i][1]); *s != '\0'; s++ ) 60 | { 61 | switch( *s ) 62 | { 63 | case 't' : do_sort = TRUE; break; 64 | case 'n' : do_names = TRUE; break; 65 | case 'P' : do_punts = FALSE; break; 66 | case 'r' : do_rtime = TRUE; break; 67 | case 'd' : do_delay = TRUE; break; 68 | case 'a' : do_rtime = do_delay = do_punts = TRUE; break; 69 | case 's' : 70 | s = "\0"; 71 | sim_file = argv[++i]; 72 | if( i >= argc ) 73 | Usage( "no filename following '-s'\n", 0 ); 74 | break; 75 | case 'N' : 76 | s = "\0"; 77 | only_name = argv[++i]; 78 | if( i >= argc ) 79 | Usage( "no nodename following '-N'\n", 0 ); 80 | break; 81 | default: 82 | s[1] = '\0'; 83 | Usage( "Unknown switch: '%s'\n", s ); 84 | } 85 | } 86 | } 87 | 88 | if( hist_file == NULL ) 89 | Usage( "missing history file\n", 0 ); 90 | 91 | init_hist(); 92 | 93 | if( sim_file ) 94 | rd_network( sim_file ); 95 | 96 | printf( " time val" ); 97 | if( do_delay ) 98 | printf( " delay" ); 99 | if( do_rtime ) 100 | printf( " r/f" ); 101 | printf( "\n" ); 102 | 103 | ReadHist( hist_file ); 104 | 105 | if( do_sort ) 106 | sortAndPrint(); 107 | 108 | exit( 0 ); 109 | } 110 | 111 | 112 | #define PRINT (void) fprintf 113 | 114 | private Usage( s1, s2 ) 115 | char *s1; 116 | char *s2; 117 | { 118 | PRINT( stderr, s1, s2 ); 119 | PRINT( stderr, "h2a [-ntPrda] [-s sim_file] [-N node] hist_file\n" ); 120 | PRINT( stderr, "\t-n\t\tprint node name on every line\n" ); 121 | PRINT( stderr, "\t-t\t\tsort entire history by time\n" ); 122 | PRINT( stderr, "\t-P\t\tdo NOT print punted events\n" ); 123 | PRINT( stderr, "\t-r\t\tprint rise/fall times\n" ); 124 | PRINT( stderr, "\t-d\t\tprint delay times\n" ); 125 | PRINT( stderr, "\t-a\t\tprint everything (-r -d and NOT -P)\n" ); 126 | PRINT( stderr, "\t-N node\t\tprint only history for node\n" ); 127 | PRINT( stderr, "\t-s net\tread symbols from net (sim or inet) file\n" ); 128 | exit( 1 ); 129 | } 130 | -------------------------------------------------------------------------------- /other/h2a/history.h: -------------------------------------------------------------------------------- 1 | typedef struct History *phist; 2 | 3 | typedef struct History 4 | { 5 | phist next; 6 | long time; 7 | char *name; 8 | short delay; 9 | short rtime; 10 | short ptime; 11 | char val; 12 | char type; 13 | } History; 14 | 15 | 16 | #define H_FIRST 0 17 | #define H_FIRST_INP 1 18 | #define H_NORM 2 19 | #define H_NORM_INP 3 20 | #define H_PUNT 4 21 | #define H_PEND 5 22 | 23 | -------------------------------------------------------------------------------- /other/h2a/sort.c: -------------------------------------------------------------------------------- 1 | #include "history.h" 2 | 3 | 4 | #define BIT8 0xff 5 | #define BIT12 0xfff 6 | #define BIT24 0xffffff 7 | 8 | #define CNTSIZE ( 4096 + 4096 + 256 ) 9 | #define COUNT1 &countBuff[ 0 ] 10 | #define COUNT2 &countBuff[ 4096 ] 11 | #define COUNT3 &countBuff[ 4096 + 4096 ] 12 | #define ENDCNT &countBuff[ CNTSIZE ] 13 | 14 | 15 | static int *countBuff; 16 | static phist *data_; 17 | static phist *dataBuff; 18 | static phist *dataBuff1; 19 | 20 | 21 | /* 22 | * Sort the edge array pointed to by 'lineBuff'. Return a pointer to a 23 | * sorted array of pointers into the original data. 24 | */ 25 | phist *Sort( nlines, lineBuff, maxv ) 26 | int nlines; 27 | phist *lineBuff; 28 | long maxv; 29 | { 30 | phist *tmp; 31 | 32 | data_ = lineBuff; 33 | dataBuff = tmp = (phist *) malloc( sizeof( phist ) * nlines ); 34 | countBuff = (int *) malloc( sizeof( int ) * CNTSIZE ); 35 | dataBuff1 = (phist *) malloc( sizeof( phist ) * nlines ); 36 | BucketSort( nlines, maxv ); 37 | if( dataBuff != tmp ) /* swapped by sort */ 38 | { 39 | register phist *src, *dst, *end; 40 | 41 | dataBuff1 = dataBuff; 42 | dataBuff = tmp; 43 | src = dataBuff1; 44 | dst = dataBuff; 45 | end = &dataBuff1[ nlines ]; 46 | do { *dst++ = *src++; } while( src < end ); 47 | } 48 | return( dataBuff ); 49 | } 50 | 51 | 52 | static BucketSort( nlines, maxv ) 53 | int nlines; 54 | long maxv; 55 | { 56 | { 57 | register int *cp, *end; 58 | 59 | cp = COUNT1; 60 | end = ENDCNT; 61 | do { *cp++ = 0; } while( cp < end ); 62 | } 63 | 64 | { 65 | register phist *dat, *end; 66 | register int *count1, *count2, *count3; 67 | 68 | count1 = COUNT1; 69 | count2 = COUNT2; 70 | count3 = COUNT3; 71 | dat = data_; 72 | end = &data_[ nlines ]; 73 | 74 | if( maxv <= BIT12 ) 75 | { 76 | do 77 | { 78 | count1[ (*dat)->time & BIT12 ]++; 79 | dat++; 80 | } 81 | while( dat < end ); 82 | } 83 | else if( maxv <= BIT24 ) 84 | { 85 | do 86 | { 87 | count1[ (*dat)->time & BIT12 ]++; 88 | count2[ ( (*dat)->time >> 12 ) & BIT12 ]++; 89 | dat++; 90 | } 91 | while( dat < end ); 92 | } 93 | else 94 | { 95 | do 96 | { 97 | count1[ (*dat)->time & BIT12 ]++; 98 | count2[ ( (*dat)->time >> 12 ) & BIT12 ]++; 99 | count3[ ( (*dat)->time >> 24 ) & BIT8 ]++; 100 | dat++; 101 | } 102 | while( dat < end ); 103 | } 104 | } 105 | 106 | { 107 | register int *cp, *cp_1; 108 | register int *cp2, *cp2_1; 109 | register int *end; 110 | cp = COUNT1; 111 | cp_1 = &cp[1]; 112 | cp2 = COUNT2; 113 | cp2_1 = &cp2[1]; 114 | end = COUNT2; 115 | do 116 | { 117 | *cp_1++ += *cp++; 118 | *cp2_1++ += *cp2++; 119 | } 120 | while( cp_1 < end ); 121 | 122 | cp = COUNT3; 123 | cp_1 = &cp[1]; 124 | end = ENDCNT; 125 | do { *cp_1++ += *cp++; } while( cp_1 < end ); 126 | } 127 | 128 | { 129 | register int tmp; 130 | register int *count; 131 | register phist *dat; 132 | register phist *datPtr, *end; 133 | 134 | dat = &data_[ nlines-1 ]; 135 | count = COUNT1; 136 | datPtr = dataBuff; 137 | do 138 | { 139 | tmp = --count[ (*dat)->time & BIT12 ]; 140 | datPtr[ tmp ] = (*dat); 141 | dat--; 142 | } 143 | while( dat >= data_ ); 144 | 145 | if( maxv <= BIT12 ) 146 | goto done; 147 | 148 | datPtr = &dataBuff[ nlines-1 ]; 149 | end = dataBuff; 150 | count = COUNT2; 151 | do 152 | { 153 | tmp = -- count[ ((*datPtr)->time >> 12) & BIT12 ]; 154 | dataBuff1[ tmp ] = *datPtr; 155 | datPtr--; 156 | } 157 | while( datPtr >= end ); 158 | 159 | if( maxv <= BIT24 ) 160 | { 161 | datPtr = dataBuff1; 162 | dataBuff1 = dataBuff; 163 | dataBuff = datPtr; 164 | goto done; 165 | } 166 | 167 | datPtr = &dataBuff1[ nlines-1 ]; 168 | end = dataBuff1; 169 | count = COUNT3; 170 | do 171 | { 172 | tmp = -- count[ ((*datPtr)->time >> 24) & BIT8 ]; 173 | dataBuff[ tmp ] = *datPtr; 174 | datPtr--; 175 | } 176 | while( datPtr >= end ); 177 | 178 | } 179 | 180 | done : ; 181 | } 182 | -------------------------------------------------------------------------------- /other/inet2sim/Binsim.c: -------------------------------------------------------------------------------- 1 | #include "binsim.c" 2 | 3 | public void GetInetParms( tlist, lambda ) 4 | tptr *tlist; 5 | long *lambda; 6 | { 7 | *tlist = rd_tlist; 8 | *lambda = inet_lambda; 9 | } 10 | -------------------------------------------------------------------------------- /other/inet2sim/Hist.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "defs.h" 3 | #include "net.h" 4 | #include "globals.h" 5 | 6 | 7 | public hptr last_hist; /* pointer to dummy hist-entry that 8 | * serves as tail for all nodes */ 9 | public Ulong max_time; 10 | 11 | 12 | public void init_hist() 13 | { 14 | static HistEnt dummy; 15 | static HistEnt dummy_model; 16 | 17 | max_time = MAX_TIME; 18 | 19 | last_hist = &dummy; 20 | dummy.next = last_hist; 21 | dummy.time = max_time; 22 | dummy.val = X; 23 | dummy.inp = 1; 24 | dummy.punt = 0; 25 | dummy.t.r.delay = dummy.t.r.rtime = 0; 26 | 27 | #ifdef notdef 28 | dummy_model.time = 0; 29 | dummy_model.val = model; 30 | dummy_model.inp = 0; 31 | dummy_model.punt = 0; 32 | dummy_model.next = NULL; 33 | first_model = curr_model = &dummy_model; 34 | #endif 35 | } 36 | -------------------------------------------------------------------------------- /other/inet2sim/Makefile: -------------------------------------------------------------------------------- 1 | OSRCS = access.c cad_dir.c config.c fio.c nsubrs.c mem.c prints.c tpos.c 2 | 3 | LSRCS = Binsim.c Hist.c Sim.c inet2sim.c 4 | 5 | SRCS = $(LSRCS) $(OSRCS) 6 | 7 | OBJS = access.o Binsim.o cad_dir.o config.o fio.o Hist.o inet2sim.o \ 8 | nsubrs.o mem.o prints.o Sim.o tpos.o 9 | 10 | CC = cc 11 | MAKEDEP = ../../utils/makedep 12 | EXPORT = ../../utils/export 13 | 14 | # sources included in the above SRCS 15 | ISRCS = binsim.c 16 | 17 | CDIRS = -I../../include 18 | LIBS = 19 | 20 | OPTIM = -O 21 | DBX = -g 22 | 23 | CSW = $(OPTIM) 24 | #CSW = $(DBX) 25 | 26 | 27 | EXPORTS = globals.h 28 | 29 | inet2sim : MAKEFILE $(EXPORTS) $(SRCS) $(ISRCS) 30 | make -f MAKEFILE CSW="$(CSW)" inet2sim 31 | 32 | $(EXPORTS) : $(SRCS) $(ISRCS) 33 | $(EXPORT) $(SRCS) $(ISRCS) globals.h 34 | 35 | $(OSRCS) $(ISRCS) : 36 | ln -s ../../irsim/$@ . 37 | 38 | $(LSRCS) : 39 | co $@ 40 | 41 | MAKEFILE : Makefile $(SRCS) $(ISRCS) 42 | @echo making MAKEFILE 43 | @echo SRCS = $(SRCS) > MAKEFILE 44 | @echo OBJS = $(OBJS) >> MAKEFILE 45 | @echo HDSR = $(HDRS) >> MAKEFILE 46 | @echo CSW = $(CSW) >> MAKEFILE 47 | @echo CDIRS = $(CDIRS) >> MAKEFILE 48 | @echo LIBS = $(LIBS) >> MAKEFILE 49 | @echo CFLAGS = '$$(CDIRS) $$(CSW)' >> MAKEFILE 50 | @echo 'inet2sim : $$(OBJS)' >> MAKEFILE 51 | @echo ' cc $$(CFLAGS) -o inet2sim $$(OBJS) $(LIBS)' >> MAKEFILE 52 | @echo '$(OSRCS) $(ISRCS): ' >> MAKEFILE 53 | @echo ' ln -s ../../irsim/$$@ .' >> MAKEFILE 54 | @echo '$(LSRCS) : ' >> MAKEFILE 55 | @echo ' co $$@' >> MAKEFILE 56 | @/bin/csh ../../utils/CO $(LSRCS) 57 | @$(MAKEDEP) -I ../../include -N -o - $(SRCS) >> MAKEFILE 58 | 59 | lint : 60 | lint -abhx $(CDIRS) $(SRCS) > inet2sim.lint 61 | 62 | clean : 63 | rm -f MAKEFILE $(EXPORTS) $(OSRCS) $(ISRCS) $(OBJS) 64 | -------------------------------------------------------------------------------- /other/inet2sim/inet2sim.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "defs.h" 3 | #include "net.h" 4 | #include "globals.h" 5 | 6 | 7 | /* stuff needed by irsim modules (not used by this program) */ 8 | public FILE *logfile = NULL; 9 | public double StackCap( t ) tptr t; { return 0; } 10 | public void init_listTbl() {} 11 | 12 | 13 | public int do_sim_cap = TRUE; 14 | public int two_term_caps = FALSE; 15 | public int do_thresholds = TRUE; 16 | public int do_delays = TRUE; 17 | public int use_GND = FALSE; 18 | private int short_file = FALSE; 19 | 20 | 21 | private char *sim_file = NULL; 22 | private char *inet_file = NULL; 23 | private void sort_node_names(); 24 | 25 | 26 | main( argc, argv ) 27 | int argc; 28 | char *argv[]; 29 | { 30 | FILE *fin, *fout; 31 | int i; 32 | 33 | for( i = 1; i < argc; i++ ) 34 | { 35 | if( argv[i][0] == '-' ) 36 | { 37 | switch( argv[i][1] ) 38 | { 39 | case 'C' : do_sim_cap = FALSE; break; 40 | case '2' : two_term_caps = TRUE; break; 41 | case 'T' : do_thresholds = FALSE; break; 42 | case 'D' : do_delays = FALSE; break; 43 | case 'G' : use_GND = TRUE; break; 44 | case 'c' : short_file = TRUE; break; 45 | case 'o' : 46 | if( ++i < argc ) 47 | sim_file = argv[i]; 48 | else 49 | Usage(); 50 | break; 51 | default : 52 | (void) fprintf( stderr, "Unknown switch %s\n", argv[i] ); 53 | Usage(); 54 | } 55 | } 56 | else 57 | { 58 | inet_file = argv[i]; 59 | } 60 | } 61 | 62 | if( inet_file == NULL ) 63 | Usage(); 64 | 65 | CTGA = CTDE = CTDW = 0.0; 66 | LAMBDACM = 0; 67 | 68 | init_hist(); 69 | if( (fin = fopen( inet_file, "r" )) == NULL ) 70 | { 71 | lprintf( stderr, "cannot open '%s' for inet input\n", inet_file ); 72 | exit( 1 ); 73 | } 74 | if( sim_file == NULL ) 75 | fout = stdout; 76 | else if( (fout = fopen( sim_file, "w" )) == NULL ) 77 | { 78 | lprintf( stderr, "cannot open '%s' for sim output\n", sim_file ); 79 | exit( 1 ); 80 | } 81 | 82 | rd_network( fin ); 83 | 84 | (void) fprintf( fout, "| inet2sim: %s\n", inet_file ); 85 | 86 | if( short_file ) sort_node_names( fout ); 87 | 88 | wr_sim( fout ); 89 | 90 | exit( 0 ); 91 | /* NOTREACHED */ 92 | } 93 | 94 | 95 | private void init_tab( n, ptab ) 96 | nptr n; 97 | nptr *ptab; 98 | { 99 | static int i = 0; 100 | 101 | ptab[ i++ ] = n; 102 | } 103 | 104 | private int cmp_nnames( n1, n2 ) 105 | nptr *n1, *n2; 106 | { 107 | return( strcmp( (*n1)->nname, (*n2)->nname ) ); 108 | } 109 | 110 | 111 | private void sort_node_names( fp ) 112 | FILE *fp; 113 | { 114 | nptr *ntable; 115 | int i; 116 | 117 | ntable = (nptr *) Valloc( (nnodes + naliases) * sizeof( nptr ), 1 ); 118 | 119 | walk_net( init_tab, (char *) ntable ); 120 | 121 | qsort( ntable, nnodes + naliases, sizeof( nptr ), cmp_nnames ); 122 | 123 | for( i = 0; i < nnodes + naliases; i++ ) 124 | { 125 | char buff[15]; 126 | register nptr np = ntable[ i ]; 127 | 128 | (void) sprintf( buff, "$%d", i + 1 ); 129 | (void) fprintf( fp, "= %s %s\n", np->nname, buff ); 130 | Vfree( np->nname ); 131 | np->nname = Valloc( strlen( buff ) + 1, 1 ); 132 | (void) strcpy( np->nname, buff ); 133 | } 134 | Vfree( ntable ); 135 | } 136 | 137 | 138 | #define PRINT (void) fprintf 139 | 140 | private Usage() 141 | { 142 | char *prog = "inet2sim"; 143 | 144 | PRINT( stderr, "usage: %s [-C][-2][-t][-D][-G][-c][-o file] inetfile\n", 145 | prog ); 146 | PRINT( stderr, " -C\tdo NOT generate node capacitance statements\n" ); 147 | PRINT( stderr, " -2\tUse 2 terminal capacitance format (ala magic)\n" ); 148 | PRINT( stderr, " -T\tdo NOT generate node thresholds statements\n" ); 149 | PRINT( stderr, " -D\tdo NOT generate node User-Delays statements\n" ); 150 | PRINT( stderr, " -G\tuse GND instead of Gnd\n" ); 151 | PRINT( stderr, " -c\tgenerate a compressed file\n" ); 152 | exit( 1 ); 153 | } 154 | -------------------------------------------------------------------------------- /random/Depend: -------------------------------------------------------------------------------- 1 | random.o: random.c 2 | -------------------------------------------------------------------------------- /random/Makefile: -------------------------------------------------------------------------------- 1 | MODULE = random 2 | IRSIMDIR = .. 3 | SRCS = random.c 4 | 5 | include ${IRSIMDIR}/defs.mak 6 | 7 | EXTRA_LIBS = ${MAIN_EXTRA_LIBS} 8 | 9 | LIBS += -lm ${MAC_EXTRA_LIBS} 10 | CLEANS += random${SHDLIB_EXT} randwrap.o 11 | 12 | main: 13 | 14 | install: 15 | 16 | tcl-main: random${SHDLIB_EXT} 17 | 18 | randwrap.o: random.c 19 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} random.c -c -o randwrap.o 20 | 21 | random${SHDLIB_EXT}: randwrap.o 22 | @echo --- making random Tcl library 23 | ${RM} random${SHDLIB_EXT} 24 | ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o $@ ${LDDL_FLAGS} randwrap.o \ 25 | ${MAC_SHARED} -lc ${LIBS} ${LD_EXTRA_LIBS} 26 | 27 | install-tcl: $(DESTDIR)${INSTALL_TCLDIR}/random${SHDLIB_EXT} 28 | 29 | $(DESTDIR)${INSTALL_TCLDIR}/random${SHDLIB_EXT}: random${SHDLIB_EXT} 30 | ${RM} $(DESTDIR)${INSTALL_TCLDIR}/random${SHDLIB_EXT} 31 | ${CP} random${SHDLIB_EXT} $(DESTDIR)${INSTALL_TCLDIR}/random${SHDLIB_EXT} 32 | 33 | include ${IRSIMDIR}/rules.mak 34 | -------------------------------------------------------------------------------- /random/README: -------------------------------------------------------------------------------- 1 | This directory contains a dynamically loadable tcl extension which 2 | supports random number generation. This extension defines a tcl 3 | command called "random" which returns a random value. The 4 | distribution from which the value is taken is specified by the command 5 | arguments. 6 | 7 | This source is *apparently* freeware; no authorship or copyright has been 8 | declared in the source. 9 | 10 | By default, with no arguments the number is taken uniformly from [0..1) 11 | 12 | "random -reset" will cause the generator to be reseeded using 13 | current pid and current time. 14 | 15 | "random -integer [a [b]]" will cause the number returned to be rounded 16 | down to the largest integer less than or equal to the number which 17 | would otherwise be returned. By default, the number returned is 18 | within the range of a 32-bit signed integer. It is capable of 19 | returning numbers up to 64 bits unsigned. With option "random 20 | -integer a", the number returned will be between (-a) and (+a). 21 | With option "random -integer a b", the number returned will be 22 | between (a) and (b). 23 | 24 | "random -bitstream [n]" will generate a uniform random binary value 25 | of length n. The value returned is in string form, with 26 | effectively unlimited length. By default, the number returned is 27 | a 32-bit value (32-character string). 28 | 29 | "random -normal m s" will cause the number returned to be taken 30 | from a gaussian with mean m and standard deviation s. 31 | 32 | "random -exponential m" will cause the number returned to be taken 33 | from an exponential distribution with mean m. 34 | 35 | "random -uniform low high" will cause the number returned to be 36 | taken from uniform distribution on [a,b). 37 | 38 | "random -chi2 n" will cause the number returned to be 39 | taken from chi2 distribution with n degrees of freedom. 40 | 41 | "random -select n list" will cause n elements to be selected at 42 | random from the list with replacement. 43 | 44 | "random -choose n list" will cause n elements to be selected at 45 | random from the list without replacement. 46 | 47 | "random -permutation n" will return a permutation of 0..n-1 48 | 49 | "random -permute $list" will return a permutation of $list 50 | -------------------------------------------------------------------------------- /rules.mak: -------------------------------------------------------------------------------- 1 | # You shouldn't need to edit this file, see the defs.mak file 2 | 3 | module: lib${MODULE}.o 4 | 5 | depend: ${DEPEND_FILE} 6 | 7 | ${DEPEND_FILE}: 8 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${DEPEND_FLAG} ${SRCS} | \ 9 | sed -e "/#/D" -e "/ \//s/ \/.*\.h//" -e "/ \\\/D" \ 10 | > ${DEPEND_FILE} 11 | 12 | .c.o: 13 | @echo --- compiling ${MODULE}/$*.o 14 | ${RM} $*.o 15 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} -c $*.c 16 | 17 | lib${MODULE}.o: ${OBJS} 18 | @echo --- linking lib${MODULE}.o 19 | ${RM} lib${MODULE}.o 20 | ${LINK} ${OBJS} -o lib${MODULE}.o ${EXTERN_LIBS} 21 | 22 | lib: lib${MODULE}.a 23 | 24 | lib${MODULE}.a: ${OBJS} ${LIB_OBJS} 25 | @echo --- archiving lib${MODULE}.a 26 | ${RM} lib${MODULE}.a 27 | ${AR} ${ARFLAGS} lib${MODULE}.a ${OBJS} ${LIB_OBJS} 28 | ${RANLIB} lib${MODULE}.a 29 | 30 | ${MODULE}: lib${MODULE}.o ${EXTRA_LIBS} 31 | @echo --- building main ${MODULE} 32 | ${RM} ${MODULE} 33 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} lib${MODULE}.o ${EXTRA_LIBS} -o ${MODULE} ${LIBS} 34 | 35 | clean: 36 | ${RM} ${CLEANS} 37 | 38 | tags: ${SRCS} ${LIB_SRCS} 39 | ctags ${SRCS} ${LIB_SRCS} 40 | 41 | include ${DEPEND_FILE} 42 | -------------------------------------------------------------------------------- /scripts/defs.mak.in: -------------------------------------------------------------------------------- 1 | # defs.mak.in -- 2 | # source file for autoconf-generated "defs.mak" for irsim 3 | 4 | # @configure_input@ 5 | # Feel free to change the values in here to suit your needs. 6 | # Be aware that running scripts/configure again will overwrite 7 | # any changes! 8 | 9 | SHELL = @SHELL@ 10 | 11 | prefix = ${BUILDROOT}@prefix@ 12 | exec_prefix = @exec_prefix@ 13 | bindir = @bindir@ 14 | libdir = @libdir@ 15 | mandir = @mandir@ 16 | 17 | VERSION = @VERSION@ 18 | 19 | SCRIPTS = ${IRSIMDIR}/scripts 20 | 21 | INSTALL = @INSTALL@ 22 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 23 | INSTALL_DATA = @INSTALL_DATA@ 24 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 25 | 26 | # Override standard "make" target when compiling under TCL 27 | ALL_TARGET = @ALL_TARGET@ 28 | INSTALL_TARGET = @INSTALL_TARGET@ 29 | 30 | # Change libdir to install in a different place 31 | BINDIR = ${bindir} 32 | MANDIR = ${mandir} 33 | LIBDIR = ${libdir} 34 | DOCDIR = ${libdir}/irsim/doc 35 | SYSDIR = ${libdir}/irsim/sys 36 | PRMDIR = ${libdir}/irsim/prm 37 | TCLDIR = ${libdir}/irsim/tcl 38 | XBMDIR = ${libdir}/irsim/tcl/bitmaps 39 | 40 | INSTALL_BINDIR = @DIST_DIR@/bin 41 | INSTALL_MANDIR = @DIST_DIR@/share/man 42 | INSTALL_LIBDIR = @DIST_DIR@/lib 43 | INSTALL_DOCDIR = ${INSTALL_LIBDIR}/irsim/doc 44 | INSTALL_SYSDIR = ${INSTALL_LIBDIR}/irsim/sys 45 | INSTALL_PRMDIR = ${INSTALL_LIBDIR}/irsim/prm 46 | INSTALL_TCLDIR = ${INSTALL_LIBDIR}/irsim/tcl 47 | INSTALL_XBMDIR = ${INSTALL_LIBDIR}/irsim/tcl/bitmaps 48 | 49 | MAIN_EXTRA_LIBS = @extra_libs@ 50 | LD_EXTRA_LIBS = @ld_extra_libs@ 51 | LD_SHARED = @ld_extra_objs@ 52 | TOP_EXTRA_LIBS = @top_extra_libs@ 53 | SUB_EXTRA_LIBS = @sub_extra_libs@ 54 | 55 | MODULES += @modules@ 56 | UNUSED_MODULES += @unused@ 57 | PROGRAMS += @programs@ 58 | INSTALL_CAD_DIRS += @cadinstall@ 59 | 60 | RM = rm -f 61 | CP = cp 62 | AR = ar 63 | ARFLAGS = crv 64 | LINK = ld -r 65 | LD = @LD@ 66 | M4 = @M4@ 67 | RANLIB = @RANLIB@ 68 | SHDLIB_EXT = @SHDLIB_EXT@ 69 | LDDL_FLAGS = @LDDL_FLAGS@ 70 | LD_RUN_PATH = @LD_RUN_PATH@ 71 | LIB_SPECS = @LIB_SPECS@ 72 | SHLIB_LIB_SPECS = @SHLIB_LIB_SPECS@ 73 | WISH_EXE = @WISH_EXE@ 74 | TCL_LIB_DIR = @TCL_LIB_DIR@ 75 | 76 | CC = @CC@ 77 | CPP = @CPP@ 78 | CXX = @CXX@ 79 | 80 | CPPFLAGS = -I. -I${IRSIMDIR} @CPPFLAGS@ 81 | DFLAGS = @extra_defs@ @DEFS@ -DSHDLIB_EXT=\"@SHDLIB_EXT@\" -DNDEBUG 82 | CFLAGS = @CFLAGS@ @SHLIB_CFLAGS@ @INC_SPECS@ 83 | 84 | DEPEND_FILE = Depend 85 | DEPEND_FLAG = @DEPEND_FLAG@ 86 | EXEEXT = @EXEEXT@ 87 | 88 | GR_CFLAGS = @X_CFLAGS@ @gr_cflags@ 89 | GR_DFLAGS = @gr_dflags@ -DNDEBUG 90 | GR_LIBS = @gr_libs@ @X_LIBS@ 91 | GR_SRCS = @gr_srcs@ 92 | GR_HELPER_SRCS = @gr_hsrcs@ 93 | GR_HELPER_PROG = @gr_hprog@ 94 | OTHER_SRCS = @other_srcs@ 95 | 96 | OBJS = ${SRCS:.c=.o} ${CXXSRCS:.cpp=.o} 97 | LIB_OBJS = ${LIB_SRCS:.c=.o} 98 | CLEANS = ${OBJS} ${LIB_OBJS} lib${MODULE}.a lib${MODULE}.o ${MODULE} 99 | -------------------------------------------------------------------------------- /scripts/irsim.spec.in: -------------------------------------------------------------------------------- 1 | Name: irsim 2 | Version: @VERSION@ 3 | Release: 1 4 | Summary: Switch-level simulator 5 | Group: Applications/Engineering 6 | License: GPL 7 | URL: http://www.opencircuitdesign.com/irsim/index.html 8 | Source: http://www.opencircuitdesign.com/irsim/archive/%{name}-%{version}.tgz 9 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 10 | BuildRequires: libX11-devel, libXt-devel, tcl-devel, tk-devel 11 | Requires: libX11, libXt, tcl, tk 12 | 13 | %description 14 | IRSIM is a tool for simulating digital circuits. It is a "switch-level" 15 | simulator; that is, it treats transistors as ideal switches. Extracted 16 | capacitance and lumped resistance values are used to make the switch a little 17 | bit more realistic than the ideal, using the RC time constants to predict the 18 | relative timing of events. 19 | 20 | %prep 21 | %setup -q 22 | 23 | %build 24 | %configure \ 25 | --with-tcl=%{_libdir} \ 26 | --with-tk=%{_libdir} \ 27 | --with-tclincls=%{_includedir} \ 28 | --with-tkincls=%{_includedir} \ 29 | --with-tcllibs=%{_libdir} \ 30 | --with-tklibs=%{_libdir} 31 | make 32 | 33 | %install 34 | rm -rf $RPM_BUILD_ROOT 35 | make install DESTDIR=$RPM_BUILD_ROOT 36 | 37 | %clean 38 | rm -rf $RPM_BUILD_ROOT 39 | 40 | %files 41 | %defattr(-,root,root,-) 42 | %doc README VERSION 43 | %{_bindir}/irsim 44 | %{_libdir}/irsim/* 45 | %{_mandir}/man1/irsim.1.gz 46 | %{_mandir}/man3/irsim-analyzer.3.gz 47 | %{_mandir}/man5/netchange.5.gz 48 | 49 | -------------------------------------------------------------------------------- /scripts/mkdirs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # mkdirs - a work-alike for `mkdir -p' 4 | # 5 | # Chet Ramey 6 | # chet@po.cwru.edu 7 | 8 | for dir 9 | do 10 | 11 | test -d "$dir" && continue 12 | 13 | tomake=$dir 14 | while test -n "$dir" ; do 15 | # dir=${dir%/*} 16 | # dir=`expr "$dir" ':' '\(/.*\)/[^/]*'` 17 | if dir=`expr "$dir" ':' '\(.*\)/[^/]*'`; then 18 | tomake="$dir $tomake" 19 | else 20 | dir= 21 | fi 22 | done 23 | 24 | for d in $tomake 25 | do 26 | test -d "$d" && continue 27 | echo mkdir "$d" 28 | mkdir "$d" 29 | done 30 | done 31 | 32 | exit 0 33 | -------------------------------------------------------------------------------- /tclsubckt/Makefile: -------------------------------------------------------------------------------- 1 | MODULE = tclsubckt 2 | IRSIMDIR = .. 3 | SRCS = diglib.c 4 | 5 | include ${IRSIMDIR}/defs.mak 6 | 7 | EXTRA_LIBS = ${MAIN_EXTRA_LIBS} 8 | 9 | LIBS += -lm ${MAC_EXTRA_LIBS} 10 | CFLAGS += -I${IRSIMDIR}/base 11 | CLEANS += irsim.user diglib${SHDLIB_EXT} diglib.o 12 | 13 | main: 14 | 15 | install: 16 | 17 | tcl-main: diglib${SHDLIB_EXT} 18 | 19 | diglib.o: diglib.c 20 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} diglib.c -c -o diglib.o 21 | 22 | diglib${SHDLIB_EXT}: diglib.o 23 | @echo --- making diglib subcircuit shared library 24 | ${RM} diglib${SHDLIB_EXT} 25 | ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o $@ ${LDDL_FLAGS} diglib.o \ 26 | ${MAC_SHARED} -lc ${LIBS} ${LD_EXTRA_LIBS} 27 | 28 | install-tcl: $(DESTDIR)${INSTALL_TCLDIR}/diglib${SHDLIB_EXT} 29 | 30 | $(DESTDIR)${INSTALL_TCLDIR}/diglib${SHDLIB_EXT}: diglib${SHDLIB_EXT} 31 | ${RM} $(DESTDIR)${INSTALL_TCLDIR}/diglib${SHDLIB_EXT} 32 | ${CP} diglib${SHDLIB_EXT} $(DESTDIR)${INSTALL_TCLDIR}/diglib${SHDLIB_EXT} 33 | 34 | include ${IRSIMDIR}/rules.mak 35 | -------------------------------------------------------------------------------- /tcltk/Depend: -------------------------------------------------------------------------------- 1 | tclirsim.o: tclirsim.c ../base/defs.h ../base/net.h ../base/globals.h \ 2 | ../base/rsim.h 3 | tclanalyzer.o: tclanalyzer.c ../base/globals.h ../base/net.h \ 4 | ../analyzer/ana.h ../base/defs.h ../analyzer/ana_glob.h \ 5 | ../analyzer/graphics.h 6 | lookup.o: lookup.c ../base/globals.h ../base/net.h 7 | tkAnalyzer.o: tkAnalyzer.c ../analyzer/ana.h ../base/net.h ../base/defs.h \ 8 | ../analyzer/ana_glob.h ../base/rsim.h 9 | tkTag.o: tkTag.c ../base/net.h 10 | -------------------------------------------------------------------------------- /tcltk/Makefile: -------------------------------------------------------------------------------- 1 | MODULE = tcltk 2 | IRSIMDIR = .. 3 | SRCS = tclirsim.c tclanalyzer.c lookup.c 4 | TK_SRCS = tkAnalyzer.c tkTag.c 5 | 6 | include ${IRSIMDIR}/defs.mak 7 | 8 | EXTRA_LIBS = ${MAIN_EXTRA_LIBS} 9 | 10 | DFLAGS += -DIRSIM_DATE="\"`date`\"" 11 | LIBS += ${GR_LIBS} -lm 12 | CLEANS += irsim.sh irsim.tcl irsimexec 13 | SRCS += ${GR_SRCS} 14 | CFLAGS += -I${IRSIMDIR}/base -I${IRSIMDIR}/analyzer 15 | 16 | TCL_FILES = \ 17 | $(DESTDIR)${INSTALL_TCLDIR}/tkcon.tcl \ 18 | $(DESTDIR)${INSTALL_TCLDIR}/console.tcl \ 19 | $(DESTDIR)${INSTALL_TCLDIR}/vcd.tcl \ 20 | $(DESTDIR)${INSTALL_TCLDIR}/irsim.tcl 21 | 22 | tcl-main: irsimexec irsim.tcl irsim.sh 23 | 24 | install-tcl: irsimexec $(DESTDIR)${INSTALL_BINDIR}/irsim.sh ${TCL_FILES} 25 | ${RM} $(DESTDIR)${INSTALL_TCLDIR}/irsimexec 26 | ${CP} irsimexec $(DESTDIR)${INSTALL_TCLDIR}/irsimexec 27 | 28 | irsimexec: irsimexec.c tclirsim.o 29 | ${CC} ${CFLAGS} ${CPPFLAGS} ${DFLAGS} ${LDFLAGS} irsimexec.c -o irsimexec \ 30 | ${LIBS} ${LIB_SPECS} 31 | 32 | irsim.tcl: irsim.tcl.in 33 | sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g \ 34 | -e /SHDLIB_EXT/s%SHDLIB_EXT%${SHDLIB_EXT}%g \ 35 | irsim.tcl.in > irsim.tcl 36 | 37 | irsim.sh: irsim.sh.in 38 | sed -e /TCL_DIR/s%TCL_DIR%${TCLDIR}%g \ 39 | -e /TCLLIB_DIR/s%TCLLIB_DIR%${TCL_LIB_DIR}%g \ 40 | -e /WISH_EXE/s%WISH_EXE%${WISH_EXE}%g \ 41 | irsim.sh.in > irsim.sh 42 | 43 | $(DESTDIR)${INSTALL_TCLDIR}/%: % 44 | ${RM} $(DESTDIR)${INSTALL_TCLDIR}/$* 45 | ${CP} $* $(DESTDIR)${INSTALL_TCLDIR}/$* 46 | 47 | $(DESTDIR)${INSTALL_BINDIR}/irsim.sh: irsim.sh 48 | ${RM} $(DESTDIR)${INSTALL_BINDIR}/irsim.sh $(DESTDIR)${INSTALL_BINDIR}/irsim 49 | ${CP} irsim.sh $(DESTDIR)${INSTALL_BINDIR}/irsim 50 | (cd $(DESTDIR)${INSTALL_BINDIR}; chmod 0755 irsim) 51 | 52 | 53 | include ${IRSIMDIR}/rules.mak 54 | -------------------------------------------------------------------------------- /tcltk/console.tcl: -------------------------------------------------------------------------------- 1 | # Tcl commands to run in the console before IRSIM is initialized 2 | # 3 | puts stdout "Running IRSIM Console Functions" 4 | bind .text {irsim::interrupt} 5 | -------------------------------------------------------------------------------- /tcltk/irsim.sh.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # For installation, put this file (irsim.sh) in a standard executable path. 4 | # Put startup script "irsim.tcl" and shared library "tclirsim.so" 5 | # in ${CAD_ROOT}/irsim/tcl/, with a symbolic link from file 6 | # ".wishrc" to "irsim.tcl". 7 | # 8 | # This script starts irsim under the Tcl interpreter, 9 | # reading commands from a special .wishrc script which 10 | # launches irsim and retains the Tcl interactive interpreter. 11 | 12 | # Parse for the argument "-c[onsole]". If it exists, run irsim 13 | # with the TkCon console. Strip this argument from the argument list. 14 | 15 | TKCON=true 16 | IRSIM_WISH=WISH_EXE 17 | export IRSIM_WISH 18 | 19 | # Hacks for Cygwin 20 | if [ "`uname | cut -d_ -f1`" = "CYGWIN" ]; then 21 | export PATH="$PATH:TCLLIB_DIR" 22 | export DISPLAY=${DISPLAY:=":0"} 23 | fi 24 | 25 | for i in $@ ; do 26 | case $i in 27 | -noc*) TKCON=;; 28 | esac 29 | done 30 | 31 | if [ $TKCON ]; then 32 | 33 | exec TCL_DIR/tkcon.tcl \ 34 | -eval "source TCL_DIR/console.tcl" \ 35 | -slave "package require Tk; set argc $#; set argv [list $*]; \ 36 | source TCL_DIR/irsim.tcl" 37 | 38 | # exec TCL_DIR/tkcon.tcl -exec "" -eval \ 39 | # "set argc $#; set argv [list $*]; source TCL_DIR/irsim.tcl" 40 | 41 | else 42 | 43 | # 44 | # Run the stand-in for wish (irsimexec), which acts exactly like "wish" 45 | # except that it replaces ~/.wishrc with irsim.tcl. This executable is 46 | # *only* needed when running without the console; the console itself is 47 | # capable of sourcing the startup script. 48 | # 49 | 50 | exec TCL_DIR/irsimexec -- $@ 51 | 52 | fi 53 | -------------------------------------------------------------------------------- /tcltk/irsimexec.c: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------*/ 2 | /* irsimexec.c */ 3 | /* */ 4 | /* Written by R. Timothy Edwards for MultiGiG, Inc., November 2004 */ 5 | /* This file mainly lifted from the main application routine for */ 6 | /* "wish" from the Tk distribution. */ 7 | /* */ 8 | /* This is a compact re-write of the "wish" executable that calls */ 9 | /* Tk_MainEx with application-specific processing. Specifically, */ 10 | /* "wish" doesn't allow the startup script (~/.wishrc) to be renamed. */ 11 | /* However, for irsim running as an extension of Tcl, we want to source */ 12 | /* the irsim.tcl file instead of ~/.wishrc. So, all this file really */ 13 | /* does is to set the Tcl variable "tcl_rcFileName" to irsim.tcl, so */ 14 | /* that it will be processed as the startup script, followed by a drop */ 15 | /* back to the Tcl interpreter command-line main loop. */ 16 | /* */ 17 | /* This is a standalone executable. However, it is only called when */ 18 | /* "-noconsole" is specified on the UNIX command-line. When the */ 19 | /* console is used, the console is capable of sourcing the irsim.tcl */ 20 | /* script itself, and so it uses "wish" as the executable. However, */ 21 | /* the console redirects standard input, so it prevents irsim from */ 22 | /* being used in a batch processing mode. Thus, to batch-process with */ 23 | /* irsim, use "irsim -noc < script.tcl" or, interactively, */ 24 | /* "irsim -noc << EOF" followed by commands entered from stdin */ 25 | /* and ending with "EOF". */ 26 | /* */ 27 | /* The "irsimexec" method replaces the former use of "wish" with the */ 28 | /* "irsim" script setting HOME to point to the directory containing */ 29 | /* ".wishrc", a symbolic link to "irsim.tcl". That failed to work on */ 30 | /* remote systems because the $HOME environment variable is also used */ 31 | /* to find the user's .Xauthority file to authenticate the X11 */ 32 | /* connection. */ 33 | /*----------------------------------------------------------------------*/ 34 | 35 | #include 36 | 37 | #include 38 | #include 39 | 40 | /*----------------------------------------------------------------------*/ 41 | /* Application initiation. This is exactly like the AppInit routine */ 42 | /* for "wish", minus the cruft, but with "tcl_rcFileName" set to */ 43 | /* "irsim.tcl" instead of "~/.wishrc". */ 44 | /*----------------------------------------------------------------------*/ 45 | 46 | int 47 | irsim_AppInit(interp) 48 | Tcl_Interp *interp; 49 | { 50 | if (Tcl_Init(interp) == TCL_ERROR) { 51 | return TCL_ERROR; 52 | } 53 | if (Tk_Init(interp) == TCL_ERROR) { 54 | return TCL_ERROR; 55 | } 56 | Tcl_StaticPackage(interp, "Tk", Tk_Init, Tk_SafeInit); 57 | 58 | /* This is where we replace the home ".wishrc" file with */ 59 | /* irsim's startup script. */ 60 | 61 | Tcl_SetVar(interp, "tcl_rcFileName", TCL_DIR "/irsim.tcl", TCL_GLOBAL_ONLY); 62 | return TCL_OK; 63 | } 64 | 65 | /*----------------------------------------------------------------------*/ 66 | /* The main procedure; replacement for "wish". */ 67 | /*----------------------------------------------------------------------*/ 68 | 69 | int 70 | main(argc, argv) 71 | int argc; 72 | char **argv; 73 | { 74 | Tk_Main(argc, argv, irsim_AppInit); 75 | return 0; 76 | } 77 | 78 | /*----------------------------------------------------------------------*/ 79 | -------------------------------------------------------------------------------- /tcltk/lookup.c: -------------------------------------------------------------------------------- 1 | /* lookup.c -- 2 | * 3 | * This file contains a single routine used to look up a string in 4 | * a table, allowing unique abbreviations. 5 | * 6 | * Lifted in large part from the source for magic. 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | #include "globals.h" 13 | 14 | /*--------------------------------------------------------- 15 | * Lookup -- 16 | * Searches a table of strings to find one that matches a given 17 | * string. It's useful mostly for command lookup. 18 | * 19 | * Only the portion of a string in the table up to the first 20 | * blank character is considered significant for matching. 21 | * 22 | * Return value: 23 | * If str is the same as or an unambiguous abbreviation for one 24 | * of the entries in table, then the index of the matching entry 25 | * is returned. If str is not the same as any entry in the table, 26 | * but an abbreviation for more than one entry, then -1 is returned 27 | * (ambiguous result). If str doesn't match any entry, then 28 | * -2 is returned. Case differences are ignored. 29 | *--------------------------------------------------------- 30 | */ 31 | 32 | int lookup(char *str, char *(table[]), int quiet) 33 | { 34 | int match = -2; /* result, initialized to -2 = no match */ 35 | int pos; 36 | int ststart = 0; 37 | char mesg[50]; 38 | 39 | static char *namespace = "::irsim::"; 40 | 41 | /* Skip over prefix of qualified namespaces "::irsim::" and "irsim::" */ 42 | for (pos = 0; pos < 9; pos++) 43 | if ((str[pos] != namespace[pos]) || (str[pos] == '\0')) break; 44 | if (pos == 9) ststart = 9; 45 | else 46 | { 47 | for (pos = 0; pos < 7; pos++) 48 | if ((str[pos] != namespace[pos + 2]) || (str[pos] == '\0')) break; 49 | if (pos == 7) ststart = 7; 50 | } 51 | 52 | /* search for match */ 53 | for (pos=0; table[pos] != NULL; pos++) 54 | { 55 | char *tabc = table[pos]; 56 | char *strc = &(str[ststart]); 57 | while(*strc!='\0' && *tabc!=' ' && 58 | ((*tabc==*strc) || 59 | (isupper(*tabc) && islower(*strc) && (tolower(*tabc)== *strc))|| 60 | (islower(*tabc) && isupper(*strc) && (toupper(*tabc)== *strc)))) 61 | { 62 | strc++; 63 | tabc++; 64 | } 65 | 66 | if (*strc == '\0') 67 | { 68 | /* entry matches */ 69 | if (*tabc == ' ' || *tabc == '\0') 70 | { 71 | /* exact match - record it and terminate search */ 72 | match = pos; 73 | break; 74 | } 75 | else if (match == -2) 76 | { 77 | /* inexact match and no previous match - record this one 78 | * and continue search */ 79 | match = pos; 80 | } 81 | else 82 | { 83 | /* previous match, so string is ambiguous unless exact 84 | * match exists. Mark ambiguous for now, and continue 85 | * search. 86 | */ 87 | match = -1; 88 | } 89 | } 90 | } 91 | 92 | if (!quiet) { 93 | if (match == -1) { 94 | sprintf(mesg, "Ambiguous option \"%s\"\n", str); 95 | lprintf(stderr, mesg); 96 | } 97 | else if (match == -2) { 98 | lprintf(stderr, "Unknown option. Valid options are: "); 99 | for (pos=0; table[pos] != NULL; pos++) { 100 | lprintf(stderr, table[pos]); 101 | lprintf(stderr, " "); 102 | } 103 | lprintf(stderr, "\n"); 104 | } 105 | } 106 | return(match); 107 | } 108 | -------------------------------------------------------------------------------- /tcltk/vcd.tcl: -------------------------------------------------------------------------------- 1 | #--------------------------------------------------------- 2 | # vcd.tcl 3 | #--------------------------------------------------------- 4 | # Support for reading "VCD" format dumpfiles in IRSIM. 5 | # Adds command "readvcd ", which reads in 6 | # the file and displays the traces in the analyzer. 7 | #--------------------------------------------------------- 8 | 9 | proc readvcd {dumpfile} { 10 | set prefix "" 11 | if { [catch {open $dumpfile r} df] } { 12 | puts stderr "Could not open VCD dumpfile $dumpfile\n" 13 | return 14 | } 15 | while {[gets $df line] >= 0} { 16 | if {[regexp {^\$([^ ]+)} $line lmatch dumpvar]} { 17 | switch $dumpvar { 18 | date { 19 | gets $df line 20 | puts stdout $line 21 | } 22 | version { 23 | gets $df line 24 | puts stdout $line 25 | } 26 | timescale { 27 | gets $df line 28 | regexp {([0-9]+)[ \t]*([^ ]+)} $line lmatch scale metric 29 | switch $metric { 30 | fs {set scale [expr 0.001 * $scale]} 31 | ns {set scale [expr 1000 * $scale]} 32 | } 33 | } 34 | var { 35 | regexp {^\$var[ \t]+[^ ]+[ \t]+([0-9]+)[ \t]+([^ ]+)[ \t]+([^ ]+)} \ 36 | $line lmatch bitlen repchar signame 37 | if {$bitlen == 1} { 38 | addnode ${prefix}${signame} 39 | } else { 40 | for {set i 0} {$i < $bitlen} {incr i} { 41 | addnode ${prefix}${signame}\[$i\] 42 | } 43 | incr bitlen -1 44 | vector ${prefix}${signame} ${prefix}${signame}\[0:${bitlen}\] 45 | } 46 | set nodenames($repchar) ${prefix}${signame} 47 | ana ${prefix}${signame} 48 | } 49 | scope { 50 | regexp {^\$scope[ \t]+([^ ]+)[ \t]+([^ ]+)} \ 51 | $line lmatch scopetype instname 52 | set prefix "${prefix}${instname}/" 53 | } 54 | upscope { 55 | set prefix "" 56 | } 57 | } 58 | } else { 59 | # Known patterns are: 0, 1, x (bit set), b (vector set), # (schedule) 60 | set curtime 0 61 | while {[gets $df line] >= 0} { 62 | set cmd [string index $line 0] 63 | switch $cmd { 64 | b { 65 | regexp {^b([0-9]+)[ \t]+([^ ]+)} $line lmatch bval sname 66 | setvector $nodenames($sname) %b${bval} 67 | } 68 | # { 69 | set tval [string range $line 1 end] 70 | set tval [expr $tval * $scale] 71 | set nexttime $tval 72 | set tval [expr $tval - $curtime] 73 | if {$tval > 0} s $tval 74 | set curtime $nexttime 75 | } 76 | 0 { 77 | set sname [string range $line 1 end] 78 | l $nodenames($sname) 79 | } 80 | 1 { 81 | set sname [string range $line 1 end] 82 | h $nodenames($sname) 83 | } 84 | x { 85 | set sname [string range $line 1 end] 86 | u $nodenames($sname) 87 | } 88 | } 89 | } 90 | } 91 | } 92 | 93 | close $df 94 | } 95 | 96 | #--------------------------------------------------------- 97 | # For backward compatibility. Procedure was originally named "readcver", 98 | # but the format is VCD. 99 | #--------------------------------------------------------- 100 | 101 | proc readcver {dumpfile} { 102 | readvcd $dumpfile 103 | } 104 | -------------------------------------------------------------------------------- /usersubckt/Depend: -------------------------------------------------------------------------------- 1 | user.o: user.c subckt.h 2 | subckt.o: subckt.c ../base/defs.h ../base/net.h ../base/globals.h \ 3 | subckt.h 4 | -------------------------------------------------------------------------------- /usersubckt/Makefile: -------------------------------------------------------------------------------- 1 | MODULE = usersubckt 2 | IRSIMDIR = .. 3 | SRCS = subckt.c user.c 4 | 5 | include ${IRSIMDIR}/defs.mak 6 | 7 | CFLAGS += -I${IRSIMDIR}/base 8 | 9 | include ${IRSIMDIR}/rules.mak 10 | -------------------------------------------------------------------------------- /usersubckt/README: -------------------------------------------------------------------------------- 1 | This directory provides an example of how "black box" subcircuits work. 2 | The more involved example is in dll.c and is a dll simulation. 3 | To see what it does make irsim.user and then run it on 4 | dll.sim with dll.cmd. The edges of the two clocks should be aligned 5 | by the end of the simulation and the updn signal should be switching. 6 | 7 | The subcircuit is called by: 8 | 9 | x upDn inClk outClk outClk1 dll 10 | 11 | it means call the subcircuit dll (defined in dll.c) with inputs 12 | (upDn, inClk, outClk) and output (ouClk1). 13 | 14 | To create and compile a new subcircuit library, replace "user.c" in 15 | the Makefile with the source file containing the library initialization 16 | and evaluation routines. The files "dll.c" and "flop_mux.c" are provided 17 | as examples. 18 | 19 | Some caveats: 20 | 1. The output delay is always specified in picoseconds. 21 | 2. You might have to change the MAXARGS in sim.c to if you have way too many IO's. 22 | 3. The code in this directory is deprecated and has been replaced by the 23 | example code in directory "tclsubckt", which allows subcircuit libraries to 24 | be compiled and loaded independently of irsim. 25 | -------------------------------------------------------------------------------- /usersubckt/dll.cmd: -------------------------------------------------------------------------------- 1 | ana inClk outClk* upDn 2 | clock inClk 0 1 3 | stepsize 2 4 | c 140 5 | -------------------------------------------------------------------------------- /usersubckt/dll.sim: -------------------------------------------------------------------------------- 1 | | units: 100 tech: scmos 2 | x outClk inClk upDn flop 3 | x upDn inClk outClk outClk1 dll 4 | 5 | p outClk1 outClk_b Vdd 2 20 6 | n outClk1 outClk_b Gnd 2 10 7 | p outClk_b outClk Vdd 2 80 8 | n outClk_b outClk Gnd 2 40 9 | -------------------------------------------------------------------------------- /usersubckt/flop.cmd: -------------------------------------------------------------------------------- 1 | stepsize 2 2 | ana clk in out out2 3 | clock clkb 1 1 1 0 0 0 1 1 1 0 0 0 4 | clock in 0 0 1 1 1 0 0 0 0 0 0 0 5 | c 10 6 | -------------------------------------------------------------------------------- /usersubckt/flop.sim: -------------------------------------------------------------------------------- 1 | | units: 100 tech: scmos 2 | x in clk out flop 3 | x out clk out2 flop 4 | p clkb clk Vdd 2 18 5 | n clkb clk Gnd 2 9 6 | -------------------------------------------------------------------------------- /usersubckt/flop_mux.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "subckt.h" 3 | 4 | uptr mux2_init(); 5 | void mux2_eval(); 6 | uptr flop_init(); 7 | void flop_eval(); 8 | 9 | static float mux2_res[2] = {500.0, 500.0}; 10 | static float flop_res[2] = {1000.0, 1000.0}; 11 | 12 | static userSubCircuit subs[] = 13 | { 14 | { "mux2", mux2_eval, mux2_init, 3, 1, mux2_res}, 15 | { "flop", flop_eval, flop_init, 3, 1, flop_res}, 16 | { NULL, NULL, NULL, 0, 0, NULL} 17 | }; 18 | 19 | typedef struct _flopState { 20 | int prvClk; 21 | int Q; 22 | } flopState; 23 | 24 | uptr flop_init() 25 | { 26 | flopState *thisFlop = (flopState *)malloc(sizeof(flopState)); 27 | 28 | thisFlop->prvClk = HIGH; 29 | thisFlop->Q = X; 30 | return (uptr)thisFlop; 31 | } 32 | 33 | void flop_eval(ins, outs, delay, data) 34 | char *ins, *outs; 35 | double *delay; 36 | uptr *data; 37 | { 38 | flopState *ff = (flopState *)data ; 39 | 40 | if (ff->prvClk == LOW && ins[1] == HIGH) { 41 | lprintf("flop edge @ %.2fns\n", d2ns(cur_delta)); 42 | ff->Q = ins[0]; 43 | } 44 | delay[0] = 100.0; 45 | ff->prvClk = ins[1]; 46 | outs[0] = ff->Q; 47 | } 48 | 49 | uptr mux2_init() 50 | { 51 | return (uptr)NULL; 52 | } 53 | 54 | void mux2_eval(ins, outs, delay, udata) 55 | char *ins; 56 | char *outs; 57 | double *delay; 58 | uptr udata; 59 | { 60 | delay[0] = 100.0; 61 | if (ins[2] == LOW) 62 | outs[0] = ins[1]; 63 | else if (ins[2] == HIGH) 64 | outs[0] = ins[0]; 65 | else 66 | outs[0] = X; 67 | } 68 | -------------------------------------------------------------------------------- /usersubckt/subckt.h: -------------------------------------------------------------------------------- 1 | #ifndef _SUBCKT_H 2 | #define _SUBCKT_H 3 | 4 | #ifdef USER_SUBCKT 5 | 6 | #ifndef _LOCTYPES_H 7 | #include "loctypes.h" 8 | #endif 9 | 10 | /*----------------------------------------------------------------------*/ 11 | /* User-defined subcircuits have a different set of logic values, */ 12 | /* allowing the output to be defined in various ways, like high- */ 13 | /* impedence, pull-up, pull-down, open drain, etc. */ 14 | /*----------------------------------------------------------------------*/ 15 | 16 | #define C_LOW 'l' /* logic low */ 17 | #define C_X 'x' /* unknown or intermediate value */ 18 | #define C_Z 'z' /* high impedence state */ 19 | #define C_HI 'h' /* logic high */ 20 | 21 | /*----------------------------------------------------------------------*/ 22 | /* Structure used to declare information about user-defined subcircuit */ 23 | /* library components. */ 24 | /*----------------------------------------------------------------------*/ 25 | 26 | typedef struct 27 | { 28 | char *name; /* name of this sub-circuit */ 29 | vfun model; /* function that models sub-circuit */ 30 | ufun init; /* Function to call to init */ 31 | short ninputs; /* Number of input nodes */ 32 | short noutputs; /* Number of output nodes */ 33 | float *res; /* pointer to list of output driver */ 34 | /* "on" resistances */ 35 | } userSubCircuit; 36 | 37 | /*----------------------------------------------------------------------*/ 38 | /* Structure that substitutes for a transistor record in the netlist */ 39 | /* at each subcircuit input node */ 40 | /*----------------------------------------------------------------------*/ 41 | 42 | typedef struct _SubcktT { 43 | userSubCircuit *subckt; 44 | nptr *nodes; 45 | uptr udata; /* pointer to instance's private data */ 46 | lptr ndiode; 47 | } SubcktT; 48 | 49 | extern userSubCircuit subs[]; 50 | 51 | #endif 52 | 53 | #ifndef _UNITS_H 54 | #include "units.h" 55 | #endif 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /usersubckt/user.c: -------------------------------------------------------------------------------- 1 | /*--------------------------------------------------------------*/ 2 | /* This file (user.c) is a placeholder that defines the array */ 3 | /* of information about user-defined subcircuits. To compile */ 4 | /* a different set of user subcircuits, replace "user.c" in the */ 5 | /* Makefile with the name of the source code file. Files */ 6 | /* "flop_mux.c" and "dll.c" are provided as examples. */ 7 | /*--------------------------------------------------------------*/ 8 | 9 | #include 10 | 11 | #ifndef _GLOBALS_H 12 | #include "globals.h" 13 | #endif 14 | 15 | #include "subckt.h" 16 | 17 | #define DEBUG 0 18 | #define dprintf if (DEBUG) lprintf 19 | 20 | userSubCircuit subs[] = 21 | { 22 | { NULL, NULL, NULL, 0, 0, NULL} 23 | }; 24 | 25 | /*--------------------------------------------------------------*/ 26 | /* End of user.c empty placeholder library */ 27 | /*--------------------------------------------------------------*/ 28 | --------------------------------------------------------------------------------