#!nawk -f #**CFile*********************************************************************** # # FileName [ioBlifToMv.nawk] # # PackageName [io] # # Synopsis [A nawk script to convert a blif file into a blif-mv file.] # # Description [A nawk script to convert a blif file into a blif-mv file. # The blif file should be free of errors. The script ignores synthesis related # information.] # # SeeAlso [] # # Author [Rajeev K. Ranjan, Yuji Kukimoto] # # Copyright [Copyright (c) 1994-1996 The Regents of the Univ. of California. # All rights reserved. # # Permission is hereby granted, without written agreement and without license # or royalty fees, to use, copy, modify, and distribute this software and its # documentation for any purpose, provided that the above copyright notice and # the following two paragraphs appear in all copies of this software. # # IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR # DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT # OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF # CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND # FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN # "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE # MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.] # #*****************************************************************************/ BEGIN { subckt_counter = 0 while (my_getline()){ main() } if (flag){ print ".end" } } function main(){ while (1) { if ($1 == ".model"){ print while (last_char("\\")==1){ getline print } flag = 1; break } if ($1 == ".end"){ print flag = 0; break } if ($1 == ".inputs" || $1 == ".outputs"){ print while (last_char("\\")==1){ getline print } break } if ($1 == ".subckt"){ fieldCounter = 0; do{ last_char_back_slash = last_char("\\") gsub("\\\\","") for (i=1; i<=NF; i++){ fieldArray[fieldCounter] = $i; fieldCounter++; } if (last_char_back_slash) getline } while (last_char_back_slash) printf("%s %s %d ", fieldArray[0], fieldArray[1], subckt_counter) subckt_counter++; for (i=2; i