FreePDK45:Recompiling the FreePDK

From NCSU EDA Wiki

Jump to: navigation, search

Introduction

One of the main difficulties of using the FreePDK is that versions of Virtuoso change, requiring an updated version of PyCell in order to be able to use the FreePDK P-Cells. In the past, we haven't always been able to release new versions of the FreePDK in a timely manner to keep up with the changing versions of Virtuoso and PyCell. If you find yourself in this situation, then you may be able to get the P-Cells working with a simple re-compiliation of the techfile. The steps below will tell you how to do that.

Recompilation Instructions

Most of the effort in recompiling the kit is involved in setting up your environment and installation to run the gentech.py script. Follow these steps to make the necessary modifications.

  1. Modify the file $PDK_DIR/ncsu_basekit/gentech/sshaft/setup.csh - The first change to make to this file is to change the PDK_DIR environment variable to match your installation path. The second change to to add the setup for Python, which will be used to run the compilaiton script. Note that there is a section of this file labeled "Setup Python 2.4". From this point to the end of the script, the environment is being setup to run Python. It's somewhat confusing, because there are many competing versions of Python on our computer system. You may safely delete all of this and replace it with a setup that works for you (or simply remove it, if you already have Python 2.4 or later in your environment). Note that there is a MUSE_HOME environment variable that is also defined, but this variable is used only in the Python setup and can be safely ignored.
  2. Modify the file $PDK_DIR/ncsu_basekit/gentech/sshaft/src/py/Makefile - The first line of this file defines a variable SCRIPTPATH, which should be set to the path of your Python binary executable file.
  3. Type "make" in this directory - This will copy each file to the ../../bin directory, add the Python path to the first line of each script in this directory, and set it's mode to executable.
  4. Update the Virtuoso/PyCell Setup Script - Next you will need to create a new setup script that adds both Cadence Virtuoso and CiraNova PyCell studio to your environment at the same time. Neither Cadence not CiraNova will show you how to do this. An example script is given in the file $PDK_DIR/ncsu_basekit/cdssetup/icoa_setup.csh. Modify this file, source it, and verify that you can start both virtuoso (e.g. "virtuoso &") and PyCell studio (e.g. "pyros &").
  5. Modify the file $PDK_DIR/ncsu_basekit/gentech/sshaft/lib/py/setup.py - This file contains environment settings for various tools. We will now create the entries for this file to match your new Virtuoso/PyCell setup script. To do that, follow these steps:
    1. Login to a new shell with a clean environment. The commands here assume that you're using a csh-style shell.
    2. Type "printenv > env1"
    3. Source your new Virtuoso/PyCell setup script
    4. Type "printenv > env2"
    5. Source the $PDK_DIR/ncsu_basekit/gentech/sshaft/setup.csh script
    6. Type "envparse.py env1 env2 setup.txt". This will parse the differences between the env1 and env2 files and put the result in the file setup.txt.
    7. Insert the contents of the setup.txt file into the $PDK_DIR/ncsu_basekit/gentech/sshaft/lib/py/setup.py file, as shown below.
...
Env = {
  'cadence':{
(insert contents of setup.txt here, deleting the previous contents)
  },
  'synopsys':{
...

Finally you're ready to run gentech.py. Change to the directory $PDK_DIR/ncsu_basekit/gentech and source the sshaft/setup.csh script (if you haven't already, in the previous step). Then execute the command "gentech.py -log gen.log". The "-log" argument is mandatory. It won't work properly without it.

Assuming that all goes well, you should see the new technology library is compiled. One key way to note success is that the file $PDK_DIR/ncsu_basekit/lib/NCSU_TechLib_FreePDK45/tech.db should exist. Also, the gen.log file should look similar to the following:

Begin gentech.py
Executing: cngenlib -c --techfile /afs/eos.ncsu.edu/lockers/research/ece/wdavis/
users/wdavis/svn/freepdk45/trunk/ncsu_basekit/techfile/cni/Santana.tech pkg:pyce
lls  NCSU_TechLib_FreePDK45 /afs/eos.ncsu.edu/lockers/research/ece/wdavis/users/
wdavis/svn/freepdk45/trunk/ncsu_basekit/lib/NCSU_TechLib_FreePDK45 >& cngenlib.l
og
Creating run/cds/.cdsinit
Creating run/cds/cds.lib
Creating run/cds/lib.defs
Chdir run/cds
Writing command to exe.il: pdkAppendTechfile( ?stepargs list( "../../gen.log" t
5 1 "low"))
Executing: virtuoso -log CDS.log -nograph -replay exe.il
        Begin pdkAppendTechfile
        Loading "/afs/eos.ncsu.edu/lockers/research/ece/wdavis/users/wdavis/svn/
freepdk45/trunk/ncsu_basekit/techfile/FreePDK45.tf" into "/afs/eos.ncsu.edu/lock
ers/research/ece/wdavis/users/wdavis/svn/freepdk45/trunk/ncsu_basekit/lib/NCSU_T
echLib_FreePDK45"...
        Techfile successfully appended.
        Finished pdkAppendTechfile (elapsed time: 0h 0m 1s actual)
Step returned with value None
Chdir ../..
Executing: cp -r /afs/eos.ncsu.edu/lockers/research/ece/wdavis/users/wdavis/svn/
freepdk45/trunk/ncsu_basekit/techfile/customvia/* /afs/eos.ncsu.edu/lockers/rese
arch/ece/wdavis/users/wdavis/svn/freepdk45/trunk/ncsu_basekit/lib/NCSU_TechLib_F
reePDK45
Finished gentech.py (elapsed time: 0h 1m 14s actual)

Debugging the compilation

If something goes wrong, the first place to look is the gen.log file. This file will hopefully show the step where the error occurred and give you the name of the file to examine. If not, then the file will also show you the names of all log files generated during the compilation process. We may ask you to send us some of these files to help debug the problem.

The most common problem that occurs is that CiraNova makes a slight modification to the PyCell API, which requires some small change to the P-Cell code. We can help debug that change, but in order to do it, we will most likely need the contents of the file cngenlib.log.

Good luck! Please let us know if you have problems! Send e-mail requests to eda_help@ncsu.edu.

Personal tools