1/* 2 * Author: William Chia-Wei Cheng (bill.cheng@acm.org) 3 * 4 * @(#)$Header: /mm2/home/cvs/bc-src/tgif/spice/README,v 1.1 2004/06/18 23:19:38 william Exp $ 5 */ 6 7This file is README in the spice subdirectory of the tgif distribution. 8 9Here are some notes on the ports and components feature of tgif. These 10features first appeared in tgif-4.1.35 and only works with the updated 11files in the spice subdirectory that was in the tgif-4.1.35 release. 12Also, please make sure you are running tgif-4.1.38 or newer since there 13have been bug fixed! 14 15Please read the CONNECTING OBJECTS section of the tgif man pages in 16addition to this note. 17 18tgif demo.obj 19 Select NET as the export format 20 Select Print() from the File Menu 21 demo.net is the netlist file... 22 Any port that's connected to the same signal name are 23 considered "connected" 24 For example, the signal name "BASE" is connected to 2 ports, 25 "!R2!b" and "!Q2!b" (refer to the figure). R2 is a 26 resistor and it has 2 ports, a and b. Q2 is a transistor 27 of model type SN. It has 3 ports, c, b, and e (for 28 collector, base, and emitter). The connection is between 29 port b of R2 and port b (base) of Q2. 30 demo.cmp is the component file... 31 The beginning of each component is not indented. 32 The first line of a component declares the component and 33 has the format: 34 <name>: <type> 35 <name> corresponds to the "name" attribute of the component. 36 <type> corresponds to the "type" attribute of the component. 37 All other attributes of the component are listed (indented 38 by a <TAB> character) following the first line. 39 Note that the ports of a component are not listed. 40 For example, if you right click on the Q1 transistor and select 41 the Edit Attribute In Editor submenu of the Context Menu, 42 you can see all the attributes of this component. 43 Manipulating the connection... 44 Select the wire named "VIN" and delete it. If you print the NetList, 45 you will see that both the .net and the .cmp files are not changed! 46 As I've said, this is a poorman's implemention of ports & connections. 47 What happens is that port "a" of VIN has an attribute called 48 "signal_name" whose value is still "VIN". Similarly, port "a" 49 of R2 also has an attribute called "signal_name" whose value is 50 still "VIN". When the wire is deleted, these ports don't know 51 that their signalnames need to be cleared! Oh well... So, the 52 truth is, there's really no "connection semantics" implemented 53 in tgif. 54 To clear them, select Clear Signal Name for a Port from the 55 Ports and Signals submenu of the Special Menu. Mouse over a 56 port (the port will be highlighted) and click the left mouse 57 button. This will clear the signal_name attribute of the port. 58 Keep finding ports you want to clear... When you are done with 59 all the ports you want to clear, click the right mouse button. 60 Go ahead and clear port "a" of VIN and port "a" of R2. The 61 port should look different. 62 To make a connection (which is just setting signal_name attributes 63 of ports), there are 2 ways. One is to select Rename Signal 64 Name for a Port from the Ports and Signals submenu of the Special 65 Menu. This is very similiar to clearing signalnames. Let's not 66 do this. The 2nd way is to select Connect Two Ports by a Wire 67 from the Ports and Signals submenu of the Special Menu. You 68 must click on 2 ports. At the end, it will prompt you for a 69 signal name. Then it will ask you to place it. You can uncheck 70 Show Wire Signal Name of the Ports and Signals submenu of the 71 Special Menu if you don't want to see the signalname for the 72 (useless) wire. 73 How to constructor a component? 74 Well, this is kind of involved... I'll just mention a few major 75 points. 76 1) A component must be instantiated from a .sym file. So, you should 77 build a symbol. To build the symbol, start with an empty file. 78 First draw what it should look like. Don't add any attributes 79 or ports yet. When you are done with the visual port of the 80 symbol, select everything and select Group from the Arrange Menu. 81 2) Before you create the symbol object, you should add ports and 82 attributes: 83 a) For each port you need, instantiate "port.sym" from this 84 directory. Right click on it and select the "name=" attribute 85 from the Edit Attribute In Editor submenu of the Context Menu 86 and enter the port name. 87 b) For each attribute you need, create it simply as a text object. 88 A component must have attributes named "name" and "type". 89 Make sure you have created "name=" and "type=<sometype>" text 90 objects (replace <sometype> with the actual type of the 91 component). 92 3) Select all the text object and the visual part of the symbol, 93 select Attach Attributes from the Attribute submenu of the 94 Special Menu. Select Hide Attributes from the Attribute submenu 95 of the Special Menu. 96 4) Move all the ports to the right places. Select Select All from 97 the Edit Menu and selct Group from the Arrange Menu. Finally, 98 select Make Symbolic from the Special Menu and save the file as 99 <something>.sym. 100