[ Shell ] 通过 Shell 脚本导出 CDL 网表

本文介绍了如何通过Shell脚本来自动化导出Virtuoso中的CDL(Circuit Description Language)网表。文章详细讲解了运行Si的步骤,包括si.env文件的配置,以及编写export_cdl.sh脚本实现命令行参数分析、参数检查、si.env文件生成和运行实例。脚本帮助用户便捷地导出指定电路单元的CDL文件。
摘要由CSDN通过智能技术生成

Python微信订餐小程序课程视频

https://edu.csdn.net/course/detail/36074

Python实战量化交易理财系统

https://edu.csdn.net/course/detail/35475
https://blog.csdn.net/yeungchie/

通过 si 导出电路网表,实际上在 Virtuoso 中通过菜单 File - Export - CDL 和 Calibre LVS 中 Export from schematic viewer 也是通过 si 来导出电路网表的,下面讲下如何使用。

如何运行 si

下面是 si 的运行命令, $cdslibFile 为 cds.lib 文件。

复制代码
  • 1

bashsi -batch -command netlist -cdslib $cdslibFile

si.env 文件

在 si 的运行路径下需要提前准备好一个 si.env 文件,si 通过读取这个文件的内容来配置导出 cdl 所需要的信息。

文件的如何编写可以参考 help 文档:

  • Virtuoso Shared Tools
    • Design Data Translators Reference
      • Design Translation Using CDL Out
        • Using CDL Out
          • Preparing the si.env File

简单看看就行,我一般是直接通过 GUI 界面尝试导出一份 cdl,然后在运行路径下会有一份 si.env 文件,下面是一个例子:

点击查看完整代码

复制代码
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34

lispsimLibName = "stdcel" simCellName = "TOP" simViewName = "schematic" simSimulator = "auCdl" simNotIncremental = 't simReNetlistAll = nil simViewList = '("auCdl" "cdl" "schematic" "cmos\_sch" "gate\_sch" "cmos.sch" "gate.sch" "symbol") simStopList = '("auCdl" "cdl") hnlNetlistFileName = "TOP.cdl" resistorModel = "" shortRES = 2000.0 preserveRES = 't checkRESVAL = 't checkRESSIZE = 'nil preserveCAP = 't checkCAPVAL = 't checkCAPAREA = 'nil preserveDIO = 't checkDIOAREA = 't checkDIOPERI = 't checkCAPPERI = 'nil simPrintInhConnAttributes = 'nil checkScale = "meter" checkLDD = 'nil pinMAP = 'nil preserveBangInNetlist = 'nil shrinkFACTOR = 0.0 globalPowerSig = "" globalGndSig = "" displayPININFO = 't preserveALL = 't setEQUIV = "" incFILE = "./Subcircuit/3t\_device.cdl" auCdlDefNetlistProc = "ansCdlHnlPrintInst"

这个例子中导出的顶层电路单元是 stdcel/TOP/schematic,我们只关心其中几个常用的变量:

  • simLibName ( Library Name ) stdcel
  • simCellName ( Top Cell Name ) TOP
  • simViewName ( View Name ) schematic
  • hnlNetlistFileName ( Output CDL Netlist File )
  • incFILE ( Include File )
  • auCdlDefNetlistProc ( Analog Netlisting Type ) 这个变量决定 pin 的连接方式
    • ansCdlSubcktCall ( Connection By Order ) 顺序连接
    • ansCdlHnlPrintInst ( Connection By Name ) 命名端口连接,一般选择这个来保证 IP/Digital 网表的连接

Run Directory 直接由 si 的运行路径来决定。

编写脚本 export_cdl

明白了 si 的使用方法,现在可以写一个 shell 脚本,在 Terminal 操作,实现便捷地导出指定电路单元的 cdl 文件。

点击查看完整代码

复制代码
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141

bash`#!/bin/bash
#--------------------------

Program : export_cdl.sh

Language : Bash

Author : YEUNGCHIE

Version : 2022.04.03

#--------------------------
HelpInfo(){
cat <<EOF

Export CDL ( Circuit Description Language ) File

Usage: export_cdl -cdslib cdslibFile -lib libName -cell cellName [ OPTIONS ]

-cdslib Path of cds.lib file
-lib Schematic top cell libName
-cell Schematic top cell cellName
-view Schematic top cell viewName ( Default: schematic )
-file Output netlist file name ( Default: ./.cdl )
-include Include subckt file name
-order Netlisting Type Connection By Order ( The default is By Name )
-h, --help Display this help

Examples: export_cdl -cdslib ./cds.lib -lib Xeon -cell X999 -include ./subckt.cdl

Output: Netlist file: X999.cdl
EOF
}

viewName=‘schematic’
connType=‘ansCdlHnlPrintInst’

命令行参数分析

while [[ -n $1 ]]; do
if [[ -n $opt ]]; then
case $opt in
lib_opt) libName=$1 ;;
cell_opt) cellName=$1 ;;
view_opt) viewName=$1 ;;
file_opt) netlistFile=$1 ;;
cdslib_opt) cdslibFile=$1 ;;
include_opt) includeFile=$1 ;;
esac
unset opt
else
case $1 in
-lib) opt=‘lib_opt’ ;;
-cell) opt=‘cell_opt’ ;;
-view) opt=‘view_opt’ ;;
-file) opt=‘file_opt’ ;;
-cdslib) opt=‘cdslib_opt’ ;;
-include) opt=‘include_opt’ ;;
-order)
connType=‘ansCdlSubcktCall’
;;
-h|–help)
HelpDoc >&2
exit 1
;;
*)
echo “Invalid option - ‘$1’” >&2
echo “Try -h or --help for more infomation.” >&2
exit 1
;;
esac
fi
shift
done

参数检查

if [[ ! ( $cdslibFile && $libName && $cellName ) ]]; then

缺少必要参数时,打印 help 并退出

HelpInfo >&2
exit 1
elif [[ -f $cdslibFile ]]; then

将相对路径改为绝对路径

cdslibDir=$(cd $(dirname

  • 0
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

[虚幻私塾】

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值