MAGIC Magic Mailing List
 
 

From: cfk (cfk AT pacbell DOT net)
Date: Fri Mar 28 2003 - 14:39:22 EST

  • Next message: Stefan Jones: "Re: tclspice & magic"

    Dear Stefan:
        Thank you for your e-mail. Progress is being made. I am hoping you will
    bear with me for another e-mail or two while I try to get to the "and thus
    we are done" stage also. I am cc-ing this to the magic users group in hopes
    it might prove useful to Tim and others also.
    
        Firstly, I have commented out the last lines in
    /home/cad/lib/magic/sys/.magic dealing with both plot and scheme (the scm
    invocations). I have also commented out the option statements  for zoomTitle
    & zoomOutline as described in your dif file earlier. I then invoke
    'magic -w' as you show:
    
    % magic -w
    Main console display active (Tcl8.3.3 / Tk8.3.3)
    % package require spice
    Cell /usr/lib/tclX8.3/../libtclx8.3.so couldnt be found
    Creating new cell
    can't find package Tclx
    % ;load /usr/lib/libspice
    % ; package require spice
    0.2.6
    
    Now I have to mention at this stage that the system I am running this on is
    a RH8 with all packages installed, including Tclx. The red hat installation
    did put a libtclx.so into /usr/lib and there is a /usr/lib/tclX8.3 with a
    pkgIndex.tcl and other files. Also, it seems that spice loaded OK the second
    time. Anyway, this is probably a -exact, or a path thing. Let me go on to
    the next step where I have an inverter that was extracted from
    http://www.rsl.ukans/~linhard/magic which is the magic file I have been
    working with. The .cir file I am using merely gets the nfet/pfet models to
    level 2 NMOS/PMOS and is a slightly modified version of the .cir file at
    http://bear.ces.cwru.edu/eecs_cad/cad_spice.html which appears to be a very
    useful reference for spice circuits pertaining to an inverter circuit
    extraction from magic. Anyway, here goes the next step or two.
    
    %;cd /home/global/test2
    %;spice::source testx_trans.cir
    %;spice::run
    %;spice:;asciiplot v(out)
    
    At this point, I have a successful spice run and a successful spice plot of
    the out voltage of the invf100.mag file (where I changed the input from A1
    to in and the output from O to out for personal reasons) from ukans where
    the testx_trans added a power supply, ground connection.
    
    %;plot out
    %:plot in
    
    And yes, there are now two graphs, one of the input and one of the output of
    a magic inverter cell. By, the way, I can just do a
    
    %;load /usr/lib/libspice
    
    and get everything running without the 'package require spice'. I think the
    issues are very minor and perhaps could be just worked out so the
    occaisional user can get his magic/irsim/tclspice working without having to
    understand everything about paths, packages and such. I am hoping you might
    consider working to make it easier on the user.
    
    I also have a couple of suggestions along that line. Both magic and irsim
    have a make config step, tclspice has arguments to ./configure. Perhaps
    tclspice could have a make config step and avoid the ./configure arguments
    and have its make procedure more like irsim & magic (or conversly, magic
    could have its make config changed to ./configure arguements). Similarly,
    magic and irsim do a 'make tcl' followed by a 'make install-tcl' and
    tclspice does a 'make tcl' followed by a 'make tcl_install'. I find I now
    have to look it up everytime I compile since they are different. Perhaps
    tclspice could change the make tcl_install to make install-tcl or conversly
    (well, you know what I was about to type, but my vote is really to change
    tclspice instead of magic and irsim, but youse folks can work that part
    out).
    
    Anyway, not criticism Stefan, I am trying to help and right now I am
    admiring two wonderful plots from a magic cell on my screen. Thank you very
    much for your help.
    
    Charles
    
    Subject: Re: [Ngspice-users] tclspice & magic
    
    
    > On Thu, 2003-03-27 at 20:46, cfk wrote:
    > > The invocation of "magic -w" creates a magic window, a tkcon and a
    tclspice
    > > graph that is blank. A "load /usr/lib/libspice" does get access to spice
    and
    > > I can spice an inverter extracted from magic with exttospice and plot it
    > > with ";spice::asciiplot v(out)", I just cant do a ";spice::plot v(out)"
    from
    > > within magic (works outside of magic with ngspice directly from a bash
    > > prompt, draws the output voltage with blt, no problem).
    > >
    > > Now it gets interesting. I can tell that the plot procedure in
    pkgIndex.tcl
    > > is being called as a consequence of the default loading of magic's tcl
    stuff
    > > even though magic knows nothing about spice at this point. It appears
    after
    > > reading mucho documentation that the tcl interpreter goes looking for
    all
    > > the "pkgIndex.tcl" files when it needs a procedure called for instance
    > > "plot". And there is one in ../spice/pkgIndex.tcl, and it is called.
    >
    > > So, I recompiled magic without the plot module, still same effect. Next,
    I
    > > renamed the plot as xplot in pkgIndex.tcl and voila, no blank plot
    anymore.
    > > I also put a puts inside pkgIndex.tcl so I would be told it was
    executing,
    > > and it is executing when I think it is executing.
    >
    > This is a namespace conflict which I have known for quite a while. In
    > the pkgIndex.tcl there are a lot of global variables which get in the
    > way of quite a few packages. Ideally it needs to be cleaned up with all
    > the functions / variables in pkgIndex.tcl being in a namespace and only
    > sourced from a seperate file when the user runs "package require spice"
    >
    > This would also speed up the execution time of tclsh as at the moment
    > every time it runs it sources the entire pkgIndex.tcl file.
    >
    > I am not the author of the current pkgIndex.tcl but I have CCed him
    > (Adrian Dawe). I think he may have done some work on the clean ups
    > already.
    >
    > > Perhaps some hints on the care and feeding of pkgIndex.tcl:plot could be
    > > suggested??
    >
    > I only really look after the C-code stuff. But it is good to see that
    > that part works.
    >
    > Ok here are the mods I did to get it to work:
    >
    > Edit your .magic file normally found at $CAD_HOME/lib/magic/sys/.magic
    > and remove the plot commands at the bottom of the file:
    > ------
    > # additions for plot package
    >
    > #plot parameter spoolCommand "echo use 'lpr -P%s -v -s -JMagic %s' to
    print plot"
    > #plot parameter directory "."
    > ------
    >
    > This will stop the blank plot window appearing when you start magic, as
    > when you start magic wish sources /usr/lib/spice/pkgIndex.tcl which
    > creates a "plot" command whether you want to use spice or not, which
    > overwrites the magic plot command. .magic is then sourced by magic and
    > invokes the spice plot command which creates the blank plot.
    >
    > Now the pkgIndex.tcl file needs some fixes, in particular the options
    > lines which you found before. I commented these out. I also removed the
    > package require Tclx line as it is not required.
    >
    > Now I can do the following (PS. magic plot is compiled in but it seems
    > /usr/lib/spice/pkgIndex.tcl overwrites it with it's own function)
    >
    > magic -w
    > [ wait for the magic tcl prompt ]
    > [ at the magic prompt we get ]
    > [ snip .... ]
    > Main console display active (Tcl8.3.4 / Tk8.3.4)
    > % package require spice
    > 0.2.7
    > % spice::source array.spice
    > % spice::step 10
    > % plot 3019
    > list add : 3019
    > 2
    > [ The plot pops up! ]
    >
    > And thus we are done!
    >
    > Attached it the patch I used to /usr/lib/spice/pkgIndex.tcl to get it
    > working here. This if for tclspice-0.2.7.
    >
    > Hope this helps,
    >
    > Stefan
    >
    > --
    > Stefan Jones <stefan.jones AT multigig DOT com>
    > Multigig Ltd
    >
    


  •  
     
    Questions? Contact Rajit Manohar
    cornell logo