next up previous contents
Next: The 'mousecommand' window Up: SPICECAD The Schematic Entry Previous: Installation

First Steps

This chapter guides you through the first simulation steps. At this point, you should have installed all binary files , documentation and examples by untaring and unzipping the recent SPICECAD version obtained from the internet or from SPICECAD support.

WARNING: If you use a mapped keyboard ('xmodmap'), hotkeys will not work as described. Plese read the chapter 'Hotkeys' on page [*] if strange things happen when you use hotkeys.

   

Please create a new directory, called working directory, and copy the following files into this directory:

           

   

Next please, copy the file 'first.scm' into the working directory. If SPICECAD is on your search path, it is time now for your first SPICECAD session.

   

Please type 'spicecad.sol' if you use a SOLARIS system or 'spicecadstat' if you work on a PC. On a SUN OS 4.1.X system, the starting command is 'spicecad.sunos'.

   

The output will read as follows:

    argv[0]= spicecadstat
    type 'cad -c cellname' to start schematic entry
    type 'cad ' to start schematic entry with cell
                loaded one session ago
    Program: Spice, version: 3f5
    Date built: March 3  1999


    Spice 1 ->

 

What you see here is the well-known SPICE3 command line user interface. If you want, you can stay on this level, running SPICE3 simulations and so on and so forth. But, some functions, especially these which display simulation results, have been removed, so, you will be unable to display results.

If you want to use the schematic entry, now type
Spice 1 -> cad -c first

Output:
calling cad

After doing this, a window will pop up which shows you the first example schematic.


 
Figure 3.1: First schematic
\fbox{
\includegraphics{firstschem.ps}
}

If everything went well, a window will come up titled 'first' . It contains the 'first' schematic.

This is your schematic editing window.

 

If you have forgotten to copy file 'setup.spi' into you working directory, a message box will pop up showing a message in a second window. 'could not open setup-file setup.spi'


 
Figure 3.2: Example of an error message
\fbox{\includegraphics{couldnotopensetup.ps}
}

Press 'CONFIRM' , and the window will disappear until you make another error.

The box you might have seen is the error- ,warning- and information-box.

If you are a SPICECAD starter and if you have installed the free (no HSPICE interface, reduced functions concerning parametric simulation ) version, another message will come up:

Please register SPICECAD.
Otherwise, parameter sweep, monte carlo simulation and optimization are not executable.
Press 'registration' button in main menu to register.

This feature was implemented because we obviously want to know who is using SPICECAD. If you press the 'register' button in the main menu, a message file will be created and sent to martin.maschmann@t-online.de via e-mail.

This file contains only one piece of user related information: your login name which is obtained using 'who'. Additionally, a file will be created and copied into your HOME directory to tell SPICECAD that you have registered yourself. The next time you start SPICECAD, SPICECAD will look for this file. If SPICECAD can find this file, the 'please register' message will not appear again, and SPICECAD has full capacity.

The file sent to SPICECAD DEVELOPMENT via e-mail will, of course, only reach us if your machine is attached to the net. If not, the registration file in the HOME directory will be created, anyway, and you will get full access to the extended SPICECAD simulation functions. But, we would appreciate you letting us know by other means that you are using SPICECAD. We really like the feeling that SPICECAD is used on a world-wide basis by many people, and the messages we get will keep us motivated to push SPICECAD to the limits.

But now, back to business. If you did everything correctly, you should still see the schematic window in front of you.

Now, you probably ask yourself which mousebutton to press first. To tell you what each mouse button press means, a third (not yet mentioned) window has already popped up. This window gives you a little context-sensitive help and tells you what will happen if you press the right or left mouse button.

For further information, please read the chapter 'The mousecommand window' on page [*].

In the schematic window 'first', you can see a simple RC-low pass circuit schematic.

The circuit is made of a DC voltage source, two resistors and a capacitor. These devices are connected via blue lines, the nets. On the bottom of the schematic window, you can see a cross with a label 'gnd'. This is the ground connector, which means that the net which crosses this connector is the ground net. Nets will be assigned net numbers after the so-called netlisting process . This ground net will have the number 0.

Last but not least, the schematic window shows you two boxes : one is labeled 'params' , the other : 'ac-sim'.

The 'ac-sim' box is a box which must be placed into the schematic (on the top level of the hierarchy) when a small-signal simulation shall be run. The box, if present in a schematic, contains properties which tell the simulator details about the frequency range, sweep type, number of points and so on.

If you double-click the property box, the property editor will pop up and grants access to all properties (described later).

Please close the property editor ('Quit editprop') and double-click at the parameter box.   Again, the property editor will pop up , but now, you can see different properties: the properties of the parameter box.

Now, please double-click at all the other elements in the schematic to look at their values. If you are familiar with SPICE3 or HSPICE, you will know what they mean. For beginners, it will be hard to understand their meaning. If tha's you, please consult the on-line help (see chapter about online help on page [*]).

To motivate you to find how easy, useful and sweet this program is, let's do an AC-simulation within only one minute.

Please push the right mousebutton within the schematic diagram. What appears now is the main menu.

   


 
Figure 3.3: The main menu
\fbox{
\includegraphics{mainmenu.ps}
}

If another menu appears you probably have pushed a function key F1   ... F10. Please select 'leave' or press 'F1' to get the main menu the next time around.

   

If you have pushed two function keys after another (without popping down the first menu by selecting a menu item or pressing a mouse button outside the menu), you will not be able to remove the first menu by selecting a menu item or pressing a mouse button outside the menu. This happens if running SPICECAD on linux PCs. On a SUN SOLARIS 2.X machine, this effect is not observable. To remove 'dead' menus,   you need to push the function key of the corresponding menu you want to disappear. Then, the menu which appeared to be dead before, comes back to life alive again and can be popped down now. For example, if the main menu remains on the screen, push F1. After doing so, you can hide the menu conventionally by pushing a mouse button when the mouse cursor is placed outside the menu area.

Now, please press the right mouse button again.

First, select the 'simulation*' entry in the main menu or press 'F2' or 'ALT ' and '2' after another. Now, you are in the simulation menu level.

Press the right mouse button to make the simulation menu appear.

Click left towards the top of the first column and select runsim. This command creates a netlist, reads the netlist into SPICE3 and runs SPICE3. You will get a netlisting statistics in the xterm window where you started SPICECAD. You can read the netlist in a new terminal widow by selecting lookat netlist.

Now, select V(x) to select a net you want to plot.

Note that until now you probably always selected menu items using the left mouse button. And every time, the menu had disappeard afterwards. To keep the menu window on the screen, please click left in the menu's upper left corner, over the thumb tack. That frames the menu as a separate window which you can move around and iconify. Note: you can 'kill' that window using your window manager's menus. Do not 'destroy' it though because that kills the entire SPICECAD session!

Now, please move the cursor over the upper contact (red square) of the capacitor and press the left mousebutton. Note that the adjacent blue net turn yellow.

Select plot acm in the simulation menu.

If you did everything correctly, a result graphics window will pop up which shows you the transmission function of a simple RC lowpass.

When you look at the menu entry 'plot acm', the full entry is 'plot acm : ALT p'. This means that the function 'plot acm' can also be reached via hotkey 'ALT p'.  . So, please press ALT and 'p' (simultaneously or one right after the other). You will see that the plot window will be updated (very fast!, so please check if you think the window hasn't been updated) after pressing the keys. On certain computers (probably with mapped keyboards), this might not work, and you will get an error message like this:

key unknown : 65513 offset 0

This message means that the meta key 'ALT' is wrongly coded. Please read chapter 'Hotkeys and key redefinitions' on page [*] . It will tell you how to solve this problem.

Note that the first curve is black on white... If you plot more curves, their color sometimes will be nearly invisible on white background. This is machine-dependant. If you want to use other colors, please read the chapter about setting up SPICECAD using file 'setup.spi' (see chapter 'Customization' on page [*] ). If this does not satisfy you, another way to go is to change the background color   of the plot window from white to black (more contrast). The setup line in file 'setup.spi' is 'plotwindow_background_is_white yes'. If you set this variable to 'no', the background of the plot window will be black.

Now, move the mouse cursor over this window and push the right button. The menu of the plotwindow will pop up.

Select the 'loglog' entry (first column, towards the middle) and watch and enjoy.

Now , select 'exit' in the main menu (pop up simulation menu, select 'leave', pop up main menu, or press 'F1') .

I hope , your motivation to explore the features of SPICECAD has risen to tremendous heights.

In the next steps, you should edit the schematics 'second.scm' (cad -c second) , 'third.scm' ... until 'fifth.scm'.

In every schematic, you will find some new features.

'second': make a dc operating-point simulation and get the node voltages and device status using 'showdevice' and 'showvolt' in the simulation menu.

'third' and 'fourth': hierarchical editing. Push and pop through the hierarchy using 'edit' (hotkey 'e') and 'return' (hotkey 'a') in the symbol-menu (hotkey 'F4' or 'ALT 4')

'fifth': hierarchical editing with local variables. In 'third' and 'fourth' there were also used variables, but all variables were global. Here, we have the same block twice, but their local variable 'symfak' which determines the frequency behaviour is different in other blocks.

Note : variables are edited by selecting 'editprop' in the library menu or pushing 'g' as a direct hotkey. End of Note.

Perform an AC-analysis , select the output node of each block ('V(x)') , select 'plot acm' and look at the results.

'sixth': Import of external netlists.

The adder in the schematic is as object which is called 'other' (f_adder.oth). The adder has three nodes , two input and one output. If you look at the file 'f_adder.m' in the directory './sppar' , you see an arbitrary source which performs the addition:

.SUBCKT f_adder 1 2 3
B1 3 0 v=v(1)+v(2)
.ENDS f_adder

Now, look at the contents of the file 'f_adder.oth' in directory 'lib1'. There, you will find three objects of type 'contact' ( the red boxes) named IN1, IN2 and OUT.

That's all .

Peace of cake, isn't it? You can create 'other' objects semi-automatically by simply specifying the file name where SPICECAD shall read the connectivity information from. Please find a description about that in chapter 'Hierarchical design', on page [*].

'seventh': parametric sweep, monte carlo simulation and optimization.

Get into the 'parametric' menu (hotkey 'F9', 'ALT 9'). Select 'run paramsweep'. Select a node and watch the output.

Select 'run monte carlo' Select a node and watch the output.

Do a normal simulation ('runsim in the simulation menu '). Select the upper node of the capacitor twice. Plot the AC-result, it needs to look exactly as an RC-lowpass filter function always looks. Open the 'editpop'-window (hotkey 'g') and look at the starting parameters in the 'params'-box : 'res1' = 1.2 , 'cap1' = 0.8. Look at the goal-file 'seventh.goal'. There you get the picture of what the results should look like. Select 'run optim (grad)' and watch the optimizer on the result window doing its work.

Now, start the 'editprop'-dialog again and check the parameters in the 'params'-box. Both should be more equal to 1.0 than before.

'eighth': Simulating a transistor circuit. Use 'showdevice' and 'showvolt' and see what happens.

Now , give yourself a big pat on the back and reward yourself with a break. YOU DESERVE IT!

back? Okay, now, it's time to do your very own first schematic from scratch.

Leave SPICECAD.

Start SPICECAD again.

enter 'cad -c myfirstown'.

Don't worry about the error message. Close it by pressing the 'Confirm' button.

Now, get into the library menu ('F5' or 'ALT 5') and select a device you want to place.


  
Figure 3.4: Library menu
\fbox{
\includegraphics{libmenu.ps}
}

Place it and edit the properties in the property window which will pop up immediately after having placed the device.

 

If you think that will do it, connect the devices using 'create new net' or by pressing 'n'.

Note: The default net drawing style is 'vertical , then horizontal'. You can change this by pressing 'h' for 'horizontal, then vertical' and 'v' for 'vertical , then horizontal' again. To make net drawing easier, a snap function has been implemented. If you are in net drawing mode, please press 's' if you are near to a device terminal (contact) or net to wish to connect the current net to.   's' will search for the nearest possible connection, and SPICECAD will remain in net editing mode afterwards. If you press 'S' instead, a connection will be done, too, but SPICECAD will leave the net editing mode.

 

At the end , place at least one 'gnd'-symbol. The cross must be placed so that a net runs over the cross.

THIS IS AN ABSOULTE MUST!
Having no ground symbol in your circuit means that the whole circuit is floating. This would prevent spice3 from achieving convergence.

 

Now, save your schematic pressing 'CONTROL s' (for 'saveit' in the main menu). Don't worry about the error message, it always appears the first time you save a new design.

WARNING: don't forget to save from time to time.   It does not happen automatically , and there is only a limited UNDO function in SPICECAD (only 'delete' can be undone).
If you think that you might start an activity, i.e. stretching, which could fail, please save the schematic before beginning. Afterwards, you might need to finish SPICECAD without saving the spoiled schematic and start SPICECAD again using the saved schematic version .

Now, change into the simulation menu ('F2' ) and place an analysis box.   Placing analysis boxes is a little bit hidden in the simulation menu. When opening the simulation menu, the first entry is 'simulation flow'. This entry has been created for SPICECAD beginners. Selecting each menu entry one after another will automatically lead to a successful simulation.

Here are the steps:
'define Simulations'
'netlist file'
'lookat netlist'
'runsim'
'select v(x)'
'select i(x)'
'plot tran'
'plot acm'
etc.

'Define Simulations' is the starting point for another sub-menu which offers the previously mentioned simulation boxes. 'define Simulations' contains:
'options'
'params'
'projectnote'

Edit the parameters .

RUN SPICE.

Here, the introduction into the basic features ends.

If you have taken a look at all the schematics , you already know many of the features of this program. A number of other functions, however, could not be mentioned yet. They will be explained in the following chapters.



 
next up previous contents
Next: The 'mousecommand' window Up: SPICECAD The Schematic Entry Previous: Installation
Martin Maschmann
1999-10-10