load_delay.pl,v #1

  • //
  • guest/
  • robert_yu/
  • autochar-1.5.3/
  • src/
  • RCS/
  • load_delay.pl,v
  • View
  • Commits
  • Open Download .zip Download (49 KB)
head	1.38;
access;
symbols;
locks; strict;
comment	@# @;


1.38
date	99.06.07.15.02.39;	author ryu;	state Exp;
branches;
next	1.37;

1.37
date	99.01.26.18.22.22;	author ryu;	state Exp;
branches;
next	1.36;

1.36
date	99.01.20.11.56.24;	author ryu;	state Exp;
branches;
next	1.35;

1.35
date	99.01.20.07.44.59;	author ryu;	state Exp;
branches;
next	1.34;

1.34
date	99.01.14.10.19.02;	author ryu;	state Exp;
branches;
next	1.33;

1.33
date	99.01.13.07.18.42;	author ryu;	state Exp;
branches;
next	1.32;

1.32
date	98.09.12.19.54.02;	author ryu;	state Exp;
branches;
next	1.31;

1.31
date	98.09.11.06.19.45;	author ryu;	state Exp;
branches;
next	1.30;

1.30
date	98.09.08.13.16.49;	author ryu;	state Exp;
branches;
next	1.29;

1.29
date	98.09.06.20.43.23;	author ryu;	state Exp;
branches;
next	1.28;

1.28
date	98.09.05.22.10.32;	author ryu;	state Exp;
branches;
next	1.27;

1.27
date	98.09.03.06.09.52;	author ryu;	state Exp;
branches;
next	1.26;

1.26
date	98.09.01.04.49.20;	author ryu;	state Exp;
branches;
next	1.25;

1.25
date	98.08.30.19.24.00;	author ryu;	state Exp;
branches;
next	1.24;

1.24
date	98.08.29.20.01.15;	author ryu;	state Exp;
branches;
next	1.23;

1.23
date	98.08.29.19.50.27;	author ryu;	state Exp;
branches;
next	1.22;

1.22
date	98.08.29.17.23.56;	author ryu;	state Exp;
branches;
next	1.21;

1.21
date	98.08.28.09.58.27;	author ryu;	state Exp;
branches;
next	1.20;

1.20
date	98.08.28.09.52.33;	author ryu;	state Exp;
branches;
next	1.19;

1.19
date	98.08.26.09.35.38;	author ryu;	state Exp;
branches;
next	1.18;

1.18
date	98.08.24.06.16.21;	author ryu;	state Exp;
branches;
next	1.17;

1.17
date	98.08.24.00.48.34;	author ryu;	state Exp;
branches;
next	1.16;

1.16
date	98.08.23.22.11.24;	author ryu;	state Exp;
branches;
next	1.15;

1.15
date	98.08.23.21.59.07;	author ryu;	state Exp;
branches;
next	1.14;

1.14
date	98.08.23.12.22.09;	author ryu;	state Exp;
branches;
next	1.13;

1.13
date	98.08.23.12.03.44;	author ryu;	state Exp;
branches;
next	1.12;

1.12
date	98.08.23.10.13.45;	author ryu;	state Exp;
branches;
next	1.11;

1.11
date	98.08.23.09.54.17;	author ryu;	state Exp;
branches;
next	1.10;

1.10
date	98.08.23.06.56.57;	author ryu;	state Exp;
branches;
next	1.9;

1.9
date	98.08.18.09.33.00;	author ryu;	state Exp;
branches;
next	1.8;

1.8
date	98.08.17.02.41.17;	author ryu;	state Exp;
branches;
next	1.7;

1.7
date	98.08.16.13.37.40;	author ryu;	state Exp;
branches;
next	1.6;

1.6
date	98.08.15.21.23.36;	author ryu;	state Exp;
branches;
next	1.5;

1.5
date	98.08.15.21.21.23;	author ryu;	state Exp;
branches;
next	1.4;

1.4
date	98.08.15.10.11.18;	author ryu;	state Exp;
branches;
next	1.3;

1.3
date	98.08.13.09.08.03;	author ryu;	state Exp;
branches;
next	1.2;

1.2
date	98.08.13.08.21.40;	author ryu;	state Exp;
branches;
next	1.1;

1.1
date	98.08.13.07.17.04;	author ryu;	state Exp;
branches;
next	;


desc
@#! /usr/local/bin/perl
@


1.38
log
@Optional space in measure results
@
text
@#	$Id: load_delay.pl,v 1.37 1999/01/26 18:22:22 ryu Exp ryu $

#	Copyright (C) 1999 Robert K. Yu
#	email: robert@@yu.org

#	This file is part of Autochar.

#	Autochar is free software; you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation; either version 2, or (at your option)
#	any later version.

#	Autochar is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.

#	You should have received a copy of the GNU General Public License
#	along with Autochar; see the file COPYING.  If not, write to the
#	Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#	Boston, MA 02111-1307, USA.

#
#   ld_run --
#	Top-level function to load delay characterization.
#	Generate the spice netlists, run hspice, and extract
#	data.
#
sub ld_run {

    local($type, $in, $out, $tie, @@tie_list) = @@_;
    local($run_name);

    $run_name = &run_file_name($cellname, $in, $out, 'ld');
    open(SPICEIN,">$run_name") || die "ERROR:  Cannot open file '$run_name'.";

    # Create the hspice netlist(s)
    &print_header(SPICEIN, '*');
    printf SPICEIN "*	Char:	Load Delay Characterization\n";
    printf SPICEIN "*	Type:	\"$type\"\n";
    printf SPICEIN "*	Input:	\"$in\"\n";
    printf SPICEIN "*	Output:	\"$out\"\n";

    &ld_print_setup (SPICEIN);
    &ld_print_source (SPICEIN, $type);
    &ld_print_dut (SPICEIN, $type, $in, $out, $tie, @@tie_list);
    &ld_print_measure (SPICEIN, $type);
    &ld_print_trans (SPICEIN);
    &ld_print_alter (SPICEIN);

    printf SPICEIN ".end\n";
    close(SPICEIN);

    &run_spice($run_name);

    &ld_report_spice($type, $in, $out, $run_name);
}

sub ld_copy {
    my($in, $out, $refin, $refout);
}


sub ld_print_setup {

    my ($fp) = @@_;

    printf $fp "\n*--- SETUP ---------------------------------------------------\n";
    printf $fp ".include '$techpath/$spice_corner'\n";
    printf $fp ".include '$spice_netlist'\n";
    if ($spice_include ne 'none') {
	printf $fp "$spice_include\n";
    }
    printf $fp "$trans_options\n";

    if ($spice_type eq 'smartspice') {
	printf $fp "$smartspice_options\n";
    }

    printf $fp ".param cload = '$cload[0]'\n" ;

    if ($#slewrate != -1) {
	printf $fp ".param slewrate = '$slewrate[0]'\n" ;
	printf $fp ".param slew_start = '$start_slew_percent'\n" ;
	printf $fp ".param slew_end = '$end_slew_percent'\n" ;
	printf $fp ".param tau = 'slewrate/abs(log(slew_start)-log(slew_end))'\n" ;
    }
}


sub ld_print_source {

    my ($fp, $type) = @@_;

    printf $fp "\n*--- INPUTS --------------------------------------------------\n";
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'hh') ||
	($type eq 'hl')) {

	if ($#slewrate != -1) {
	    # exponential
	    printf $fp "vinr vinr $low_value exp (
+	'$low_value'
+	'$high_value'
+	'$trans_delay'
+	'tau'
+	'$trans_delay+100*tau'
+	'tau')\n";
	} else {
	    # pulse
	    printf $fp "vinr vinr $low_value pulse (
+	'$low_value'
+	'$high_value'
+	'$trans_delay'
+	'$trans_risetime'
+	'$trans_falltime'
+	'$trans_pulse_width'
+	'$trans_period')\n";
	}
    }

    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'lh') ||
	($type eq 'll')) {

	if ($#slewrate != -1) {
	    # exponential
	    printf $fp "vinf vinf $low_value exp (
+	'$high_value'
+	'$low_value'
+	'$trans_delay'
+	'tau'
+	'$trans_delay+100*tau'
+	'tau')\n";
	} else {
	    # pulse
	    printf $fp "vinf vinf $low_value pulse (
+	'$high_value'
+	'$low_value'
+	'$trans_delay'
+	'$trans_risetime'
+	'$trans_falltime'
+	'$trans_pulse_width'
+	'$trans_period')\n";
	}
    }
}


sub ld_print_dut {

    my($fp, $type, $in, $out, $tie, $tie_list) = @@_;
    my($term, $termname, $termtype);
    my($buf, $outload);
    my($vcvs, $inlist, $reflist);
    local($term_no, @@vcvs_list, @@output_loads);

    $term_no = 0;

    if ($buffer{$in} ne '') {
	$buf = $buffer{$in};
    } else {
	$buf = $buffer{'default'};
    }
    if ($#slewrate != -1) {
	$buf = 'none';
	printf STDERR "INFO: no buffers used for slew rate load_delay.\n";
	#printf STDERR "INFO: using buffer '$buf' for slew rate load_delay.\n";
    }

    printf $fp "\n*--- TEST CIRCUIT --------------------------------------------\n";

    @@inlist = ($in);
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'hh') ||
	($type eq 'hl')) {

	@@reflist = ('inputr');

	if ($buf eq 'none') {
	    printf $fp "vshortr vinr inputr DC 0\n";
	} else {
	    printf $fp "xbufr vinr inputr $buf\n";
	}

	printf $fp "xdut0\n";
	foreach $term (@@termlist) {
	    ($termname, $termtype) = split(':', $term);
	    if ($termname eq $in) {
		printf $fp "+\tinputr\t\$ $term\n";
		next;
	    }
	    if ($termname eq $out) {
		if (($type eq 'non_inverting') || ($type eq 'hh')) {
		    printf $fp "+\toutputr\t\$ $term\n";
		} else {
		    printf $fp "+\toutputf\t\$ $term\n";
		}
		next;
	    }
	    if ($termtype eq 'i') {
		printf $fp "+\t%s\t\$ $term\n",
		    &lookup_input($termname, \@@inlist, \@@reflist, $tie, @@tie_list);
		next;
	    }
	    if ($termtype eq 'o') {
		printf $fp "+\t%s\t\$ $term\n", &lookup_output_load($termname);
		next;
	    }
	}
	printf $fp "+\t$cellname\n";
    }

    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'lh') ||
	($type eq 'll')) {

	@@reflist = ('inputf');

	if ($buf eq 'none') {
	    printf $fp "vshortf vinf inputf DC 0\n";
	} else {
	    printf $fp "xbuff vinf inputf $buf\n";
	}

	printf $fp "xdut1\n";
	foreach $term (@@termlist) {
	    ($termname, $termtype) = split(':', $term);
	    if ($termname eq $in) {
		printf $fp "+\tinputf\t\$ $term\n";
		next;
	    }
	    if ($termname eq $out) {
		if (($type eq 'non_inverting') || ($type eq 'll')) {
		    printf $fp "+\toutputf\t\$ $term\n";
		} else {
		    printf $fp "+\toutputr\t\$ $term\n";
		}
		next;
	    }
	    if ($termtype eq 'i') {
		printf $fp "+\t%s\t\$ $term\n",
		    &lookup_input($termname, \@@inlist, \@@reflist, $tie, @@tie_list);
		next;
	    }
	    if ($termtype eq 'o') {
		printf $fp "+\t%s\t\$ $term\n", &lookup_output_load($termname);
		next;
	    }
	}
	printf $fp "+\t$cellname\n";
    }

    # if any
    foreach $vcvs (@@vcvs_list) {
	printf $fp "$vcvs\n";
    }

    printf $fp "\n*--- LOADS ---------------------------------------------------\n";
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'hh') ||
	($type eq 'lh')) {
	printf $fp "cloadr outputr $low_value cload\n";
    }
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'hl') ||
	($type eq 'll')) {
	printf $fp "cloadf outputf $low_value cload\n";
    }
    foreach $outload (@@output_loads) {
	printf $fp "$outload\n";
    }
}

sub ld_print_measure {

    my($fp, $type) = @@_;

    printf $fp "\n*--- MEASURE -------------------------------------------------\n";
    printf $fp ".option autostop\n";

    printf $fp "* Prop delay measurements:\n";
    if (($type eq 'non_inverting') || ($type eq 'hh')) {
	printf $fp
	    ".measure tran tplh %s v(inputr) val='$input_prop_r' rise=1\n",
	    &trig_word();
	printf $fp
	    "+\ttarg=v(outputr) val='$output_prop_r' rise=1\n";
    }
    if (($type eq 'non_inverting') || ($type eq 'll')) {
	printf $fp
	    ".measure tran tphl %s v(inputf) val='$input_prop_f' fall=1\n",
	    &trig_word();
	printf $fp
	    "+\ttarg=v(outputf) val='$output_prop_f' fall=1\n";
    }
    if (($type eq 'inverting') || ($type eq 'lh')) {
	printf $fp
	    ".measure tran tplh %s v(inputf) val='$input_prop_f' fall=1\n",
	    &trig_word();
	printf $fp
	    "+\ttarg=v(outputr) val='$output_prop_r' rise=1\n";
    }
    if (($type eq 'inverting') || ($type eq 'hl')) {
	printf $fp
	    ".measure tran tphl %s v(inputr) val='$input_prop_r' rise=1\n",
	    &trig_word();
	printf $fp
	    "+\ttarg=v(outputf) val='$output_prop_f' fall=1\n";
    }

    printf $fp "\n* Output rise and fall time measurements:\n";
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'hh') ||
	($type eq 'lh')) {
	printf $fp
	    ".measure tran risetime %s v(outputr) val='$trans_r1' rise=1\n",
	    &trig_word();
	printf $fp
	    "+\ttarg=v(outputr) val='$trans_r2' rise=1\n";
    }
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'll') ||
	($type eq 'hl')) {
	printf $fp
	    ".measure tran falltime %s v(outputf) val='$trans_f1' fall=1\n",
	    &trig_word();
	printf $fp
	    "+\ttarg=v(outputf) val='$trans_f2' fall=1\n";
    }

    printf $fp "\n* Input rise and fall time measurements:\n";
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'hh') ||
	($type eq 'hl')) {
	printf $fp
	    ".measure tran inputrise %s v(inputr) val='$slew_r1' rise=1\n",
	    &trig_word();
	printf $fp
	    "+\ttarg=v(inputr) val='$slew_r2' rise=1\n";
    }
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq 'll') ||
	($type eq 'lh')) {
	printf $fp
	    ".measure tran inputfall %s v(inputf) val='$slew_f1' fall=1\n",
	    &trig_word();
	printf $fp
	    "+\ttarg=v(inputf) val='$slew_f2' fall=1\n";
    }
}


sub ld_print_trans {

    my($fp) = @@_;

    printf $fp "\n*--- TRANSIENT -----------------------------------------------\n";
    printf $fp ".trans $trans_timestep '$trans_timestop'\n";
}


sub ld_print_alter {

    my($fp) = @@_;
    my($i, $j);

    printf $fp "\n*--- ALTER ---------------------------------------------------\n";
    #foreach $c (@@cload) {
    for ($i = 1; $i <= $#cload; $i++) {
	printf $fp ".alter\n";
	printf $fp ".param cload = '$cload[$i]'\n\n" ;
    }

    for ($j = 1; $j <= $#slewrate; $j++) {
	for ($i = 0; $i <= $#cload; $i++) {
	    printf $fp ".alter\n";
	    printf $fp ".param slewrate = '$slewrate[$j]'\n" ;
	    printf $fp ".param tau = 'slewrate/abs(log(slew_start)-log(slew_end))'\n";
	    printf $fp ".param cload = '$cload[$i]'\n\n" ;
	}
    }
}


sub ld_report_spice {

    local($type, $in, $out, $run_name) = @@_;
    my($base,$dir,$ext,$spiceout);
    my($i);

    local(@@tplh, @@tphl, @@risetime, @@falltime, @@creal);
    local(@@inputrise, @@inputfall);

    ($base,$dir,$ext) = fileparse($run_name, '\.sp');
    $spiceout = $base . '.out';

    printf STDERR "Extracting results from '$spiceout' ...\n";

    open(SPICEOUT, $spiceout) || die "ERROR: Cannot find '$spiceout'.\n";

    while (<SPICEOUT>) {
	if (($name, $value) = /^ *(tplh) *= +([0-9\+\-eE\.]+)/) {
	    push(@@tplh, $value);
	}
	if (($name, $value) = /^ *(tphl) *= +([0-9\+\-eE\.]+)/) {
	    push(@@tphl, $value);
	}
	if (($name, $value) = /^ *(risetime) *= +([0-9\+\-eE\.]+)/) {
	    push(@@risetime, $value);
	}
	if (($name, $value) = /^ *(falltime) *= +([0-9\+\-eE\.]+)/) {
	    push(@@falltime, $value);
	}
	if (($name, $value) = /^ *(inputrise) *= +([0-9\+\-eE\.]+)/) {
	    push(@@inputrise, $value);
	}
	if (($name, $value) = /^ *(inputfall) += +([0-9\+\-eE\.]+)/) {
	    push(@@inputfall, $value);
	}
    }
    close SPICEOUT;

    printf OUT "### LOAD DELAY #############################################################\n\n";
    printf OUT "Cellname:\t\"$cellname\"\n";
    printf OUT "Input:\t\t\"$in\"\n";
    printf OUT "Output:\t\t\"$out\"\n";
    printf OUT "Transition:\t\"$type\"\n";

    # change to real numbers
    @@creal = &convert_spice_values(@@cload);

    printf OUT "\n";
    &ld_report_spice_1(0);

    # report it again, this time scaled.
    if (($scale_cload != 1) || ($scale_delay != 1)) {

	@@creal = &div_list($scale_cload, @@creal);
	@@tplh = &div_list($scale_delay, @@tplh);
	@@tphl = &div_list($scale_delay, @@tphl);
	@@risetime = &div_list($scale_delay, @@risetime);
	@@falltime = &div_list($scale_delay, @@falltime);
	@@inputrise = &div_list($scale_delay, @@inputrise);
	@@inputfall = &div_list($scale_delay, @@inputfall);

	printf OUT "\n    Scaled:\n\n";
	&ld_report_spice_1(1);
	printf OUT "\n\n";
    }

    &ld_save_data($cellname, $in, $out, \@@creal,
	\@@tplh, \@@tphl, \@@risetime, \@@falltime, \@@inputrise, \@@inputfall);
}


#
#   ld_report_spice_1 --
#	Code fragment, called by ld_report_spice only.
#
sub ld_report_spice_1 {
    my($scaled) = @@_;

    my($risetimea, $risetimeb, $risetimer2);
    my($falltimea, $falltimeb, $falltimer2);
    my($tplha, $tplhb, $tplhr2);
    my($tphla, $tphlb, $tphlr2);

    if ($#tplh == $#creal) {
	($tplha, $tplhb, $tplhr2) = &svlinreg('lin', \@@creal, \@@tplh);
    }
    if ($#tphl == $#creal) {
	($tphla, $tphlb, $tphlr2) = &svlinreg('lin', \@@creal, \@@tphl);
    }
    if ($#risetime == $#creal) {
	($risetimea, $risetimeb, $risetimer2) = &svlinreg('lin', \@@creal, \@@risetime);
    }
    if ($#falltime == $#creal) {
	($falltimea, $falltimeb, $falltimer2) = &svlinreg('lin', \@@creal, \@@falltime);
    }

    if ($debug) {
	&dump_list (creal, @@creal);
	&dump_list (tplh, @@tplh);
	&dump_list (tphl, @@tphl);
	&dump_list (risetime, @@risetime);
	&dump_list (falltime, @@falltime);
	&dump_list (inputrise, @@inputrise);
	&dump_list (inputfall, @@inputfall);
    }

    printf OUT "    Cload\tTplh\t\tTphl\t\tRiseTime\tFallTime\tInputRise\tInputFall\n";
    printf OUT "    [F]\t\t[s]\t\t[s]\t\t[s]\t\t[s]\t\t[s]\t\t[s]\n" unless $scaled;
    printf OUT "    ----------\t----------\t----------\t----------\t----------\t----------\t----------\n";
    for ($i = 0; $i <= $#tplh; $i++) {
	printf OUT "    %.4e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4e\t%.4e\n",
	    $creal[$i % ($#creal + 1)], $tplh[$i], $tphl[$i], $risetime[$i], $falltime[$i], $inputrise[$i], $inputfall[$i];

    }

    if ($#slewrate == -1) {
	printf OUT "\n";
	printf OUT "    Tplh\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	    $tplha, $tplhb, $tplhr2;
	printf OUT "    Tphl\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	    $tphla, $tphlb, $tphlr2;
	printf OUT "    Risetime\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	    $risetimea, $risetimeb, $risetimer2;
	printf OUT "    Falltime\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	    $falltimea, $falltimeb, $falltimer2;
    }
}


1;
@


1.37
log
@smartspice trig_word
@
text
@d1 1
a1 1
#	$Id: load_delay.pl,v 1.36 1999/01/20 11:56:24 ryu Exp ryu $
d413 1
a413 1
	if (($name, $value) = /^ *(tplh) += +([0-9\+\-eE\.]+)/) {
d416 1
a416 1
	if (($name, $value) = /^ *(tphl) += +([0-9\+\-eE\.]+)/) {
d419 1
a419 1
	if (($name, $value) = /^ *(risetime) += +([0-9\+\-eE\.]+)/) {
d422 1
a422 1
	if (($name, $value) = /^ *(falltime) += +([0-9\+\-eE\.]+)/) {
d425 1
a425 1
	if (($name, $value) = /^ *(inputrise) += +([0-9\+\-eE\.]+)/) {
@


1.36
log
@works for smartspice
@
text
@d1 1
a1 1
#	$Id: load_delay.pl,v 1.35 1999/01/20 07:44:59 ryu Exp ryu $
d75 5
d290 3
a292 7
	if ($spice_type eq 'smartspice') {
	    printf $fp
	    ".measure tran tplh delay v(inputr) val='$input_prop_r' rise=1\n";
	} else {
	    printf $fp
	    ".measure tran tplh trig=v(inputr) val='$input_prop_r' rise=1\n";
	}
d297 3
a299 7
	if ($spice_type eq 'smartspice') {
	    printf $fp
	    ".measure tran tphl delay v(inputf) val='$input_prop_f' fall=1\n";
	} else {
	    printf $fp
	    ".measure tran tphl trig=v(inputf) val='$input_prop_f' fall=1\n";
	}
d304 3
a306 7
	if ($spice_type eq 'smartspice') {
	    printf $fp
	    ".measure tran tplh delay v(inputf) val='$input_prop_f' fall=1\n";
	} else {
	    printf $fp
	    ".measure tran tplh trig=v(inputf) val='$input_prop_f' fall=1\n";
	}
d311 3
a313 7
	if ($spice_type eq 'smartspice') {
	    printf $fp
	    ".measure tran tphl delay v(inputr) val='$input_prop_r' rise=1\n";
	} else {
	    printf $fp
	    ".measure tran tphl trig=v(inputr) val='$input_prop_r' rise=1\n";
	}
d323 3
a325 7
	if ($spice_type eq 'smartspice') {
	    printf $fp
	    ".measure tran risetime delay v(outputr) val='$trans_r1' rise=1\n";
	} else {
	    printf $fp
	    ".measure tran risetime trig=v(outputr) val='$trans_r1' rise=1\n";
	}
d333 3
a335 7
	if ($spice_type eq 'smartspice') {
	    printf $fp
	    ".measure tran falltime delay v(outputf) val='$trans_f1' fall=1\n";
	} else {
	    printf $fp
	    ".measure tran falltime trig=v(outputf) val='$trans_f1' fall=1\n";
	}
d345 3
a347 7
	if ($spice_type eq 'smartspice') {
	    printf $fp
	    ".measure tran inputrise delay v(inputr) val='$slew_r1' rise=1\n";
	} else {
	    printf $fp
	    ".measure tran inputrise trig=v(inputr) val='$slew_r1' rise=1\n";
	}
d355 3
a357 7
	if ($spice_type eq 'smartspice') {
	    printf $fp
	    ".measure tran inputfall delay v(inputf) val='$slew_f1' fall=1\n";
	} else {
	    printf $fp
	    ".measure tran inputfall trig=v(inputf) val='$slew_f1' fall=1\n";
	}
d412 15
a426 32
    if ($spice_type eq 'smartspice') {
	while (<SPICEOUT>) {
	    if (/^\s+measure +tplh +.*/) {
		$_ = <SPICEOUT>;
		($value) = /^\s+.* += +([0-9\+\-eE\.]+)/;
		push(@@tplh, $value);
	    }
	    if (/^\s+measure +tphl +.*/) {
		$_ = <SPICEOUT>;
		($value) = /^\s+.* += +([0-9\+\-eE\.]+)/;
		push(@@tphl, $value);
	    }
	    if (/^\s+measure +risetime +.*/) {
		$_ = <SPICEOUT>;
		($value) = /^\s+.* += +([0-9\+\-eE\.]+)/;
		push(@@risetime, $value);
	    }
	    if (/^\s+measure +falltime +.*/) {
		$_ = <SPICEOUT>;
		($value) = /^\s+.* += +([0-9\+\-eE\.]+)/;
		push(@@falltime, $value);
	    }
	    if (/^\s+measure +inputrise +.*/) {
		$_ = <SPICEOUT>;
		($value) = /^\s+.* += +([0-9\+\-eE\.]+)/;
		push(@@inputrise, $value);
	    }
	    if (/^\s+measure +inputfall +.*/) {
		$_ = <SPICEOUT>;
		($value) = /^\s+.* += +([0-9\+\-eE\.]+)/;
		push(@@inputfall, $value);
	    }
d428 2
a429 20
    } else {
	while (<SPICEOUT>) {
	    if (($name, $value) = /^ +(tplh) += +([0-9\+\-eE\.]+)/) {
		push(@@tplh, $value);
	    }
	    if (($name, $value) = /^ +(tphl) += +([0-9\+\-eE\.]+)/) {
		push(@@tphl, $value);
	    }
	    if (($name, $value) = /^ +(risetime) += +([0-9\+\-eE\.]+)/) {
		push(@@risetime, $value);
	    }
	    if (($name, $value) = /^ +(falltime) += +([0-9\+\-eE\.]+)/) {
		push(@@falltime, $value);
	    }
	    if (($name, $value) = /^ +(inputrise) += +([0-9\+\-eE\.]+)/) {
		push(@@inputrise, $value);
	    }
	    if (($name, $value) = /^ +(inputfall) += +([0-9\+\-eE\.]+)/) {
		push(@@inputfall, $value);
	    }
@


1.35
log
@No perl header
@
text
@d1 1
a1 1
#	$Id: load_delay.pl,v 1.34 1999/01/14 10:19:02 ryu Exp ryu $
d285 5
a289 1
	printf $fp
d291 1
d296 5
a300 1
	printf $fp
d302 1
d307 5
a311 1
	printf $fp
d313 1
d318 5
a322 1
	printf $fp
d324 1
d334 5
a338 1
	printf $fp
d340 1
d348 5
a352 1
	printf $fp
d354 1
d364 5
a368 1
	printf $fp
d370 1
d378 5
a382 1
	printf $fp
d384 1
d438 33
a470 3
    while (<SPICEOUT>) {
	if (($name, $value) = /^ +(tplh) += +([0-9\+\-eE\.]+)/) {
	    push(@@tplh, $value);
d472 20
a491 14
	if (($name, $value) = /^ +(tphl) += +([0-9\+\-eE\.]+)/) {
	    push(@@tphl, $value);
	}
	if (($name, $value) = /^ +(risetime) += +([0-9\+\-eE\.]+)/) {
	    push(@@risetime, $value);
	}
	if (($name, $value) = /^ +(falltime) += +([0-9\+\-eE\.]+)/) {
	    push(@@falltime, $value);
	}
	if (($name, $value) = /^ +(inputrise) += +([0-9\+\-eE\.]+)/) {
	    push(@@inputrise, $value);
	}
	if (($name, $value) = /^ +(inputfall) += +([0-9\+\-eE\.]+)/) {
	    push(@@inputfall, $value);
@


1.34
log
@Using /usr/bin/perl
@
text
@d1 1
a1 3
#! /usr/bin/perl

#	$Id: load_delay.pl,v 1.33 1999/01/13 07:18:42 ryu Exp ryu $
@


1.33
log
@GPL
@
text
@d1 1
a1 1
#! /usr/local/bin/perl
d3 1
a3 1
#	$Id$
@


1.32
log
@Added slew-rate to setup and hold; support for non-linear models for clock-q
@
text
@d3 1
a3 5
#	Copyright (c) 1998-2001, Robert K. Yu.  All Rights Reserved.
#
#	No part of this program may be used, reproduced, stored in a 
#	retrieval system, or transmitted in any form or by any 
#	means without the prior permission of the author.
d5 2
a6 3
#	$Id: load_delay.pl,v 1.31 1998/09/11 06:19:45 ryu Exp ryu $
#	Load Delay Characterization Functions
#	Author: Robert K. Yu
d8 16
@


1.31
log
@Added slew rate to setup/hold
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.30 1998/09/08 13:16:49 ryu Exp ryu $
d60 1
a60 1
    printf $fp ".include '$init{'techpath'}/$init{'corner'}'\n";
d62 2
a63 2
    if ($init{'include'} ne 'none') {
	printf $fp "$init{'include'}\n";
d65 1
a65 1
    printf $fp "$trans{'options'}\n";
d70 2
a71 2
	printf $fp ".param slew_start = '$trans{'start_slew_percent'}'\n" ;
	printf $fp ".param slew_end = '$trans{'end_slew_percent'}'\n" ;
d89 4
a92 4
	    printf $fp "vinr vinr $init{'low'} exp (
+	'$init{'low'}'
+	'$init{'high'}'
+	'$trans{'delay'}'
d94 1
a94 1
+	'$trans{'delay'}+100*tau'
d98 8
a105 8
	    printf $fp "vinr vinr $init{'low'} pulse (
+	'$init{'low'}'
+	'$init{'high'}'
+	'$trans{'delay'}'
+	'$trans{'risetime'}'
+	'$trans{'falltime'}'
+	'$trans{'pulse_width'}'
+	'$trans{'period'}')\n";
d116 4
a119 4
	    printf $fp "vinf vinf $init{'low'} exp (
+	'$init{'high'}'
+	'$init{'low'}'
+	'$trans{'delay'}'
d121 1
a121 1
+	'$trans{'delay'}+100*tau'
d125 8
a132 8
	    printf $fp "vinf vinf $init{'low'} pulse (
+	'$init{'high'}'
+	'$init{'low'}'
+	'$trans{'delay'}'
+	'$trans{'risetime'}'
+	'$trans{'falltime'}'
+	'$trans{'pulse_width'}'
+	'$trans{'period'}')\n";
d254 1
a254 1
	printf $fp "cloadr outputr $init{'low'} cload\n";
d260 1
a260 1
	printf $fp "cloadf outputf $init{'low'} cload\n";
d347 1
a347 1
    printf $fp ".trans $trans{'timestep'} '$trans{'timestop'}'\n";
d411 1
d424 1
a424 1
    if (($init{'scale_cload'} != 1) || ($init{'scale_delay'} != 1)) {
d426 7
a432 7
	@@creal = &div_list($init{'scale_cload'}, @@creal);
	@@tplh = &div_list($init{'scale_delay'}, @@tplh);
	@@tphl = &div_list($init{'scale_delay'}, @@tphl);
	@@risetime = &div_list($init{'scale_delay'}, @@risetime);
	@@falltime = &div_list($init{'scale_delay'}, @@falltime);
	@@inputrise = &div_list($init{'scale_delay'}, @@inputrise);
	@@inputfall = &div_list($init{'scale_delay'}, @@inputfall);
@


1.30
log
@slew rate at the clock input of setup_hold (wip)
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.29 1998/09/06 20:43:23 ryu Exp ryu $
a269 14
    local($input_prop_r, $input_prop_f);
    local($output_prop_r, $output_prop_f);
    local($trans_r1, $trans_r2);
    local($trans_f1, $trans_f2);
    local($slew_r1, $slew_r2);
    local($slew_f1, $slew_f2);

    &set_measure_values (
	\$input_prop_r, \$input_prop_f,
	\$output_prop_r, \$output_prop_f,
	\$trans_r1, \$trans_r2,
	\$trans_f1, \$trans_f2,
	\$slew_r1, \$slew_r2,
	\$slew_f1, \$slew_f2);
@


1.29
log
@clock enable
@
text
@d3 1
a3 1
#	Copyright (c) 1998, Robert K. Yu.  All Rights Reserved.
d9 1
a9 1
#	$Id: load_delay.pl,v 1.28 1998/09/05 22:10:32 ryu Exp ryu $
d45 1
a45 1
    &ld_run_spice($run_name);
d70 3
a72 3
	printf $fp ".param start_pct = '$trans{'start_slew_percent'}'\n" ;
	printf $fp ".param end_pct = '$trans{'end_slew_percent'}'\n" ;
	printf $fp ".param tau = 'slewrate/abs(log(start_pct)-log(end_pct))'\n" ;
a87 1

a95 1

a96 1

a105 1

a114 1

a122 1

a123 1

a132 1

d381 1
a381 1
	    printf $fp ".param tau = 'slewrate/abs(log(start_pct)-log(end_pct))'\n";
a383 18
    }
}


sub ld_run_spice {

    my($run_name) = @@_;
    my($base,$dir,$type,$spiceout);

    ($base,$dir,$type) = fileparse($run_name, '\.sp');
    $spiceout = $base . '.out';

    # Run hspice
    if ($skip && (-e $spiceout)) {
	printf STDERR "Found \"%s\", skipping run.\n", $spiceout;
    } else {
	printf STDERR "Running %s on \"%s\" ...\n", $init{'spice_cmd'}, $run_name;
	`$init{'spice_cmd'} $run_name`;
@


1.28
log
@Consolidate lookup_input functions into one, using list of names and refnames.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.27 1998/09/03 06:09:52 ryu Exp ryu $
d187 1
a187 1
		printf $fp "+\tinputr\n";
d192 1
a192 1
		    printf $fp "+\toutputr\n";
d194 1
a194 1
		    printf $fp "+\toutputf\n";
d199 1
a199 1
		printf $fp "+\t%s\n",
d204 1
a204 1
		printf $fp "+\t%s\n", &lookup_output_load($termname);
d228 1
a228 1
		printf $fp "+\tinputf\n";
d233 1
a233 1
		    printf $fp "+\toutputf\n";
d235 1
a235 1
		    printf $fp "+\toutputr\n";
d240 1
a240 1
		printf $fp "+\t%s\n",
d245 1
a245 1
		printf $fp "+\t%s\n", &lookup_output_load($termname);
d299 1
a299 1
	    ".meas tran tplh trig=v(inputr) val='$input_prop_r' rise=1\n";
d305 1
a305 1
	    ".meas tran tphl trig=v(inputf) val='$input_prop_f' fall=1\n";
d311 1
a311 1
	    ".meas tran tplh trig=v(inputf) val='$input_prop_f' fall=1\n";
d317 1
a317 1
	    ".meas tran tphl trig=v(inputr) val='$input_prop_r' rise=1\n";
d328 1
a328 1
	    ".meas tran risetime trig=v(outputr) val='$trans_r1' rise=1\n";
d337 1
a337 1
	    ".meas tran falltime trig=v(outputf) val='$trans_f1' fall=1\n";
d348 1
a348 1
	    ".meas tran inputrise trig=v(inputr) val='$slew_r1' rise=1\n";
d357 1
a357 1
	    ".meas tran inputfall trig=v(inputf) val='$slew_f1' fall=1\n";
@


1.27
log
@Using exponential ideal source for input slew rate.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.26 1998/09/01 04:49:20 ryu Exp ryu $
d151 1
a151 1
    my($vcvs, $refname);
d169 1
d175 1
a175 1
	$refname = 'inputr';
d200 1
a200 1
		    &lookup_input($termname, $in, $refname, $tie, @@tie_list);
d216 1
a216 1
	$refname = 'inputf';
d241 1
a241 1
		    &lookup_input($termname, $in, $refname, $tie, @@tie_list);
@


1.26
log
@Consistent quotes
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.25 1998/08/30 19:24:00 ryu Exp ryu $
d70 3
d87 15
a101 1
	printf $fp "vinr vinr $init{'low'} pulse (
d109 2
d118 15
a132 1
	printf $fp "vinf vinf $init{'low'} pulse (
d141 1
d162 3
a164 1
	printf STDERR "INFO: using buffer '$buf' for slew rate load_delay.\n";
d281 2
d288 3
a290 1
	\$trans_f1, \$trans_f2);
d347 1
a347 1
	    ".meas tran inputrise trig=v(inputr) val='$trans_r1' rise=1\n";
d349 1
a349 1
	    "+\ttarg=v(inputr) val='$trans_r2' rise=1\n";
d356 1
a356 1
	    ".meas tran inputfall trig=v(inputf) val='$trans_f1' fall=1\n";
d358 1
a358 1
	    "+\ttarg=v(inputf) val='$trans_f2' fall=1\n";
d388 1
@


1.25
log
@Using term instead of port; extract all cell and terminal properties into synopsys model.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.24 1998/08/29 20:01:15 ryu Exp ryu $
d26 1
a26 1
    open(SPICEIN,">$run_name") || die "ERROR:  Cannot open file \"$run_name\".";
d386 1
a386 1
    open(SPICEOUT, $spiceout) || die "ERROR: Cannot find \"$spiceout\".\n";
@


1.24
log
@Changed WARNING message to INFO message.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.23 1998/08/29 19:50:27 ryu Exp ryu $
d115 1
a115 1
    my($port, $portname, $porttype);
d118 1
a118 1
    local($port_no, @@vcvs_list, @@output_loads);
d120 1
a120 1
    $port_no = 0;
d147 3
a149 3
	foreach $port (@@portlist) {
	    ($portname, $porttype) = split(':', $port);
	    if ($portname eq $in) {
d153 1
a153 1
	    if ($portname eq $out) {
d161 1
a161 1
	    if ($porttype eq 'i') {
d163 1
a163 1
		    &lookup_input($portname, $in, $refname, $tie, @@tie_list);
d166 2
a167 2
	    if ($porttype eq 'o') {
		printf $fp "+\t%s\n", &lookup_output_load($portname);
d188 3
a190 3
	foreach $port (@@portlist) {
	    ($portname, $porttype) = split(':', $port);
	    if ($portname eq $in) {
d194 1
a194 1
	    if ($portname eq $out) {
d202 1
a202 1
	    if ($porttype eq 'i') {
d204 1
a204 1
		    &lookup_input($portname, $in, $refname, $tie, @@tie_list);
d207 2
a208 2
	    if ($porttype eq 'o') {
		printf $fp "+\t%s\n", &lookup_output_load($portname);
@


1.23
log
@Added div_list and mult_list
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.22 1998/08/29 17:23:56 ryu Exp ryu $
d128 1
a128 3
	if ($buf ne 'slewbuffer') {
	    printf STDERR "WARNING: slewrate buffer not specified.\n";
	}
@


1.22
log
@add more control of prop delay measurement
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.21 1998/08/28 09:58:27 ryu Exp ryu $
d425 7
a431 7
	@@creal = &scale_list($init{'scale_cload'}, @@creal);
	@@tplh = &scale_list($init{'scale_delay'}, @@tplh);
	@@tphl = &scale_list($init{'scale_delay'}, @@tphl);
	@@risetime = &scale_list($init{'scale_delay'}, @@risetime);
	@@falltime = &scale_list($init{'scale_delay'}, @@falltime);
	@@inputrise = &scale_list($init{'scale_delay'}, @@inputrise);
	@@inputfall = &scale_list($init{'scale_delay'}, @@inputfall);
@


1.21
log
@$#slewrate is -1 when the list is empty.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.20 1998/08/28 09:52:33 ryu Exp ryu $
a239 1

d243 10
d260 1
a260 1
	    ".meas tran tplh trig=v(inputr) val='$init{'midpoint'}' rise=1\n";
d262 1
a262 1
	    "+\ttarg=v(outputr) val='$init{'midpoint'}' rise=1\n";
d266 1
a266 1
	    ".meas tran tphl trig=v(inputf) val='$init{'midpoint'}' fall=1\n";
d268 1
a268 1
	    "+\ttarg=v(outputf) val='$init{'midpoint'}' fall=1\n";
d272 1
a272 1
	    ".meas tran tplh trig=v(inputf) val='$init{'midpoint'}' fall=1\n";
d274 1
a274 1
	    "+\ttarg=v(outputr) val='$init{'midpoint'}' rise=1\n";
d278 1
a278 1
	    ".meas tran tphl trig=v(inputr) val='$init{'midpoint'}' rise=1\n";
d280 1
a280 1
	    "+\ttarg=v(outputf) val='$init{'midpoint'}' fall=1\n";
d289 1
a289 1
	    ".meas tran risetime trig=v(outputr) val='$init{'low'}+$trans{'low_percent'}*$init{'high'}' rise=1\n";
d291 1
a291 1
	    "+\ttarg=v(outputr) val='$init{'low'}+$trans{'high_percent'}*$init{'high'}' rise=1\n";
d298 1
a298 1
	    ".meas tran falltime trig=v(outputf) val='$init{'low'}+$trans{'high_percent'}*$init{'high'}' fall=1\n";
d300 1
a300 1
	    "+\ttarg=v(outputf) val='$init{'low'}+$trans{'low_percent'}*$init{'high'}' fall=1\n";
d309 1
a309 1
	    ".meas tran inputrise trig=v(inputr) val='$init{'low'}+$trans{'low_percent'}*$init{'high'}' rise=1\n";
d311 1
a311 1
	    "+\ttarg=v(inputr) val='$init{'low'}+$trans{'high_percent'}*$init{'high'}' rise=1\n";
d318 1
a318 1
	    ".meas tran inputfall trig=v(inputf) val='$init{'low'}+$trans{'high_percent'}*$init{'high'}' fall=1\n";
d320 1
a320 1
	    "+\ttarg=v(inputf) val='$init{'low'}+$trans{'low_percent'}*$init{'high'}' fall=1\n";
@


1.20
log
@changed name of slew rate buffer
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.19 1998/08/26 09:35:38 ryu Exp ryu $
d68 1
a68 1
    if ($#slewrate != 0) {
d127 1
a127 1
    if ($#slewrate != 0) {
d478 1
a478 1
    if ($#slewrate == 0) {
@


1.19
log
@added slewrate modelling.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.18 1998/08/24 06:16:21 ryu Exp $
d128 1
a128 1
	if ($buf ne 'slewbuf') {
@


1.18
log
@Added multivariable linear regression
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.17 1998/08/24 00:48:34 ryu Exp ryu $
d67 4
d127 5
d328 1
a328 1
    my($i);
d336 8
d429 2
a430 2
    &ld_save_data($cellname, $in, $out,
	\@@creal, \@@tplh, \@@tphl, \@@risetime, \@@falltime);
a444 2
    # my($inputrisea, $inputriseb, $inputriser2);
    # my($inputfalla, $inputfallb, $inputfallr2);
a457 6
#    if ($#inputrise == $#creal) {
#	($inputrisea, $inputriseb, $inputriser2) = &svlinreg('lin', \@@creal, \@@inputrise);
#    }
#    if ($#inputfall == $#creal) {
#	($inputfalla, $inputfallb, $inputfallr2) = &svlinreg('lin', \@@creal, \@@inputfall);
#    }
d472 1
a472 1
    for ($i = 0; $i <= $#creal; $i++) {
d474 1
a474 1
	    $creal[$i], $tplh[$i], $tphl[$i], $risetime[$i], $falltime[$i], $inputrise[$i], $inputfall[$i];
a476 13
    printf OUT "\n";
    printf OUT "    Tplh\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	$tplha, $tplhb, $tplhr2;
    printf OUT "    Tphl\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	$tphla, $tphlb, $tphlr2;
    printf OUT "    Risetime\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	$risetimea, $risetimeb, $risetimer2;
    printf OUT "    Falltime\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	$falltimea, $falltimeb, $falltimer2;
#    printf OUT "    Inputrise\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
#	$inputrisea, $inputriseb, $inputriser2;
#    printf OUT "    Inputfall\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
#	$inputfalla, $inputfallb, $inputfallr2;
d478 11
@


1.17
log
@Added copy_data functions to copy characterization data from one arc to another
to save time.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.16 1998/08/23 22:11:24 ryu Exp ryu $
d432 1
a432 1
	($tplha, $tplhb, $tplhr2) = &linreg('lin', \@@creal, \@@tplh);
d435 1
a435 1
	($tphla, $tphlb, $tphlr2) = &linreg('lin', \@@creal, \@@tphl);
d438 1
a438 1
	($risetimea, $risetimeb, $risetimer2) = &linreg('lin', \@@creal, \@@risetime);
d441 1
a441 1
	($falltimea, $falltimeb, $falltimer2) = &linreg('lin', \@@creal, \@@falltime);
d444 1
a444 1
#	($inputrisea, $inputriseb, $inputriser2) = &linreg('lin', \@@creal, \@@inputrise);
d447 1
a447 1
#	($inputfalla, $inputfallb, $inputfallr2) = &linreg('lin', \@@creal, \@@inputfall);
@


1.16
log
@Robert K. Yu
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.15 1998/08/23 21:59:07 ryu Exp ryu $
d48 4
@


1.15
log
@save_data functions moved into model.pl; pass lists by reference
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.14 1998/08/23 12:22:09 ryu Exp ryu $
d11 1
a11 1
#	Author: Robert Yu
@


1.14
log
@print out synopsys model for combinatorial gates.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.13 1998/08/23 12:03:44 ryu Exp ryu $
d408 2
a409 1
    &ld_save_data();
d428 1
a428 1
	($tplha, $tplhb, $tplhr2) = &linreg('lin', @@creal, @@tplh);
d431 1
a431 1
	($tphla, $tphlb, $tphlr2) = &linreg('lin', @@creal, @@tphl);
d434 1
a434 1
	($risetimea, $risetimeb, $risetimer2) = &linreg('lin', @@creal, @@risetime);
d437 1
a437 1
	($falltimea, $falltimeb, $falltimer2) = &linreg('lin', @@creal, @@falltime);
d440 1
a440 1
#	($inputrisea, $inputriseb, $inputriser2) = &linreg('lin', @@creal, @@inputrise);
d443 1
a443 1
#	($inputfalla, $inputfallb, $inputfallr2) = &linreg('lin', @@creal, @@inputfall);
a477 35
}


#
#   ld_save_data --
#	Code fragment, called by ld_report_spice only.
#
sub ld_save_data {
    my($risetimea, $risetimeb, $risetimer2);
    my($falltimea, $falltimeb, $falltimer2);
    my($tplha, $tplhb, $tplhr2);
    my($tphla, $tphlb, $tphlr2);

    if ($#tplh == $#creal) {
	($tplha, $tplhb, $tplhr2) = &linreg('lin', @@creal, @@tplh);
    }
    if ($#tphl == $#creal) {
	($tphla, $tphlb, $tphlr2) = &linreg('lin', @@creal, @@tphl);
    }
    if ($#risetime == $#creal) {
	($risetimea, $risetimeb, $risetimer2) = &linreg('lin', @@creal, @@risetime);
    }
    if ($#falltime == $#creal) {
	($falltimea, $falltimeb, $falltimer2) = &linreg('lin', @@creal, @@falltime);
    }

    $celldata{"$cellname:load_delay:$in:$out"} = 1;
    $celldata{"$cellname:load_delay:$in:$out:tplha"} = $tplha; 
    $celldata{"$cellname:load_delay:$in:$out:tplhb"} = $tplhb; 
    $celldata{"$cellname:load_delay:$in:$out:tphla"} = $tphla; 
    $celldata{"$cellname:load_delay:$in:$out:tphlb"} = $tphlb; 
    $celldata{"$cellname:load_delay:$in:$out:risetimea"} = $risetimea; 
    $celldata{"$cellname:load_delay:$in:$out:risetimeb"} = $risetimeb; 
    $celldata{"$cellname:load_delay:$in:$out:falltimea"} = $falltimea; 
    $celldata{"$cellname:load_delay:$in:$out:falltimeb"} = $falltimeb; 
@


1.13
log
@celldata
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.12 1998/08/23 10:13:45 ryu Exp ryu $
d503 1
@


1.12
log
@Writing of DATA
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.11 1998/08/23 09:54:17 ryu Exp ryu $
d408 1
a408 1
    &ld_write_data();
d481 1
a481 1
#   ld_write_data --
d484 1
a484 1
sub ld_write_data {
d503 8
a510 8
    printf DATA "\$data{'$cellname:load_delay:$in:$out:tplha'} = %.5e;\n", $tplha; 
    printf DATA "\$data{'$cellname:load_delay:$in:$out:tplhb'} = %.5e;\n", $tplhb; 
    printf DATA "\$data{'$cellname:load_delay:$in:$out:tphla'} = %.5e;\n", $tphla; 
    printf DATA "\$data{'$cellname:load_delay:$in:$out:tphlb'} = %.5e;\n", $tphlb; 
    printf DATA "\$data{'$cellname:load_delay:$in:$out:risetimea'} = %.5e;\n", $risetimea; 
    printf DATA "\$data{'$cellname:load_delay:$in:$out:risetimeb'} = %.5e;\n", $risetimeb; 
    printf DATA "\$data{'$cellname:load_delay:$in:$out:falltimea'} = %.5e;\n", $falltimea; 
    printf DATA "\$data{'$cellname:load_delay:$in:$out:falltimeb'} = %.5e;\n", $falltimeb; 
@


1.11
log
@Added writing of .db output
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.10 1998/08/23 06:56:57 ryu Exp ryu $
d408 1
a408 1
    &ld_write_db();
d481 1
a481 1
#   ld_write_db --
d484 1
a484 1
sub ld_write_db {
d503 8
a510 8
    printf DB "\$db{'$cellname:load_delay:$in:$out:tplha'} = %.5e;\n", $tplha; 
    printf DB "\$db{'$cellname:load_delay:$in:$out:tplhb'} = %.5e;\n", $tplhb; 
    printf DB "\$db{'$cellname:load_delay:$in:$out:tphla'} = %.5e;\n", $tphla; 
    printf DB "\$db{'$cellname:load_delay:$in:$out:tphlb'} = %.5e;\n", $tphlb; 
    printf DB "\$db{'$cellname:load_delay:$in:$out:risetimea'} = %.5e;\n", $risetimea; 
    printf DB "\$db{'$cellname:load_delay:$in:$out:risetimeb'} = %.5e;\n", $risetimeb; 
    printf DB "\$db{'$cellname:load_delay:$in:$out:falltimea'} = %.5e;\n", $falltimea; 
    printf DB "\$db{'$cellname:load_delay:$in:$out:falltimeb'} = %.5e;\n", $falltimeb; 
@


1.10
log
@Using my and use instead of local and require.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.9 1998/08/18 09:33:00 ryu Exp ryu $
d346 1
a346 1
    ($type, $in, $out, $run_name) = @@_;
d407 2
d477 34
@


1.9
log
@Debugged clock to q module; changed generated file convention
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.8 1998/08/17 02:41:17 ryu Exp ryu $
d53 1
a53 1
    local ($fp) = @@_;
d68 1
a68 1
    local ($fp, $type) = @@_;
d106 5
a110 4
    local($fp, $type, $in, $out, $tie, $tie_list) = @@_;
    local($port, $portname, $porttype);
    local($buf, $port_no, $outload, @@output_loads);
    local($vcvs, @@vcvs_list, $refname);
d230 1
a230 1
    local($fp, $type) = @@_;
d305 1
a305 1
    local($fp) = @@_;
d314 2
a315 2
    local($fp) = @@_;
    local($i);
d328 2
a329 2
    local($run_name) = @@_;
    local($base,$dir,$type,$spiceout);
d347 3
a349 1
    local($base,$dir,$ext,$spiceout);
a351 1
    local($i);
d415 1
a415 1
    local($scaled) = @@_;
d417 6
a422 6
    local($risetimea, $risetimeb, $risetimer2);
    local($falltimea, $falltimeb, $falltimer2);
    local($tplha, $tplhb, $tplhr2);
    local($tphla, $tphlb, $tphlr2);
    # local($inputrisea, $inputriseb, $inputriser2);
    # local($inputfalla, $inputfallb, $inputfallr2);
@


1.8
log
@Debuggin
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.7 1998/08/16 13:37:40 ryu Exp ryu $
d25 1
a25 1
    $run_name = &run_file_name($cellname, $in, $out);
d335 1
a335 1
	printf STDERR "\"%s\" found, skipping run.\n", $spiceout;
d353 2
@


1.7
log
@checking in
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.6 1998/08/15 21:23:36 ryu Exp ryu $
a37 1
    &ld_print_load (SPICEIN, $type);
d108 1
a108 1
    local($buf, $port_no, @@output_loads);
a206 7
}


sub ld_print_load {

    local($fp, $type) = @@_;
    local($outload);
d335 1
a335 1
	printf STDERR "\"%s\" found.\n", $spiceout;
a336 1
	printf STDERR "\"%s\" not found.\n", $spiceout;
a347 2
    local($tplha, $tplhb, $tplhr2);
    local($tphla, $tphlb, $tphlr2);
a348 4
    local($risetimea, $risetimeb, $risetimer2);
    local($falltimea, $falltimeb, $falltimer2);
    local($inputrisea, $inputriseb, $inputriser2);
    local($inputfalla, $inputfallb, $inputfallr2);
d386 1
a386 1
    &ld_report_spice_1();
d400 1
a400 1
	&ld_report_spice_1();
d411 8
d432 6
a437 6
    if ($#inputrise == $#creal) {
	($inputrisea, $inputriseb, $inputriser2) = &linreg('lin', @@creal, @@inputrise);
    }
    if ($#inputfall == $#creal) {
	($inputfalla, $inputfallb, $inputfallr2) = &linreg('lin', @@creal, @@inputfall);
    }
d450 1
a450 1
    printf OUT "    [F]\t\t[s]\t\t[s]\t\t[s]\t\t[s]\t\t[s]\t\t[s]\n";
d466 5
a470 4
    printf OUT "    Inputrise\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	$inputrisea, $inputriseb, $inputriser2;
    printf OUT "    Inputfall\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	$inputfalla, $inputfallb, $inputfallr2;
@


1.6
log
@Renamed curve_fit to linreg; will add multivariable curve fitting later on.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.5 1998/08/15 21:21:23 ryu Exp ryu $
d23 1
a23 1
    local($devices, $run_name);
d74 2
a75 2
	($type eq '^^') ||
	($type eq '^v')) {
d89 2
a90 2
	($type eq 'v^') ||
	($type eq 'vv')) {
d109 1
a109 1
    local($buf, $port_no, $outload, @@output_loads);
d124 2
a125 2
	($type eq '^^') ||
	($type eq '^v')) {
d143 1
a143 1
		if (($type eq 'non_inverting') || ($type eq '^^')) {
d165 2
a166 2
	($type eq 'v^') ||
	($type eq 'vv')) {
d184 1
a184 1
		if (($type eq 'non_inverting') || ($type eq 'vv')) {
d214 1
d219 2
a220 2
	($type eq '^^') ||
	($type eq 'v^')) {
d225 2
a226 2
	($type eq '^v') ||
	($type eq 'vv')) {
d243 1
a243 1
    if (($type eq 'non_inverting') || ($type eq '^^')) {
d249 1
a249 1
    if (($type eq 'non_inverting') || ($type eq 'vv')) {
d255 1
a255 1
    if (($type eq 'inverting') || ($type eq 'v^')) {
d261 1
a261 1
    if (($type eq 'inverting') || ($type eq '^v')) {
d271 2
a272 2
	($type eq '^^') ||
	($type eq 'v^')) {
d280 2
a281 2
	($type eq 'vv') ||
	($type eq '^v')) {
d291 2
a292 2
	($type eq '^^') ||
	($type eq '^v')) {
d300 2
a301 2
	($type eq 'vv') ||
	($type eq 'v^')) {
@


1.5
log
@Added measurement of input rise and fall time.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.4 1998/08/15 10:11:18 ryu Exp ryu $
d427 1
a427 1
	($tplha, $tplhb, $tplhr2) = &curve_fit('lin', @@creal, @@tplh);
d430 1
a430 1
	($tphla, $tphlb, $tphlr2) = &curve_fit('lin', @@creal, @@tphl);
d433 1
a433 1
	($risetimea, $risetimeb, $risetimer2) = &curve_fit('lin', @@creal, @@risetime);
d436 1
a436 1
	($falltimea, $falltimeb, $falltimer2) = &curve_fit('lin', @@creal, @@falltime);
d439 1
a439 1
	($inputrisea, $inputriseb, $inputriser2) = &curve_fit('lin', @@creal, @@inputrise);
d442 1
a442 1
	($inputfalla, $inputfallb, $inputfallr2) = &curve_fit('lin', @@creal, @@inputfall);
@


1.4
log
@added input_cap sub
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.3 1998/08/13 09:08:03 ryu Exp ryu $
d241 1
d267 1
d286 20
d358 1
d361 2
d382 6
d391 5
d399 27
d438 6
d451 2
d455 6
a460 4
    printf OUT "Cellname:\t\"$cellname\"\n";
    printf OUT "Input:\t\t\"$in\"\n";
    printf OUT "Output:\t\t\"$out\"\n";
    printf OUT "Transition:\t\"$type\"\n";
a461 7
    printf OUT "\n";
    printf OUT "    Cload\tTplh\t\tTphl\t\tRiseTime\tFallTime\n";
    printf OUT "    [F]\t\t[s]\t\t[s]\t\t[s]\t\t[s]\n";
    printf OUT "    ----------\t----------\t----------\t----------\t----------\n";
    for ($i = 0; $i <= $#creal; $i++) {
	printf OUT "    %.4e\t%.4e\t%.4e\t%.4e\t%.4e\n",
	    $creal[$i], $tplh[$i], $tphl[$i], $risetime[$i], $falltime[$i];
d472 4
a475 51
    printf OUT "\n\n";


    # report it again, this time scaled.
    if (($init{'scale_cload'} != 1) || ($init{'scale_delay'} != 1)) {

	@@creal = &scale_list($init{'scale_cload'}, @@creal);
	@@tplh = &scale_list($init{'scale_delay'}, @@tplh);
	@@tphl = &scale_list($init{'scale_delay'}, @@tphl);
	@@risetime = &scale_list($init{'scale_delay'}, @@risetime);
	@@falltime = &scale_list($init{'scale_delay'}, @@falltime);

	if ($debug) {
	    &dump_list (creal, @@creal);
	    &dump_list (tplh, @@tplh);
	    &dump_list (tphl, @@tphl);
	    &dump_list (risetime, @@risetime);
	    &dump_list (falltime, @@falltime);
	}

	if ($#tplh == $#creal) {
	    ($tplha, $tplhb, $tplhr2) = &curve_fit('lin', @@creal, @@tplh);
	}
	if ($#tphl == $#creal) {
	    ($tphla, $tphlb, $tphlr2) = &curve_fit('lin', @@creal, @@tphl);
	}
	if ($#risetime == $#creal) {
	    ($risetimea, $risetimeb, $risetimer2) = &curve_fit('lin', @@creal, @@risetime);
	}
	if ($#falltime == $#creal) {
	    ($falltimea, $falltimeb, $falltimer2) = &curve_fit('lin', @@creal, @@falltime);
	}

	printf OUT "    Scaled:\n\n";
	printf OUT "    Cload\tTplh\t\tTphl\t\tRiseTime\tFallTime\n";
	printf OUT "    ----------\t----------\t----------\t----------\t----------\n";
	for ($i = 0; $i <= $#creal; $i++) {
	    printf OUT "    %.4e\t%.4e\t%.4e\t%.4e\t%.4e\n",
		$creal[$i], $tplh[$i], $tphl[$i], $risetime[$i], $falltime[$i];
	}
	printf OUT "\n";
	printf OUT "    Tplh\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	    $tplha, $tplhb, $tplhr2;
	printf OUT "    Tphl\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	    $tphla, $tphlb, $tphlr2;
	printf OUT "    Risetime\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	    $risetimea, $risetimeb, $risetimer2;
	printf OUT "    Falltime\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
	    $falltimea, $falltimeb, $falltimer2;
	printf OUT "\n\n";
    }
@


1.3
log
@Added scaling of cload, delay.
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.2 1998/08/13 08:21:40 ryu Exp ryu $
d14 7
a20 1
sub load_delay {
d30 1
a210 82
#   lookup_input --
#	GIven a port, figure out if it makes reference to
#	another port, or how to tie it, either to high or low.
#	Modifies variables $port_no and @@vcvs_list
sub lookup_input {

    local($port, $in, $refname, $tie, @@tie_list) = @@_;
    local($expression, $str);

    if ($equivalent{$port} eq $in) {
	$str = sprintf ("e%s equiv_%s %s %s %s +1",
	    $port_no, $port_no, $init{'low'}, $refname, $init{'low'});
	push(@@vcvs_list, $str);
	return ('equiv_' . $port_no++);
    }
    if ($differential{$port} eq $in) {
	$str = sprintf ("e%s diff_%s %s %s %s -1",
	    $port_no, $port_no, $init{'low'}, $refname, $init{'low'});
	push(@@vcvs_list, $str);
	return ('diff_' . $port_no++);
    }

    foreach $expression (@@tie_list) {
	if ($port =~ /$expression/) {
	    if ($tie eq 'tie_high') {
		return $init{'high_node'};
	    } else {
		return $init{'low_node'};
	    }
	} else {
	    # does not match any expression,
	    # so tie it to the opposite
	    if ($tie eq 'tie_high') {
		return $init{'low_node'};
	    } else {
		return $init{'high_node'};
	    }
	}
    }
}


#
#   lookup_output_load --
#	Modifies variables $port_no and @@output_loads
#
sub lookup_output_load {

    local($port) = @@_;
    local($lookup, $load_type, $load_value);
    local($str);

    $lookup = $load{$port};

    if ($lookup eq '') {
	$lookup = $load{'default'};
    } 
    if ($lookup eq 'none') {
	return ('nc_' . $port_no++);;
    } else {
	($load_type, $load_value) = split(':', $lookup);
	if ($load_type eq 'cap') {
	    $str = sprintf ("c%s out_%s %s %s",
		$port_no, $port_no, $init{'low'}, $load_value);
	    push(@@output_loads, $str);
	    return ('out_' . $port_no++);
	}
	if ($load_type eq 'res') {
	    $str = sprintf ("r%s out_%s %s %s",
		$port_no, $port_no, $init{'low'}, $load_value);
	    push(@@output_loads, $str);
	    return ('out_' . $port_no++);
	}
	if ($load_type eq 'subckt') {
	    $str = sprintf ("x%s out_%s %s",
		$port_no, $port_no, $load_value);
	    push(@@output_loads, $str);
	    return ('out_' . $port_no++);
	}
    }
}

d286 1
d294 1
@


1.2
log
@Added support for differential and equivalent input signals
@
text
@d9 1
a9 1
#	$Id: load_delay.pl,v 1.1 1998/08/13 07:17:04 ryu Exp ryu $
d41 1
a41 1
    &ld_extract_spice($type, $in, $out, $run_name);
d402 1
a402 1
sub ld_extract_spice {
d434 1
a434 1
    @@creal = &scale_values(@@cload);
d480 50
@


1.1
log
@entered into RCS
@
text
@d5 1
a5 1
#	No part of this program may be reproduced, stored in a 
d9 1
a9 1
#	$Id$
d61 1
d99 1
d103 1
d120 2
d145 1
a145 1
		    &lookup_input_tie($portname, $tie, @@tie_list);
d161 2
d186 1
a186 1
		    &lookup_input_tie($portname, $tie, @@tie_list);
a195 2
}

d197 3
a199 18
sub ld_print_load {
    local($fp, $type) = @@_;

    printf $fp "\n*--- LOADS ---------------------------------------------------\n";
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq '^^') ||
	($type eq 'v^')) {
	printf $fp "cloadr outputr $init{'low'} cload\n";
    }
    if (($type eq 'inverting') ||
	($type eq 'non_inverting') ||
	($type eq '^v') ||
	($type eq 'vv')) {
	printf $fp "cloadf outputf $init{'low'} cload\n";
    }
    foreach $outload (@@output_loads) {
	printf $fp "$outload\n";
d204 21
a224 3
sub lookup_input_tie {
    local($port, $tie, @@tie_list) = @@_;
    local($expression);
d247 1
d251 1
d266 1
a266 1
	    $str = sprintf ("c%s out%s %s %s",
d269 1
a269 1
	    return ('out' . $port_no++);
d272 1
a272 1
	    $str = sprintf ("r%s out%s %s %s",
d275 1
a275 1
	    return ('out' . $port_no++);
d278 1
a278 1
	    $str = sprintf ("x%s out%s %s",
d281 1
a281 1
	    return ('out' . $port_no++);
d286 22
d310 1
d362 1
d370 1
d384 1
@
# Change User Description Committed
#1 6489 robert_yu Saved here.