python批量生成nc run仿真脚本

         使用hspice仿真all corner时,由于corner,temp,Res,load和Cap的多种组合,会有产生多行命令,可以使用python批量生成脚本。

##!#bin/python

######setting######
outpath='E:\\python_work\\corner\\run.txt'
head=['!#bin/bash']+['****nc run ****']
corner=['tt','ss','ff','sf','fs']
slew  =['maxRes','typRes','minRes']
load  =['maxCload','typCload','minCload']
######creat content######
name  =[x+'_'+y+'_'+z for x in corner  for y in slew for z in load]
name_l=[str(i)+name[i] for i in range(len(name))]
lines =['nc run hspice -meas  '+i+'.meas'+'\t'+i+'.fsdb' for i in name_l]
#print(lines)
contents='\n'.join(head+lines)
f1=open(outpath,'w')
f1.write(contents)
f1.close()

最后生成的bash文件如下:

python批量生成nc run仿真脚本_第1张图片

 

你可能感兴趣的:(python,linux)