#!/usr/bin/perl ########################################################### # Created by Mike Lodder Fall 2006 # # Converts a Spectre generated file to # a format that can be read by Signal Storm # # Emotional support by Dan Pitts ########################################################### die("Syntax Error: $0 file-selector fname [destfname]\n") if (scalar @ARGV < 1); push(@ARGV, $ARGV[0].".new") if (scalar @ARGV < 2); my $fname = $ARGV[0]; my $buf; my $read=0; sub parse_vdd { $_=~s/vdd\!/vdd/gos; } sub parse_extr { $_=~s/\_analog\_extracted//gos; } sub parse_gnd { s/[ \t]0/ gnd/gos; s/\(0/\(gnd/gos; s/0\)/gnd\)/gos; } open(FILE, $fname) or die("ERROR: could not open $fname"); while() { if($_ =~ /\(/) { &parse_gnd; } if($_=~/subckt/) { if(!($_=~/subckts/)) { $read=1; &parse_vdd; &parse_extr; chomp($_); $_.=" vdd gnd\n"; $buf.=$_; } } elsif($_=~/ends/) { $read=0; &parse_vdd; $buf.=$_; } elsif($read == 1) { &parse_vdd; $buf.=$_; } else { next; } } close(FILE); open(NEWFILE, ">$ARGV[1]") or die("ERROR: could not open $ARGV[1]"); print NEWFILE "simulator lang=spectre\n\n"; print NEWFILE $buf; close(NEWFILE); exit (0);