prog_linenum

2021年6月22日 星期二

LVL Shell Script 分享

寫shell script必須要先了解LVL的語法內容才有辦法,知道應該要如何來達到我們要的效果,所以必須先看上一篇LVL command file 範例。

廢話不多說,以下先分享shell script範例,再做解說。

LVL Shell Script Example.

#! /bin/bash
##script name: genLVL.sh
##description:
##    This script is used to make LVL rule file.
##Author: ron.huang
##History:
##    2021/06/22 ron.huang release

##usage:
##    1.Please modify the layer map to the following format first.
##    2.Modify customized region
##    3.Run script ex.    ./genLVL.sh

##customized region
LAYERMAP=layermap
LVLFILE=lvl.cal

## Do not modify below
getLayerNames=$(cat $LAYERMAP | awk '{print $1}');
getPurpuseNames=$(cat $LAYERMAP | awk '{print $2}');
getLayerNumbers=$(cat $LAYERMAP | awk '{print $3}');
getDatatypeNumbers=$(cat $LAYERMAP | awk '{print $4}');

seq=1
for layerName in $getLayerNames;
do
    layerNames[$seq]=$layerName
    ((seq++))
done

seq=1
for purpuseName in $getPurpuseNames;
do
    purpuseNames[$seq]=$purpuseName
    ((seq++))
done

seq=1
for layerNumber in $getLayerNumbers;
do
    layerNumbers[$seq]=$layerNumber
    ((seq++))
done

seq=1
for datatypeNumber in $getDatatypeNumbers;
do
    datatypeNumbers[$seq]=$datatypeNumber
    ((seq++))
done

echo "//$LVLFILE" > $LVLFILE
echo '//description: Compare the differences between the two gds.' >> $LVLFILE
echo "//use genLVL.sh to generate at $(date '+%Y/%m/%d %H:%M')" >> $LVLFILE
echo "//History:" >> $LVLFILE
echo ' ' >> $LVLFILE
echo '//SPECIFY FIRST DATABASE' >> $LVLFILE
echo 'LAYOUT PRIMARY "TOP_CELL_NAME"' >> $LVLFILE
echo 'LAYOUT PATH "top.gds"' >> $LVLFILE
echo 'LAYOUT SYSTEM GDSII' >> $LVLFILE
echo ' ' >> $LVLFILE
echo '//SPECIFY SECOND DATABASE' >> $LVLFILE
echo 'LAYOUT PRIMARY2 "TOP_CELL_NAME2"' >> $LVLFILE
echo 'LAYOUT PATH2 "top2.gds"' >> $LVLFILE
echo 'LAYOUT SYSTEM2 GDSII' >> $LVLFILE
echo 'LAYOUT BUMP2 1000    // add 1000 to layer number for the second database' >> $LVLFILE
echo ' ' >> $LVLFILE
echo '//OUTPUT REPORT' >> $LVLFILE
echo 'DRC RESULTS DATABASE "top.lvl.db" ASCII' >> $LVLFILE
echo 'DRC SUMMARY REPORT "top.lvl.rep"' >> $LVLFILE
echo ' ' >> $LVLFILE
echo 'DRC MAXIMUM RESULTS ALL' >> $LVLFILE
echo 'PRECISION        1000' >> $LVLFILE
echo 'RESOLUTION    1' >> $LVLFILE
echo ' ' >> $LVLFILE
echo '//LAYER COMPARE' >> $LVLFILE

for ((i=1;i<=${#layerNames[@]};i++));
do
    LD=$((i+2000))
    echo "LAYER ${layerNames[$i]}_${purpuseNames[$i]}     $LD LAYER MAP ${layerNumbers[$i]} DATATYPE ${datatypeNumbers[$i]} $LD" >> $LVLFILE
    LD2=$((LD+1000))
    LN2=$((${layerNumbers[$i]}+1000))
    echo "LAYER ${layerNames[$i]}_${purpuseNames[$i]}_Sec $LD2 LAYER MAP $LN2 DATATYPE ${datatypeNumbers[$i]} $LD2" >> $LVLFILE
    echo "DIFF.${layerNames[$i]}.${purpuseNames[$i]} {@ ${layerNames[$i]}:${purpuseNames[$i]}[${layerNumbers[$i]}:${datatypeNumbers[$i]}] is different from the ${layerNames[$i]}:${purpuseNames[$i]}[${layerNumbers[$i]}:${datatypeNumbers[$i]}] of another GDS" >> $LVLFILE
    echo "${layerNames[$i]}_${purpuseNames[$i]} XOR ${layerNames[$i]}_${purpuseNames[$i]}_Sec" >> $LVLFILE
    echo "}" >> $LVLFILE
done

以下為範例詳解













沒有留言:

張貼留言