Wednesday, January 21, 2015

Setting Up a Custom PDK with LTspice

Hokay, so you've decided to take on RidgeTop and provide your own foundry IP.
You don't want to shell out $60k a year for a Cadence license, so you're going to cuts costs and use LTspice for your design.
How do you build a PDK that has all of the resistors and capcitors and FETs and BJTs?
Start with one - the FET.
You want a symbol that you can pass W, L and M (number of devices in parallel) to.
Why not just use a primitive (like these folks do)? Because, then you have to fill in AD,AS, PD info on a per-device basis. The approach detailed here gives a default setup for AD,AS, but is not user-friendly in that you don't get separate text fields to type your choice of W, L and m into. On the other hand, you will get the default values set up.

Summing up below steps : LTspice comes with a symbol for an nmos device. We use that symbol to create the symbol for a new subckt for our custom nmos and provide the subckt definition for it. The steps below are for one device and would need to be repeated for all PDK devices.

-1) Avoid pain by ensuring LTspice isn't installed in the Program Files directory - it can lead to headaches due to permissions if you follow below procedure..

0) Kudos to this page for giving me a good starting point.

1) You start with you subckt file, which should look something like this :
.subckt mynmos d g s b params: w=2u l= 0.6u m= 1
.param adl  = {expression for ad}
+      asl  = {expression for as}
+      pdl  = {expression for ..}
+      psl  = {expression for ..}
+      nrdl = {expression for ..}
+      nrsl = {expression for ..}
m1 d g s b modmynmos w={w} l={l} m={m} ad={adl} as={asl} pd={pdl+w} ps={psl+w} nrd={nrdl} nrs={nrsl}

So, you can see how the basic parameters are being used to construct AD, AS, etc and passed on to the model. Call the file mynmos.cir.

2) Take the existing nmos4 symbol (nmos4.asy) and make a copy of it - call it mynmos.asy (i.e., use LTspice to Save As to do this copy). Open that one in a text editor.

3) Open LTspice and use it to open mynmos.cir. Position the cursor on the word "mynmos" and right click and choose "Create Symbol". Say Ok on next confirmation dialog.

4) LTspice will create a symbol in the AutoGenerated folder under Sym. Open the file mynmos.asy in that directory in another notepad or editor window and view both files side by side (other one was created in (2) above).

5) Now, you can see that the lines of interest are these :
SymbolType ~~~
SYMATTR Value ~~~
SYMATTR Prefix ~~
SYMATTR Description ~~~~
SYMATTR ModelFile  ~~~~
SYMATTR SpiceLine  ~~~~
PINATTR PinName ~~

Basically, all that's useful from the copy you made is the graphical content.

6) Use the AutoGenerated symbol file as a reference and paste/type into the Copy you made in (2) to get
SymbolType BLOCK
SYMATTR Prefix X
and so on.

7) User experience is enhanced if the number of parallel devices "m= 1" is available to the user in a separate text field, so make your file look like this :
SYMATTR SpiceLine w= 2u l= 0.6u
SYMATTR SpiceLine2 m= 1

8) In your LTspice installation directory, create MyFAB directories in the lib/sym and lib/sub directories. In the sub directory, you'll put the model file MyFAB.lib (or whatever) and the mynmos.cir subckt file. In the sym directory, you'll put the final .asy file.

9) When you build a schematic with this component, you need to have a ".INCLUDE MyFAB/MyFAB.lib" spice directive


No comments: