model.pl,v #1

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


desc
@dump_celldata
@


1.26
log
@Added "section" support
@
text
@#	$Id: model.pl,v 1.25 1999/01/20 07:44:59 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.

sub print_model {
    my($format, $modelname) = @@_;

    open(MODEL, "> $modelname") || die "ERROR:  Cannot create file '$modelname'.\n";

    if ($format eq 'synopsys') {
	&print_synopsys(MODEL);
    } elsif ($format eq 'pearl') {
	&print_pearl(MODEL);
    } else {
	die "ERROR: unknown model format type '$format'.\n";
    }
    close(MODEL);
    printf STDERR "Created '$modelname'.\n";
}


sub print_synopsys_cellprops {
    my($fp) = @@_;
    my ($key, $cell, $type, $propname);

    foreach $key (keys(%celldata)) {
	($cell, $type, $propname) = split(':', $key);
	if (($cell eq $cellname) && ($type eq 'cellprop')) {
	    # treat 'section' properties differently
	    if ($propname eq 'section') {
		printf $fp "\t%s\n",
		    $celldata{"$cellname:cellprop:$propname"};
	    } else {
		printf $fp "\t%s : %s ;\n",
		    $propname, $celldata{"$cellname:cellprop:$propname"};
	    }
	}
    }
}

sub print_synopsys_termprops {
    my($fp, $refterm) = @@_;
    my ($key, $cell, $type, $termname, $propname);

    foreach $key (keys(%celldata)) {
	($cell, $type, $termname, $propname) = split(':', $key);
	if (($cell eq $cellname) && ($type eq 'termprop') && ($termname eq $refterm)) {
	    printf $fp "\t    %s : %s ;\n",
		$propname, $celldata{"$cellname:termprop:$termname:$propname"};
	}
    }
}


sub print_synopsys {
    my ($fp) = @@_;
    my ($term);
    my ($termname, $termtype);

    printf $fp "/*\n";
    &print_header($fp, ' *');
    printf $fp " */\n\n";

    printf $fp "    cell( \"$cellname\" ) {\n";

    &print_synopsys_cellprops($fp);

    # print terms
    foreach $term (@@termlist) {
	($termname, $termtype) = split(':', $term);

	printf $fp "\tpin( \"$termname\" ) {\n";
	&print_synopsys_termprops($fp, $termname);

	if ($termtype eq 'i') {
	    printf $fp "\t    direction : input ;\n";
	    printf $fp "\t    capacitance : %.4e ;\n",
		$celldata{"$cellname:input_cap:$termname"}
		if $celldata{"$cellname:input_cap:$termname"};
	    &print_synopsys_input_timing($fp, $termname);
	    printf $fp "\t}\n";
	    next;
	}
	if ($termtype eq 'o') {
	    printf $fp "\t    direction : output ;\n";
	    &print_synopsys_output_timing($fp, $termname);
	    printf $fp "\t}\n";
	    next;
	}
    }

    printf $fp "    }\n";
}


sub print_synopsys_input_timing {
    my($fp, $input) = @@_;
    my ($term);
    my ($clock, $termtype);
    my ($i, @@wcvalue);

    foreach $term (@@termlist) {
	($clock, $termtype) = split(':', $term);
	if ($termtype eq 'i') {

	    # D SETUP
	    if ($celldata{"$cellname:setup_hold:$input:$clock:setup"}) {
		printf $fp "\t    timing () {\n";
		printf $fp "\t\trelated_pin : \"$clock\" ;\n";

		if ($celldata{"$cellname:setup_hold:$input:$clock:clktype"} eq 'rising') {
		    printf $fp "\t\ttiming_type : setup_rising ;\n";
		} elsif ($celldata{"$cellname:setup_hold:$input:$clock:clktype"} eq 'falling') {
		    printf $fp "\t\ttiming_type : setup_falling ;\n";
		} else {
		    printf STDERR "WARNING: unknown clock type '$clktype'.\n";
		}

		if ($#slewrate == -1) {
		    # only one value
		    printf $fp "\t\tintrinsic_rise : %.4e ;\n",
			$celldata{"$cellname:setup_hold:$input:$clock:setup_lh[0]"}
			if $celldata{"$cellname:setup_hold:$input:$clock:setup_lh[0]"};
		    printf $fp "\t\tintrinsic_fall : %.4e ;\n",
			$celldata{"$cellname:setup_hold:$input:$clock:setup_hl"}[0]
			if $celldata{"$cellname:setup_hold:$input:$clock:setup_hl"}[0];
		    printf $fp "\t    }\n";
		} else {
		    # all values
		    printf $fp "\t\trise_constraint (%s) {\n",
			$celldata{"$cellname:setup_hold:$input:$clock:lu_table"};
		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#slewrate; $i++) {
			printf $fp "%.4e", $celldata{"$cellname:setup_hold:$input:$clock:setup_lh"}[$i];
			printf $fp ", " unless ($i == $#slewrate);
		    }
		    printf $fp "\")\n\t\t}\n";

		    printf $fp "\t\tfall_constraint (%s) {\n",
			$celldata{"$cellname:setup_hold:$input:$clock:lu_table"};
		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#slewrate; $i++) {
			printf $fp "%.4e", $celldata{"$cellname:setup_hold:$input:$clock:setup_hl"}[$i];
			printf $fp ", " unless ($i == $#slewrate);
		    }
		    printf $fp "\")\n\t\t}\n";
		    printf $fp "\t    }\n";
		}
	    }

	    # D HOLD
	    if ($celldata{"$cellname:setup_hold:$input:$clock:hold"}) {
		printf $fp "\t    timing () {\n";
		printf $fp "\t\trelated_pin : \"$clock\" ;\n";

		if ($celldata{"$cellname:setup_hold:$input:$clock:clktype"} eq 'rising') {
		    printf $fp "\t\ttiming_type : hold_rising ;\n";
		} elsif ($celldata{"$cellname:setup_hold:$input:$clock:clktype"} eq 'falling') {
		    printf $fp "\t\ttiming_type : hold_falling ;\n";
		} else {
		    printf STDERR "WARNING: unknown clock type '$clktype'.\n";
		}

		if ($#slewrate == -1) {
		    # only one value
		    printf $fp "\t\tintrinsic_rise : %.4e ;\n",
			$celldata{"$cellname:setup_hold:$input:$clock:hold_lh[0]"}
			if $celldata{"$cellname:setup_hold:$input:$clock:hold_lh[0]"};
		    printf $fp "\t\tintrinsic_fall : %.4e ;\n",
		    $celldata{"$cellname:setup_hold:$input:$clock:hold_hl[0]"}
			if $celldata{"$cellname:setup_hold:$input:$clock:hold_hl[0]"};
		    printf $fp "\t    }\n";
		} else {
		    # all values
		    printf $fp "\t\trise_constraint (%s) {\n",
			$celldata{"$cellname:setup_hold:$input:$clock:lu_table"};
		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#slewrate; $i++) {
			printf $fp "%.4e", $celldata{"$cellname:setup_hold:$input:$clock:hold_lh"}[$i];
			printf $fp ", " unless ($i == $#slewrate);
		    }
		    printf $fp "\")\n\t\t}\n";

		    printf $fp "\t\tfall_constraint (%s) {\n",
			$celldata{"$cellname:setup_hold:$input:$clock:lu_table"};
		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#slewrate; $i++) {
			printf $fp "%.4e", $celldata{"$cellname:setup_hold:$input:$clock:hold_hl"}[$i];
			printf $fp ", " unless ($i == $#slewrate);
		    }
		    printf $fp "\")\n\t\t}\n";
		    printf $fp "\t    }\n";
		}
	    }

	    # CE SETUP
	    if ($celldata{"$cellname:clock_enable:$input:$clock:setup"}) {
		printf $fp "\t    timing () {\n";
		printf $fp "\t\trelated_pin : \"$clock\" ;\n";

		if ($celldata{"$cellname:clock_enable:$input:$clock:clktype"} eq 'rising') {
		    printf $fp "\t\ttiming_type : setup_rising ;\n";
		} elsif ($celldata{"$cellname:clock_enable:$input:$clock:clktype"} eq 'falling') {
		    printf $fp "\t\ttiming_type : setup_falling ;\n";
		} else {
		    printf STDERR "WARNING: unknown clock type '$clktype'.\n";
		}

		if ($#slewrate == -1) {
		    # only one value
		    if ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_high') {
			printf $fp "\t\tintrinsic_rise : ";
		    } elsif ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_low') {
			printf $fp "\t\tintrinsic_fall : ";
		    } else {
			printf STDERR "WARNING: unknown ce type '$cetype'.\n";
		    }
		    printf $fp "%.4e ;\n",
			&max($celldata{"$cellname:clock_enable:$input:$clock:setup_lh[0]"},
			     $celldata{"$cellname:clock_enable:$input:$clock:setup_hl[0]"});
		    printf $fp "\t    }\n";
		} else {
		    # all values
		    @@wcvalue = &bigger_avg_list(
			$celldata{"$cellname:clock_enable:$input:$clock:setup_lh"},
			$celldata{"$cellname:clock_enable:$input:$clock:setup_hl"});

		    if ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_high') {
			printf $fp "\t\trise_constraint (%s) {\n",
			    $celldata{"$cellname:clock_enable:$input:$clock:lu_table"};
		    } elsif ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_low') {
			printf $fp "\t\tfall_constraint (%s) {\n",
			    $celldata{"$cellname:clock_enable:$input:$clock:lu_table"};
		    } else {
			printf STDERR "WARNING: unknown ce type '$cetype'.\n";
		    }

		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#slewrate; $i++) {
			printf $fp "%.4e", $wcvalue[$i];
			printf $fp ", " unless ($i == $#slewrate);
		    }
		    printf $fp "\")\n\t\t}\n";
		    printf $fp "\t    }\n";
		}
	    }

	    # CE HOLD
	    if ($celldata{"$cellname:clock_enable:$input:$clock:hold"}) {
		printf $fp "\t    timing () {\n";
		printf $fp "\t\trelated_pin : \"$clock\" ;\n";

		if ($celldata{"$cellname:clock_enable:$input:$clock:clktype"} eq 'rising') {
		    printf $fp "\t\ttiming_type : hold_rising ;\n";
		} elsif ($celldata{"$cellname:clock_enable:$input:$clock:clktype"} eq 'falling') {
		    printf $fp "\t\ttiming_type : hold_falling ;\n";
		} else {
		    printf STDERR "WARNING: unknown clock type '$clktype'.\n";
		}

		if ($#slewrate == -1) {
		    # only one value
		    if ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_high') {
			printf $fp "\t\tintrinsic_rise : ";
		    } elsif ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_low') {
			printf $fp "\t\tintrinsic_fall : ";
		    } else {
			printf STDERR "WARNING: unknown ce type '$cetype'.\n";
		    }
		    printf $fp "%.4e ;\n",
			&max($celldata{"$cellname:clock_enable:$input:$clock:hold_lh"},
			     $celldata{"$cellname:clock_enable:$input:$clock:hold_hl"});
		    printf $fp "\t    }\n";
		} else {
		    # all values
		    @@wcvalue = &bigger_avg_list(
			$celldata{"$cellname:clock_enable:$input:$clock:hold_lh"},
			$celldata{"$cellname:clock_enable:$input:$clock:hold_hl"});

		    if ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_high') {
			printf $fp "\t\trise_constraint (%s) {\n",
			    $celldata{"$cellname:clock_enable:$input:$clock:lu_table"};
		    } elsif ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_low') {
			printf $fp "\t\tfall_constraint (%s) {\n",
			    $celldata{"$cellname:clock_enable:$input:$clock:lu_table"};
		    } else {
			printf STDERR "WARNING: unknown ce type '$cetype'.\n";
		    }

		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#slewrate; $i++) {
			printf $fp "%.4e", $wcvalue[$i];
			printf $fp ", " unless ($i == $#slewrate);
		    }
		    printf $fp "\")\n\t\t}\n";
		    printf $fp "\t    }\n";
		}
	    }
	}
    }
}


sub print_synopsys_output_timing {
my ($fp, $output) = @@_;
    my ($term);
    my ($input, $termtype);
    my ($i, $j, $k);

    foreach $term (@@termlist) {
	($input, $termtype) = split(':', $term);
	if ($termtype eq 'i') {

	    # LOAD DELAY
	    if ($celldata{"$cellname:load_delay:$input:$output"}) {

		printf $fp "\t    timing () {\n";
		printf $fp "\t\trelated_pin : \"$input\" ;\n";
		if ($#slewrate == -1) {

		    # linear model
		    printf $fp "\t\tintrinsic_rise : %.4e ;\n",
			$celldata{"$cellname:load_delay:$input:$output:tplha"}
			if $celldata{"$cellname:load_delay:$input:$output:tplha"};
		    printf $fp "\t\tintrinsic_fall : %.4e ;\n",
			$celldata{"$cellname:load_delay:$input:$output:tphla"}
			if $celldata{"$cellname:load_delay:$input:$output:tphla"};
		    printf $fp "\t\trise_resistance : %.4e ;\n",
			$celldata{"$cellname:load_delay:$input:$output:tplhb"}
			if $celldata{"$cellname:load_delay:$input:$output:tplhb"};
		    printf $fp "\t\tfall_resistance : %.4e ;\n",
			$celldata{"$cellname:load_delay:$input:$output:tphlb"}
			if $celldata{"$cellname:load_delay:$input:$output:tphlb"};

		} else {

		    # nonlinear model
		    printf $fp "\t\ttiming_type : combinational ;\n";

		    if ($celldata{"$cellname:load_delay:$input:$output:tplh"}) {
			printf $fp "\t\trise_propagation (%s) {",
			    $celldata{"$cellname:load_delay:$input:$output:lu_table"};

			if ($output_prop_percent == 0.50) {
			    printf $fp "\n\t\t    /* Actual measurement values:";
			}

			printf $fp "\n\t\t    values ( \\";
			$k = 0;
			for ($j = 0; $j <= $#slewrate; $j++) {
			    printf $fp "\n\t\t\t\"";
			    for ($i = 0; $i <= $#cload; $i++) {
				printf $fp "%.4e",
				    $celldata{"$cellname:load_delay:$input:$output:tplh"}[$k++];
				printf $fp " " unless ($i == $#cload);
			    }
			    printf $fp "\"";
			    printf $fp "," unless ($j == $#slewrate);
			    printf $fp " \\";
			}
			printf $fp "\n\t\t    )";

			if ($output_prop_percent == 0.50) {
			    printf $fp "\n\t\t    */";

			    printf $fp "\n\t\t    /* Propagation minus rise transition delay: */";
			    printf $fp "\n\t\t    values ( \\";
			    $k = 0;
			    for ($j = 0; $j <= $#slewrate; $j++) {
				printf $fp "\n\t\t\t\"";
				for ($i = 0; $i <= $#cload; $i++) {
				    # subtract the risetime from tplh
				    printf $fp "%.4e",
					($celldata{"$cellname:load_delay:$input:$output:tplh"}[$k] -
					 $celldata{"$cellname:load_delay:$input:$output:risetime"}[$k]);
				    $k++;
				    printf $fp " " unless ($i == $#cload);
				}
				printf $fp "\"";
				printf $fp "," unless ($j == $#slewrate);
				printf $fp " \\";
			    }
			    printf $fp "\n\t\t    )";
			}

			printf $fp "\n\t\t}\n";
		    }

		    if ($celldata{"$cellname:load_delay:$input:$output:tphl"}) {
			printf $fp "\t\tfall_propagation (%s) {",
			    $celldata{"$cellname:load_delay:$input:$output:lu_table"};

			if ($output_prop_percent == 0.50) {
			    printf $fp "\n\t\t    /* Actual measurement values:";
			}

			printf $fp "\n\t\t    values ( \\";
			$k = 0;
			for ($j = 0; $j <= $#slewrate; $j++) {
			    printf $fp "\n\t\t\t\"";
			    for ($i = 0; $i <= $#cload; $i++) {
				printf $fp "%.4e",
				    $celldata{"$cellname:load_delay:$input:$output:tphl"}[$k++];
				printf $fp " " unless ($i == $#cload);
			    }
			    printf $fp "\"";
			    printf $fp "," unless ($j == $#slewrate);
			    printf $fp " \\";
			}
			printf $fp "\n\t\t    )";

			if ($output_prop_percent == 0.50) {
			    printf $fp "\n\t\t    */";

			    printf $fp "\n\t\t    /* Propagation minus fall transition delay: */";
			    printf $fp "\n\t\t    values ( \\";
			    $k = 0;
			    for ($j = 0; $j <= $#slewrate; $j++) {
				printf $fp "\n\t\t\t\"";
				for ($i = 0; $i <= $#cload; $i++) {
				    printf $fp "%.4e",
					($celldata{"$cellname:load_delay:$input:$output:tphl"}[$k] -
					 $celldata{"$cellname:load_delay:$input:$output:falltime"}[$k]);
				    $k++;
				    printf $fp " " unless ($i == $#cload);
				}
				printf $fp "\"";
				printf $fp "," unless ($j == $#slewrate);
				printf $fp " \\";
			    }
			    printf $fp "\n\t\t    )";
			}

			printf $fp "\n\t\t}\n";
		    }

		    if ($celldata{"$cellname:load_delay:$input:$output:risetime"}) {
			printf $fp "\t\trise_transition (%s) {\n",
			    $celldata{"$cellname:load_delay:$input:$output:lu_table"};
			printf $fp "\t\t    values ( \\";

			$k = 0;
			for ($j = 0; $j <= $#slewrate; $j++) {
			    printf $fp "\n\t\t\t\"";
			    for ($i = 0; $i <= $#cload; $i++) {
				printf $fp "%.4e",
				    $celldata{"$cellname:load_delay:$input:$output:risetime"}[$k++];
				printf $fp " " unless ($i == $#cload);
			    }
			    printf $fp "\"";
			    printf $fp "," unless ($j == $#slewrate);
			    printf $fp " \\";
			}
			printf $fp "\n\t\t    )";
			printf $fp "\n\t\t}\n";
		    }

		    if ($celldata{"$cellname:load_delay:$input:$output:falltime"}) {
			printf $fp "\t\tfall_transition (%s) {\n",
			    $celldata{"$cellname:load_delay:$input:$output:lu_table"};
			printf $fp "\t\t    values ( \\";

			$k = 0;
			for ($j = 0; $j <= $#slewrate; $j++) {
			    printf $fp "\n\t\t\t\"";
			    for ($i = 0; $i <= $#cload; $i++) {
				printf $fp "%.4e",
				    $celldata{"$cellname:load_delay:$input:$output:falltime"}[$k++];
				printf $fp " " unless ($i == $#cload);
			    }
			    printf $fp "\"";
			    printf $fp "," unless ($j == $#slewrate);
			    printf $fp " \\";
			}
			printf $fp "\n\t\t    )";
			printf $fp "\n\t\t}\n";
		    }
		}

		printf $fp "\t    }\n";
	    }

	    # CLOCK Q
	    if ($celldata{"$cellname:clock_q:$input:$output"}) {
		printf $fp "\t    timing () {\n";
		printf $fp "\t\trelated_pin : \"$input\" ;\n";

		if ($celldata{"$cellname:clock_q:$input:$output:clktype"} eq 'rising') {
		    printf $fp "\t\ttiming_type : rising_edge ;\n";
		} elsif ($celldata{"$cellname:clock_q:$input:$output:clktype"} eq 'falling') {
		    printf $fp "\t\ttiming_type : falling_edge ;\n";
		} else {
		    printf STDERR "WARNING: unknown clock type '$clktype'.\n";
		}

		if ($timing_model eq 'linear') {

		    printf $fp "\t\tintrinsic_rise : %.4e ;\n",
			$celldata{"$cellname:clock_q:$input:$output:clk_q_lha"}
			if $celldata{"$cellname:clock_q:$input:$output:clk_q_lha"};
		    printf $fp "\t\tintrinsic_fall : %.4e ;\n",
			$celldata{"$cellname:clock_q:$input:$output:clk_q_hla"}
			if $celldata{"$cellname:clock_q:$input:$output:clk_q_hla"};
		    printf $fp "\t\trise_resistance : %.4e ;\n",
			$celldata{"$cellname:clock_q:$input:$output:clk_q_lhb"}
			if $celldata{"$cellname:clock_q:$input:$output:clk_q_lhb"};
		    printf $fp "\t\tfall_resistance : %.4e ;\n",
			$celldata{"$cellname:clock_q:$input:$output:clk_q_hlb"}
			if $celldata{"$cellname:clock_q:$input:$output:clk_q_hlb"};
		    printf $fp "\t    }\n";

		} elsif ($timing_model eq 'non_linear') {

		    printf $fp "\t\trise_propagation (%s) {\n",
			$celldata{"$cellname:clock_q:$input:$output:lu_table"};
		    if ($output_prop_percent == 0.50) {
			printf $fp "\t\t    /* Actual measurement values:\n";
		    }
		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#cload; $i++) {
			printf $fp "%.4e", $celldata{"$cellname:clock_q:$input:$output:clk_q_lh"}[$i];
			printf $fp ", " unless ($i == $#cload);
		    }
		    printf $fp "\")\n";
		    if ($output_prop_percent == 0.50) {
			printf $fp "\t\t    */\n";
			printf $fp "\t\t    /* Propagation minus rise transition delay: */\n";
			printf $fp "\t\t    values (\"";
			for ($i = 0; $i <= $#cload; $i++) {
			    printf $fp "%.4e",
				($celldata{"$cellname:clock_q:$input:$output:clk_q_lh"}[$i] -
				$celldata{"$cellname:clock_q:$input:$output:risetime"}[$i]);
			    printf $fp ", " unless ($i == $#cload);
			}
			printf $fp "\")\n";
		    }
		    printf $fp "\t\t}\n";

		    printf $fp "\t\trise_transition (%s) {\n",
			$celldata{"$cellname:clock_q:$input:$output:lu_table"};
		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#cload; $i++) {
			printf $fp "%.4e", $celldata{"$cellname:clock_q:$input:$output:risetime"}[$i];
			printf $fp ", " unless ($i == $#cload);
		    }
		    printf $fp "\")\n\t\t}\n";

		    printf $fp "\t\tfall_propagation (%s) {\n",
			$celldata{"$cellname:clock_q:$input:$output:lu_table"};
		    if ($output_prop_percent == 0.50) {
			printf $fp "\t\t    /* Actual measurement values:\n";
		    }
		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#cload; $i++) {
			printf $fp "%.4e", $celldata{"$cellname:clock_q:$input:$output:clk_q_hl"}[$i];
			printf $fp ", " unless ($i == $#cload);
		    }
		    printf $fp "\")\n";
		    if ($output_prop_percent == 0.50) {
			printf $fp "\t\t    */\n";
			printf $fp "\t\t    /* Propagation minus rise transition delay: */\n";
			printf $fp "\t\t    values (\"";
			for ($i = 0; $i <= $#cload; $i++) {
			    printf $fp "%.4e",
				($celldata{"$cellname:clock_q:$input:$output:clk_q_hl"}[$i] -
				$celldata{"$cellname:clock_q:$input:$output:falltime"}[$i]);
			    printf $fp ", " unless ($i == $#cload);
			}
			printf $fp "\")\n";
		    }
		    printf $fp "\t\t}\n";

		    printf $fp "\t\tfall_transition (%s) {\n",
			$celldata{"$cellname:clock_q:$input:$output:lu_table"};
		    printf $fp "\t\t    values (\"";
		    for ($i = 0; $i <= $#cload; $i++) {
			printf $fp "%.4e", $celldata{"$cellname:clock_q:$input:$output:falltime"}[$i];
			printf $fp ", " unless ($i == $#cload);
		    }
		    printf $fp "\")\n\t\t}\n";
		    printf $fp "\t    }\n";

		} else {
		    printf STDERR "WARNING: unknown timing model type '$timing_model'.\n";
		}
	    }
	}
    }
}


1;

@


1.25
log
@No perl header
@
text
@d1 1
a1 1
#	$Id: model.pl,v 1.24 1999/01/14 10:19:02 ryu Exp ryu $
d47 8
a54 2
	    printf $fp "\t%s : %s ;\n",
		$propname, $celldata{"$cellname:cellprop:$propname"};
@


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

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


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


1.22
log
@typo
@
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: model.pl,v 1.21 1998/09/13 11:09:15 ryu Exp ryu $
#	Write different models.
#	Author: Robert K. Yu
d8 16
@


1.21
log
@wip
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.20 1998/09/13 04:40:51 ryu Exp ryu $
d133 2
a134 1
		    printf $fp "\t\trise_constraint ($lu_table_name) {\n";
d142 2
a143 1
		    printf $fp "\t\tfall_constraint ($lu_table_name) {\n";
d178 2
a179 1
		    printf $fp "\t\trise_constraint ($lu_table_name) {\n";
d187 2
a188 1
		    printf $fp "\t\tfall_constraint ($lu_table_name) {\n";
d232 2
a233 1
			printf $fp "\t\trise_constraint ($lu_table_name) {\n";
d235 2
a236 1
			printf $fp "\t\tfall_constraint ($lu_table_name) {\n";
d284 2
a285 1
			printf $fp "\t\trise_constraint ($lu_table_name) {\n";
d287 2
a288 1
			printf $fp "\t\tfall_constraint ($lu_table_name) {\n";
d344 2
a345 1
			printf $fp "\t\trise_propagation ($lu_table_name) {";
d393 2
a394 1
			printf $fp "\t\tfall_propagation ($lu_table_name) {";
d441 2
a442 1
			printf $fp "\t\trise_transition ($lu_table_name) {\n";
d462 2
a463 1
			printf $fp "\t\tfall_transition ($lu_table_name) {\n";
d517 2
a518 1
		    printf $fp "\t\trise_propagation ($lu_table_name) {\n";
d542 2
a543 1
		    printf $fp "\t\trise_transition ($lu_table_name) {\n";
d551 2
a552 1
		    printf $fp "\t\tfall_propagation ($lu_table_name) {\n";
d576 2
a577 1
		    printf $fp "\t\tfall_transition ($lu_table_name) {\n";
@


1.20
log
@Added slew rate dependence on clock enable
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.19 1998/09/13 03:48:42 ryu Exp ryu $
d148 1
d191 1
d241 1
d291 1
d568 1
@


1.19
log
@wip
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.18 1998/09/12 19:54:02 ryu Exp ryu $
d103 1
a103 1
    my ($i);
d125 2
a126 2
			$celldata{"$cellname:setup_hold:$input:$clock:setup_lh"}
			if $celldata{"$cellname:setup_hold:$input:$clock:setup_lh"};
d167 2
a168 2
			$celldata{"$cellname:setup_hold:$input:$clock:hold_lh"}
			if $celldata{"$cellname:setup_hold:$input:$clock:hold_lh"};
d170 2
a171 2
		    $celldata{"$cellname:setup_hold:$input:$clock:hold_hl"}
			if $celldata{"$cellname:setup_hold:$input:$clock:hold_hl"};
d206 34
a239 11
		if ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_high') {
		    printf $fp "\t\tintrinsic_rise : ";
		} elsif ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_low') {
		    printf $fp "\t\tintrinsic_fall : ";
		} else {
		    printf STDERR "WARNING: unknown ce type '$cetype'.\n";
		}
		printf $fp "%.4e ;\n",
		    &max($celldata{"$cellname:clock_enable:$input:$clock:setup_lh"},
			 $celldata{"$cellname:clock_enable:$input:$clock:setup_hl"});
		printf $fp "\t    }\n";
d255 34
a288 11
		if ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_high') {
		    printf $fp "\t\tintrinsic_rise : ";
		} elsif ($celldata{"$cellname:clock_enable:$input:$clock:cetype"} eq 'active_low') {
		    printf $fp "\t\tintrinsic_fall : ";
		} else {
		    printf STDERR "WARNING: unknown ce type '$cetype'.\n";
		}
		printf $fp "%.4e ;\n",
		    &max($celldata{"$cellname:clock_enable:$input:$clock:hold_lh"},
			 $celldata{"$cellname:clock_enable:$input:$clock:hold_hl"});
		printf $fp "\t    }\n";
a289 1

@


1.18
log
@Added slew-rate to setup and hold; support for non-linear models for clock-q
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.17 1998/09/08 13:16:49 ryu Exp ryu $
d439 1
d453 1
d457 3
d465 14
a478 1
		    printf $fp "\")\n\t\t}\n";
d489 3
d497 14
a510 1
		    printf $fp "\")\n\t\t}\n";
@


1.17
log
@slew rate at the clock input of setup_hold (wip)
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.16 1998/09/07 19:24:37 ryu Exp ryu $
d103 1
d109 1
d122 27
a148 7
		printf $fp "\t\tintrinsic_rise : %.4e ;\n",
		    $celldata{"$cellname:setup_hold:$input:$clock:setup_lh"}
		    if $celldata{"$cellname:setup_hold:$input:$clock:setup_lh"};
		printf $fp "\t\tintrinsic_fall : %.4e ;\n",
		    $celldata{"$cellname:setup_hold:$input:$clock:setup_hl"}
		    if $celldata{"$cellname:setup_hold:$input:$clock:setup_hl"};
		printf $fp "\t    }\n";
d150 2
d164 6
a169 4
		printf $fp "\t\tintrinsic_rise : %.4e ;\n",
		    $celldata{"$cellname:setup_hold:$input:$clock:hold_lh"}
		    if $celldata{"$cellname:setup_hold:$input:$clock:hold_lh"};
		printf $fp "\t\tintrinsic_fall : %.4e ;\n",
d171 20
a190 2
		    if $celldata{"$cellname:setup_hold:$input:$clock:hold_hl"};
		printf $fp "\t    }\n";
d193 1
d218 2
d259 2
d287 1
a287 1
			printf $fp "\t\trise_propagation ($init{'corner'}) {";
d289 1
a289 1
			if ($trans{'output_prop_percent'} == 0.50) {
d308 1
a308 1
			if ($trans{'output_prop_percent'} == 0.50) {
d335 1
a335 1
			printf $fp "\t\tfall_propagation ($init{'corner'}) {";
d337 1
a337 1
			if ($trans{'output_prop_percent'} == 0.50) {
d356 1
a356 1
			if ($trans{'output_prop_percent'} == 0.50) {
d382 1
a382 1
			printf $fp "\t\trise_transition ($init{'corner'}) {\n";
d402 1
a402 1
			printf $fp "\t\tfall_transition ($init{'corner'}) {\n";
d425 1
d438 51
a488 13
		printf $fp "\t\tintrinsic_rise : %.4e ;\n",
		    $celldata{"$cellname:clock_q:$input:$output:clk_q_lha"}
		    if $celldata{"$cellname:clock_q:$input:$output:clk_q_lha"};
		printf $fp "\t\tintrinsic_fall : %.4e ;\n",
		    $celldata{"$cellname:clock_q:$input:$output:clk_q_hla"}
		    if $celldata{"$cellname:clock_q:$input:$output:clk_q_hla"};
		printf $fp "\t\trise_resistance : %.4e ;\n",
		    $celldata{"$cellname:clock_q:$input:$output:clk_q_lhb"}
		    if $celldata{"$cellname:clock_q:$input:$output:clk_q_lhb"};
		printf $fp "\t\tfall_resistance : %.4e ;\n",
		    $celldata{"$cellname:clock_q:$input:$output:clk_q_hlb"}
		    if $celldata{"$cellname:clock_q:$input:$output:clk_q_hlb"};
		printf $fp "\t    }\n";
@


1.16
log
@Subtract transition from propagation delay if the prop delay
is already measured at 50% output.
@
text
@d3 1
a3 1
#	Copyright (c) 1998, Robert K. Yu.  All Rights Reserved.
d9 1
a9 1
#	$Id: model.pl,v 1.15 1998/09/07 11:48:29 ryu Exp $
@


1.15
log
@Subtract the transition delay from the prop delay if the output prop
delay measurement is not made at the 50% point.
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.14 1998/09/06 20:43:23 ryu Exp ryu $
d238 1
a238 2
			printf $fp "\t\trise_propagation ($init{'corner'}) {\n";
			printf $fp "\t\t    values ( \\";
d241 1
a241 1
			    printf $fp "\n\t\t\t/* Actual measurement values:";
d244 1
d257 1
d260 1
a260 1
			    printf $fp "\n\t\t\t*/";
d262 2
a263 1
			    printf $fp "\n\t\t\t/* Prop minus transition delay: */\n";
d279 1
a281 1
			printf $fp "\n\t\t    )\n";
d286 1
a286 2
			printf $fp "\t\tfall_propagation ($init{'corner'}) {\n";
			printf $fp "\t\t    values ( \\";
d289 1
a289 1
			    printf $fp "\n\t\t\t/* Actual measurement values:";
d292 1
d305 1
d308 1
a308 1
			    printf $fp "\n\t\t\t*/";
d310 2
a311 1
			    printf $fp "\n\t\t\t/* Prop minus transition delay: */\n";
d326 1
a328 1
			printf $fp "\n\t\t    )\n";
d348 1
a348 1
			printf $fp "\n\t\t    )\n";
d368 1
a368 1
			printf $fp "\n\t\t    )\n";
@


1.14
log
@clock enable
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.13 1998/08/30 20:33:36 ryu Exp ryu $
d241 4
d257 22
d282 1
d287 4
d303 21
d327 1
d347 1
@


1.13
log
@Added timing_type to nonlinear load_delay outptu section
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.12 1998/08/30 19:24:00 ryu Exp ryu $
d107 1
d148 50
d204 1
a204 1
    my ($fp, $output) = @@_;
@


1.12
log
@Using term instead of port; extract all cell and terminal properties into synopsys model.
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.11 1998/08/29 20:29:13 ryu Exp ryu $
a164 1

d184 2
@


1.11
log
@Added nonlinear rise/fall propagation/transition
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.10 1998/08/29 17:23:56 ryu Exp ryu $
d31 27
d60 2
a61 2
    my ($port);
    my ($portname, $porttype);
d69 10
a78 8
    printf $fp "\tarea : %s ;\n",
	$celldata{"$cellname:area"}
	if $celldata{"$cellname:area"};

    foreach $port (@@portlist) {
	($portname, $porttype) = split(':', $port);
	if ($porttype eq 'i') {
	    printf $fp "\tpin( \"$portname\" ) {\n";
d81 3
a83 3
		$celldata{"$cellname:input_cap:$portname"}
		if $celldata{"$cellname:input_cap:$portname"};
	    &print_synopsys_input_timing($fp, $portname);
d87 1
a87 2
	if ($porttype eq 'o') {
	    printf $fp "\tpin( \"$portname\" ) {\n";
d89 1
a89 4
	    printf $fp "\t    function : \"%s\" ;\n",
		$celldata{"$cellname:function:$portname"}
		if $celldata{"$cellname:function:$portname"};
	    &print_synopsys_output_timing($fp, $portname);
d101 2
a102 2
    my ($port);
    my ($clock, $porttype);
d104 3
a106 3
    foreach $port (@@portlist) {
	($clock, $porttype) = split(':', $port);
	if ($porttype eq 'i') {
d154 2
a155 2
    my ($port);
    my ($input, $porttype);
d158 3
a160 3
    foreach $port (@@portlist) {
	($input, $porttype) = split(':', $port);
	if ($porttype eq 'i') {
@


1.10
log
@add more control of prop delay measurement
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.9 1998/08/28 09:58:27 ryu Exp ryu $
d143 1
d159 1
d161 1
a161 1
			printf $fp "\t\trise_transition ($init{'corner'}) {\n";
d180 38
d226 1
a226 1
				    $celldata{"$cellname:load_delay:$input:$output:tphl"}[$k++];
@


1.9
log
@$#slewrate is -1 when the list is empty.
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.8 1998/08/26 09:35:38 ryu Exp ryu $
d15 1
a15 1
    my($format) = @@_;
d17 1
a17 3
    if ($debug) {
	&dump_celldata();
    }
d20 1
a20 1
	&print_synopsys();
d22 1
a22 4
	&print_pearl();
    } elsif ($format eq 'none') {
	# do nothing
	return;
d26 2
a27 8
}


sub dump_celldata {
    my ($key);
    foreach $key (sort keys(%celldata)) {
	printf STDERR "$key = $celldata{$key}\n";
    }
d32 1
d36 3
a38 1
    printf MODEL "cell( \"$cellname\" ) {\n";
d40 3
a42 1
    printf MODEL "    area : %s ;\n",
d49 3
a51 3
	    printf MODEL "    pin( \"$portname\" ) {\n";
	    printf MODEL "\tdirection : input ;\n";
	    printf MODEL "\tcapacitance : %.4e ;\n",
d54 2
a55 2
	    &print_synopsys_input_timing($portname);
	    printf MODEL "    }\n";
d59 3
a61 3
	    printf MODEL "    pin( \"$portname\" ) {\n";
	    printf MODEL "\tdirection : output ;\n";
	    printf MODEL "\tfunction : \"%s\" ;\n",
d64 2
a65 2
	    &print_synopsys_output_timing($portname);
	    printf MODEL "    }\n";
d70 1
a70 4
    printf MODEL "}\n";

    close (MODEL);
    printf STDERR "Created '$modelout'.\n";
d75 1
a75 1
    my($input) = @@_;
d83 2
a84 2
		printf MODEL "\ttiming () {\n";
		printf MODEL "\t    related_pin : \"$clock\" ;\n";
d87 1
a87 1
		    printf MODEL "\t    timing_type : setup_rising ;\n";
d89 1
a89 1
		    printf MODEL "\t    timing_type : setup_falling ;\n";
d94 1
a94 1
		printf MODEL "\t    intrinsic_rise : %.4e ;\n",
d97 1
a97 1
		printf MODEL "\t    intrinsic_fall : %.4e ;\n",
d100 1
a100 1
		printf MODEL "\t}\n";
d103 2
a104 2
		printf MODEL "\ttiming () {\n";
		printf MODEL "\t    related_pin : \"$clock\" ;\n";
d107 1
a107 1
		    printf MODEL "\t    timing_type : hold_rising ;\n";
d109 1
a109 1
		    printf MODEL "\t    timing_type : hold_falling ;\n";
d114 1
a114 1
		printf MODEL "\t    intrinsic_rise : %.4e ;\n",
d117 1
a117 1
		printf MODEL "\t    intrinsic_fall : %.4e ;\n",
d120 1
a120 1
		printf MODEL "\t}\n";
d128 1
a128 1
    my ($output) = @@_;
d138 2
a139 2
		printf MODEL "\ttiming () {\n";
		printf MODEL "\t    related_pin : \"$input\" ;\n";
d143 1
a143 1
		    printf MODEL "\t    intrinsic_rise : %.4e ;\n",
d146 1
a146 1
		    printf MODEL "\t    intrinsic_fall : %.4e ;\n",
d149 1
a149 1
		    printf MODEL "\t    rise_resistance : %.4e ;\n",
d152 1
a152 1
		    printf MODEL "\t    fall_resistance : %.4e ;\n",
d159 2
a160 2
			printf MODEL "\t    rise_transition ($init{'corner'}) {\n";
			printf MODEL "\t\tvalues ( \\";
d164 1
a164 1
			    printf MODEL "\n\t\t    \"";
d166 1
a166 1
				printf MODEL "%.4e",
d168 1
a168 1
				printf MODEL " " unless ($i == $#cload);
d170 3
a172 3
			    printf MODEL "\"";
			    printf MODEL "," unless ($j == $#slewrate);
			    printf MODEL " \\";
d174 2
a175 1
			printf MODEL "\n\t\t);\n";
d178 2
a179 2
			printf MODEL "\t    fall_transition ($init{'corner'}) {\n";
			printf MODEL "\t\tvalues ( \\";
d183 1
a183 1
			    printf MODEL "\n\t\t    \"";
d185 1
a185 1
				printf MODEL "%.4e",
d187 1
a187 1
				printf MODEL " " unless ($i == $#cload);
d189 3
a191 3
			    printf MODEL "\"";
			    printf MODEL "," unless ($j == $#slewrate);
			    printf MODEL " \\";
d193 2
a194 1
			printf MODEL "\n\t\t);\n";
d198 1
a198 1
		printf MODEL "\t}\n";
d202 2
a203 2
		printf MODEL "\ttiming () {\n";
		printf MODEL "\t    related_pin : \"$input\" ;\n";
d206 1
a206 1
		    printf MODEL "\t    timing_type : rising_edge ;\n";
d208 1
a208 1
		    printf MODEL "\t    timing_type : falling_edge ;\n";
d213 1
a213 1
		printf MODEL "\t    intrinsic_rise : %.4e ;\n",
d216 1
a216 1
		printf MODEL "\t    intrinsic_fall : %.4e ;\n",
d219 1
a219 1
		printf MODEL "\t    rise_resistance : %.4e ;\n",
d222 1
a222 1
		printf MODEL "\t    fall_resistance : %.4e ;\n",
d225 1
a225 1
		printf MODEL "\t}\n";
a228 222
}


#-------------------------------------------------------------------------------


sub ic_save_data {
    my($cellname, $in, $cscaled) = @@_;

    $celldata{"$cellname:input_cap:$in"} = $cscaled;
}


#
#   cq_save_data --
#
sub cq_save_data {
    local($cellname, $clk, $q, $clktype,
	*creal, *clk_q_lh, $clk_q_hl, *risetime, *falltime) = @@_;

    my($risetimea, $risetimeb, $risetimer2);
    my($falltimea, $falltimeb, $falltimer2);
    my($clk_q_lha, $clk_q_lhb, $clk_q_lhr2);
    my($clk_q_hla, $clk_q_hlb, $clk_q_hlr2);

    if ($#clk_q_lh == $#creal) {
	($clk_q_lha, $clk_q_lhb, $clk_q_lhr2) = &svlinreg('lin', \@@creal, \@@clk_q_lh);
    }
    if ($#clk_q_hl == $#creal) {
	($clk_q_hla, $clk_q_hlb, $clk_q_hlr2) = &svlinreg('lin', \@@creal, \@@clk_q_hl);
    }
    if ($#risetime == $#creal) {
	($risetimea, $risetimeb, $risetimer2) = &svlinreg('lin', \@@creal, \@@risetime);
    }
    if ($#falltime == $#creal) {
	($falltimea, $falltimeb, $falltimer2) = &svlinreg('lin', \@@creal, \@@falltime);
    }

    $celldata{"$cellname:clock_q:$clk:$q"} = 1;
    $celldata{"$cellname:clock_q:$clk:$q:clktype"} = $clktype;
    $celldata{"$cellname:clock_q:$clk:$q:clk_q_lha"} = $clk_q_lha; 
    $celldata{"$cellname:clock_q:$clk:$q:clk_q_lhb"} = $clk_q_lhb; 
    $celldata{"$cellname:clock_q:$clk:$q:clk_q_hla"} = $clk_q_hla; 
    $celldata{"$cellname:clock_q:$clk:$q:clk_q_hlb"} = $clk_q_hlb; 
    $celldata{"$cellname:clock_q:$clk:$q:risetimea"} = $risetimea; 
    $celldata{"$cellname:clock_q:$clk:$q:risetimeb"} = $risetimeb; 
    $celldata{"$cellname:clock_q:$clk:$q:falltimea"} = $falltimea; 
    $celldata{"$cellname:clock_q:$clk:$q:falltimeb"} = $falltimeb; 
}


#
#   ld_save_data --
#
sub ld_save_data {
    local ($cellname, $in, $out, *creal,
	*tplh, *tphl, *risetime, *falltime, *inputrise, *inputfall) = @@_;

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

    $celldata{"$cellname:load_delay:$in:$out"} = 1;

    if ($#slewrate == -1) {

	# do single value linear regression
	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);
	}

	$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; 

    } else {

	# just save it for now; do least square error later (?)
	$celldata{"$cellname:load_delay:$in:$out:tplh"} = [ @@tplh ]; 
	$celldata{"$cellname:load_delay:$in:$out:tphl"} = [ @@tphl ]; 
	$celldata{"$cellname:load_delay:$in:$out:risetime"} = [ @@risetime ]; 
	$celldata{"$cellname:load_delay:$in:$out:falltime"} = [ @@falltime ]; 
	$celldata{"$cellname:load_delay:$in:$out:inputrise"} = [ @@inputrise ]; 
	$celldata{"$cellname:load_delay:$in:$out:inputfall"} = [ @@inputfall ]; 

    }
}


sub s_save_data {
    my ($cellname, $d, $clk, $clktype, $trans, $value) = @@_;

    $celldata{"$cellname:setup_hold:$d:$clk:setup"} = 1;
    $celldata{"$cellname:setup_hold:$d:$clk:clktype"} = $clktype;
    $celldata{"$cellname:setup_hold:$d:$clk:$trans"} = $value;
}


sub h_save_data {
    my ($cellname, $d, $clk, $clktype, $trans, $value) = @@_;

    $celldata{"$cellname:setup_hold:$d:$clk:hold"} = 1;
    $celldata{"$cellname:setup_hold:$d:$clk:clktype"} = $clktype;
    $celldata{"$cellname:setup_hold:$d:$clk:$trans"} = $value;
}

#-------------------------------------------------------------------------------

sub ld_copy_data {
    my($cellname, $in, $out, $refin, $refout) = @@_;

    if ($celldata{"$cellname:load_delay:$refin:$refout"}) {

	$celldata{"$cellname:load_delay:$in:$out"} = 1;

	if ($#slewrate == -1) {
	    $celldata{"$cellname:load_delay:$in:$out:tplha"} =
		$celldata{"$cellname:load_delay:$refin:$refout:tplha"};
	    $celldata{"$cellname:load_delay:$in:$out:tplhb"} =
		$celldata{"$cellname:load_delay:$refin:$refout:tplhb"};
	    $celldata{"$cellname:load_delay:$in:$out:tphla"} =
		$celldata{"$cellname:load_delay:$refin:$refout:tphla"};
	    $celldata{"$cellname:load_delay:$in:$out:tphlb"} =
		$celldata{"$cellname:load_delay:$refin:$refout:tphlb"};
	    $celldata{"$cellname:load_delay:$in:$out:risetimea"} =
		$celldata{"$cellname:load_delay:$refin:$refout:risetimea"};
	    $celldata{"$cellname:load_delay:$in:$out:risetimeb"} =
		$celldata{"$cellname:load_delay:$refin:$refout:risetimeb"};
	    $celldata{"$cellname:load_delay:$in:$out:falltimea"} =
		$celldata{"$cellname:load_delay:$refin:$refout:falltimea"};
	    $celldata{"$cellname:load_delay:$in:$out:falltimeb"} =
		$celldata{"$cellname:load_delay:$refin:$refout:falltimeb"};
	} else {
	    $celldata{"$cellname:load_delay:$refin:$refout:tplh"} =
		[ @@celldata{"$cellname:load_delay:$in:$out:tplh"} ];
	    $celldata{"$cellname:load_delay:$refin:$refout:tphl"} =
		[ @@celldata{"$cellname:load_delay:$in:$out:tphl"} ];
	    $celldata{"$cellname:load_delay:$refin:$refout:risetime"} =
		[ @@celldata{"$cellname:load_delay:$in:$out:risetime"} ];
	    $celldata{"$cellname:load_delay:$refin:$refout:falltime"} =
		[ @@celldata{"$cellname:load_delay:$in:$out:falltime"} ];
	    $celldata{"$cellname:load_delay:$refin:$refout:inputrise"} =
		[ @@celldata{"$cellname:load_delay:$in:$out:inputrise"} ];
	    $celldata{"$cellname:load_delay:$refin:$refout:inputfall"} =
		[ @@celldata{"$cellname:load_delay:$in:$out:inputfall"} ];
	}

    } else {
	printf STDERR "WARNING: No load_delay data associated with \"$refin\" to \"$refout\".\n";
    }
}


sub ic_copy_data {
    my($cellname, $in, $refin) = @@_;

    $celldata{"$cellname:input_cap:$in"} =
	$celldata{"$cellname:input_cap:$refin"};
}


sub cq_copy_data {
    local($cellname, $clktype, $clk, $q, $refclk, $refq) = @@_;

    if ($celldata{"$cellname:clock_q:$refclk:$refq"}) {
	$celldata{"$cellname:clock_q:$clk:$q"} = 1;
	$celldata{"$cellname:clock_q:$clk:$q:clktype"} = $clktype;
	$celldata{"$cellname:clock_q:$clk:$q:clk_q_lha"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:clk_q_lha"};
	$celldata{"$cellname:clock_q:$clk:$q:clk_q_lhb"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:clk_q_lhb"};
	$celldata{"$cellname:clock_q:$clk:$q:clk_q_hla"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:clk_q_hla"};
	$celldata{"$cellname:clock_q:$clk:$q:clk_q_hlb"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:clk_q_hlb"};
	$celldata{"$cellname:clock_q:$clk:$q:risetimea"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:risetimea"};
	$celldata{"$cellname:clock_q:$clk:$q:risetimea"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:risetimea"};
	$celldata{"$cellname:clock_q:$clk:$q:risetimeb"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:risetimeb"};
	$celldata{"$cellname:clock_q:$clk:$q:falltimea"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:falltimea"};
	$celldata{"$cellname:clock_q:$clk:$q:falltimeb"} =
	    $celldata{"$cellname:clock_q:$refclk:$refq:falltimeb"};
    } else {
	printf STDERR "WARNING: No clock-Q data associated with \"$refclk\" to \"$refq\".\n";
    }
}


sub sh_copy_data {
    my ($cellname, $d, $clktype, $clk, $refd, $refclk) = @@_;

    $celldata{"$cellname:setup_hold:$d:$clk:setup"} = 1;
    $celldata{"$cellname:setup_hold:$d:$clk:clktype"} = $clktype;
    $celldata{"$cellname:setup_hold:$d:$clk:setup_lh"} =
	$celldata{"$cellname:setup_hold:$refd:$refclk:setup_lh"};
    $celldata{"$cellname:setup_hold:$d:$clk:setup_hl"} =
	$celldata{"$cellname:setup_hold:$refd:$refclk:setup_hl"};

    $celldata{"$cellname:setup_hold:$d:$clk:hold"} = 1;
    $celldata{"$cellname:setup_hold:$d:$clk:clktype"} = $clktype;
    $celldata{"$cellname:setup_hold:$d:$clk:hold_lh"} =
	$celldata{"$cellname:setup_hold:$refd:$refclk:hold_lh"};
    $celldata{"$cellname:setup_hold:$d:$clk:hold_hl"} =
	$celldata{"$cellname:setup_hold:$refd:$refclk:hold_hl"};
@


1.8
log
@added slewrate modelling.
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.7 1998/08/24 06:16:21 ryu Exp $
d150 1
a150 1
		if ($#slewrate == 0) {
d301 1
a301 1
    if ($#slewrate == 0) {
d366 1
a366 1
	if ($#slewrate == 0) {
@


1.7
log
@Added multivariable linear regression
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.6 1998/08/24 00:48:34 ryu Exp ryu $
d137 1
a137 1
    my($output) = @@_;
d140 1
d146 1
d149 56
a204 12
		printf MODEL "\t    intrinsic_rise : %.4e ;\n",
		    $celldata{"$cellname:load_delay:$input:$output:tplha"}
		    if $celldata{"$cellname:load_delay:$input:$output:tplha"};
		printf MODEL "\t    intrinsic_fall : %.4e ;\n",
		    $celldata{"$cellname:load_delay:$input:$output:tphla"}
		    if $celldata{"$cellname:load_delay:$input:$output:tphla"};
		printf MODEL "\t    rise_resistance : %.4e ;\n",
		    $celldata{"$cellname:load_delay:$input:$output:tplhb"}
		    if $celldata{"$cellname:load_delay:$input:$output:tplhb"};
		printf MODEL "\t    fall_resistance : %.4e ;\n",
		    $celldata{"$cellname:load_delay:$input:$output:tphlb"}
		    if $celldata{"$cellname:load_delay:$input:$output:tphlb"};
d207 1
d291 2
a292 2
    local ($cellname, $in, $out,
	*creal, *tplh, *tphl, *risetime, *falltime) = @@_;
d299 37
a335 8
    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);
a336 13
    if ($#falltime == $#creal) {
	($falltimea, $falltimeb, $falltimer2) = &svlinreg('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; 
d363 1
d365 33
a397 16
	$celldata{"$cellname:load_delay:$in:$out:tplha"} =
	    $celldata{"$cellname:load_delay:$refin:$refout:tplha"};
	$celldata{"$cellname:load_delay:$in:$out:tplhb"} =
	    $celldata{"$cellname:load_delay:$refin:$refout:tplhb"};
	$celldata{"$cellname:load_delay:$in:$out:tphla"} =
	    $celldata{"$cellname:load_delay:$refin:$refout:tphla"};
	$celldata{"$cellname:load_delay:$in:$out:tphlb"} =
	    $celldata{"$cellname:load_delay:$refin:$refout:tphlb"};
	$celldata{"$cellname:load_delay:$in:$out:risetimea"} =
	    $celldata{"$cellname:load_delay:$refin:$refout:risetimea"};
	$celldata{"$cellname:load_delay:$in:$out:risetimeb"} =
	    $celldata{"$cellname:load_delay:$refin:$refout:risetimeb"};
	$celldata{"$cellname:load_delay:$in:$out:falltimea"} =
	    $celldata{"$cellname:load_delay:$refin:$refout:falltimea"};
	$celldata{"$cellname:load_delay:$in:$out:falltimeb"} =
	    $celldata{"$cellname:load_delay:$refin:$refout:falltimeb"};
@


1.6
log
@Added copy_data functions to copy characterization data from one arc to another
to save time.
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.5 1998/08/23 22:11:24 ryu Exp ryu $
d215 1
a215 1
	($clk_q_lha, $clk_q_lhb, $clk_q_lhr2) = &linreg('lin', \@@creal, \@@clk_q_lh);
d218 1
a218 1
	($clk_q_hla, $clk_q_hlb, $clk_q_hlr2) = &linreg('lin', \@@creal, \@@clk_q_hl);
d221 1
a221 1
	($risetimea, $risetimeb, $risetimer2) = &linreg('lin', \@@creal, \@@risetime);
d224 1
a224 1
	($falltimea, $falltimeb, $falltimer2) = &linreg('lin', \@@creal, \@@falltime);
d253 1
a253 1
	($tplha, $tplhb, $tplhr2) = &linreg('lin', \@@creal, \@@tplh);
d256 1
a256 1
	($tphla, $tphlb, $tphlr2) = &linreg('lin', \@@creal, \@@tphl);
d259 1
a259 1
	($risetimea, $risetimeb, $risetimer2) = &linreg('lin', \@@creal, \@@risetime);
d262 1
a262 1
	($falltimea, $falltimeb, $falltimer2) = &linreg('lin', \@@creal, \@@falltime);
@


1.5
log
@Robert K. Yu
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.4 1998/08/23 21:59:07 ryu Exp ryu $
a33 1

d47 5
a51 1
    printf MODEL "    area : %s ;\n", $celldata{"$cellname:area"};
d97 1
a97 1
		} elsif ($celldata{"$cellname:clock_q:$input:$clock:clktype"} eq 'falling') {
d117 1
a117 1
		} elsif ($celldata{"$cellname:clock_q:$input:$clock:clktype"} eq 'falling') {
d192 2
a193 1
#-------------------------------------------------------------------------------------
d292 85
@


1.4
log
@save_data functions moved into model.pl; pass lists by reference
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.3 1998/08/23 21:16:02 ryu Exp ryu $
d11 1
a11 1
#	Author: Robert Yu
@


1.3
log
@Write out synopsys lib.
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.2 1998/08/23 12:22:09 ryu Exp ryu $
d188 103
d292 1
@


1.2
log
@print out synopsys model for combinatorial gates.
@
text
@d9 1
a9 1
#	$Id: model.pl,v 1.1 1998/08/23 12:03:33 ryu Exp ryu $
d47 1
a47 1
    printf MODEL "cell($cellname) {\n";
d52 1
a52 1
	    printf MODEL "    pin($portname) {\n";
d55 3
a57 1
		$celldata{"$cellname:input_cap:$portname"};
d62 1
a62 1
	    printf MODEL "    pin($portname) {\n";
d65 3
a67 2
		$celldata{"$cellname:function:$portname"};
	    &print_synopsys_timing($portname);
d79 55
a133 1
sub print_synopsys_timing {
d141 1
a141 1
	    if ($celldata{"$cellname:load_delay:$input:$output"} == 1) {
d143 1
d145 2
a146 1
		    $celldata{"$cellname:load_delay:$input:$output:tplha"};
d148 2
a149 1
		    $celldata{"$cellname:load_delay:$input:$output:tphla"};
d151 2
a152 1
		    $celldata{"$cellname:load_delay:$input:$output:tplhb"};
d154 6
a159 1
		    $celldata{"$cellname:load_delay:$input:$output:tphlb"};
d161 21
@


1.1
log
@Initial revision
@
text
@d9 1
a9 1
#	$Id: autochar.pl,v 1.13 1998/08/23 10:13:32 ryu Exp ryu $
d14 1
a14 1
sub create_model {
d22 1
a22 1
	&create_synopsys();
d24 1
a24 1
	&create_pearl();
d43 2
a44 2
sub create_synopsys {
    my ($i, $port);
d54 1
a54 1
	    printf MODEL "\tcapacitance : %.4f ;\n",
d60 6
a65 1
	    printf MODEL "    pin($portname) {\n\tdirection : output ;\n";
d76 24
@
# Change User Description Committed
#1 6489 robert_yu Saved here.