# ASAP PDK Virtuoso 環境變數設定
###### tags: `CIA`
## 使用 Server 登入
注意:測試適用 Gogoro2 或是 Bugatti 才可以登入,其他會有 `cannot open shared object file` 的問題。
1. 登入 Server ,如果用 iOs terminal 要額外設定 `XQartz` 程式,協助開啟視窗。

這裡用 Gogoro2 當示範
## 設定環境變數
1. 打開 `.tcshrc` 檔案,將下列的環境變數設定好。
```
setenv CALIBRE_HOME /usr/cad/mentor/calibre/cur
setenv OA_UNSUPPORTED_PLAT linux_rhel40_gcc44x
# liberate keep waiting for available license
setenv ALTOS_QUEUE 1
# HSPICE waiting for license
setenv META_QUEUE 1
setenv LD_LIBRARY_PATH /usr/cad/synopsys/verdi/2018.09/share/PLI/VCS/LINUX64/novas.tab
setenv VCS_LINK_PATH /usr/cad/synopsys/verdi/2018.09/share/PLI/VCS/LINUX64/pli.a
source /usr/cad/cadence/CIC/ic_06.15.151.cshrc
source /usr/cad/mentor/CIC/calibre.cshrc
source /usr/cad/synopsys/CIC/synthesis.cshrc
source /usr/cad/cadence/CIC/xcelium.cshrc
source /usr/cad/synopsys/CIC/verdi64.cshrc
setenv OA_UNSUPPORTED_PLAT linux_rhel40_gcc44x
setenv PDK_DIR /home/yarou/ASAP7_PDKandLIB/ASAP7_PDKandLIB_v1p6/asap7PDK_r1p6
source /usr/cad/synopsys/CIC/customexplorer.cshrc
setenv CALIBRE_HOME /usr/cad/mentor/calibre/cur
setenv LD_LIBRARY_PATH /usr/cad/synopsys/verdi/2020.12-sp2/share/PLI/IUS/LINUX64/boot
```
這裡使用 [ASAP PDK](http://asap.asu.edu/asap/),所以 `PDK_DIR` 要用 ASAP PDK 資料夾的位置
## 設定 ASAP PDK 環境變數
1. 照著他給的 README 操作一次
```
*--------------------------
* PDK Usage Instructions
*--------------------------
* Instructions to the administrator/course instructor for setting up the
* PDK
*--------------------------------------------------------------------------
1. Untar the PDK archive 'asap7PDK_r1p6.tar.bz2' (where 1p6 is the PDK
version number) by using the following command:
tar -xvjf asap7PDK_r1p6.tar.bz2
2. Copy the untarred PDK 'asap7PDK_r1p6' to an install area.
3. Change the environment variable value $PDK_DIR in the following files by
replacing the string 'PDKDirectory' with the absolute path to the PDK
directory (including the PDK directory name):
./cdslib/setup/set_pdk_path.csh
* Instructions to the end-user for setting up a local PDK run directory
*--------------------------------------------------------------------------
NOTE: Ask your course instructor/administrator for the path where the
ASAP7 PDK is located. This path must replace any occurrence
of the string 'PDKDirectory' so as to become the value for the
environmental variable 'PDK_DIR' that you will need to use below for setting
up the local PDK run directory.
NOTE: Once the local PDK run directory has been setup, a user will only
need to repeat steps 4. and 5. to start Virtuoso.
1. Create a local directory, whence you intend to run the PDK, under
your home directory. This can be accomplished by using the following
command for instance:
cd ; mkdir asap7_rundir
2. Set the environmental variable PDK_DIR using the following command, so
that it points to the ASAP7 PDK directory:
setenv PDK_DIR PDKDirectory
3. Go to the run directory created in the above step. Then use the
following command :
source $PDK_DIR/cdslib/setup/setup_asap7.csh
NOTE: Source the aforementioned script just once when first setting up
the local directory. You will not need to source this again when
starting Virtuoso. If you do, then your old 'cds.lib' file will be
replaced with a new one and all the user-defined libraries will be
removed--which you will then need to define again.
Sourcing this script will copy all the necessary files and directories,
such the Calibre directories and SVRF rule files, HSpice models, cds.lib,
.cdsinit, .cdsenv, and set_pdk_path.csh file, required to use the PDK, into your
run directory.
For the ease of viewing of layers associated with a particular DRC when
highlighting the DRC through Calibre RVE, add the following line to your
startup script:
setenv MGC_RVE_CTO_FILE $PWD/rve_vis_asap7.cto
4. Ensure that you are in the PDK run directory created in step 1.
Also, ensure that you have sourced any startup scripts required for the
various Cadence, Mentor Graphics, and Synopsys tools.
Then type the following command.
source set_pdk_path.csh
Note that the above file also contains the environmental variables to
specify the metal grids offsets from either X or Y axis, depending on the
metal routing direction. The default offset value is 0 nm. To offset a
particular grid by 'p' nm, specify the variable value as p*10. Thus, for an
offset of 24 nm, the corresponding variable value is 240.
5. Start Virtuoso by typing:
virtuoso &
*--------------------------------------------------------------------------
NOTES
*--------------------------------------------------------------------------
1. Well and substrate (p_sub) pins may be used as well/substrate tap
substitutes for convenience when executing layout versus schematic (LVS)
check at standard cell level. This requires connecting the pins 'VDD' and
'VSS' by name through the use of LVS options. However, instead of
employing these pins, physical substrate and well taps must be used at
stipulated distances for latchup prevention when executing LVS at upper
levels of a design hierarchy.
2. The Calibre parasitic extraction deck and runset provided with the PDK
are meant for use with Calibre xACT 3D.
```
## 使用 Virtuoso 開啟 ASAP
1. 目錄頁面輸入指令 `tcsh`

2. 依據 ASAP 的步驟設定環境

3. 打開 Virtuoso

## 使用其他 PDK 之設定
上述主要用 ASAP PDK 7nm 進行,如果要用其他 PDK 的話,這裡提供參考 nangate 設定方法。
1. 登入 Server (跟上述設定相同)
2. 偷吃步到學長( ral 開頭的那個)的資料夾把需要的檔案複製到你的目錄端
檔案:` .cshrc ` `.tcshrc`
資料夾:`source_path` `virtuosoFile`
3. 將 `source_path/env.sh` 路徑設定到你的複製資料夾後,頁面輸入指令 `tcsh`
4. 就可以開啟 `virtuoso` 視窗了
# DRC 設置
[參考](https://picture.iczhiku.com/resource/eetop/shiHQReeGWRAfbmN.pdf)