head 1.25;
access;
symbols;
locks; strict;
comment @# @;
1.25
date 99.06.07.15.02.39; author ryu; state Exp;
branches;
next 1.24;
1.24
date 99.01.26.18.22.22; author ryu; state Exp;
branches;
next 1.23;
1.23
date 99.01.20.07.44.59; author ryu; state Exp;
branches;
next 1.22;
1.22
date 99.01.14.10.19.02; author ryu; state Exp;
branches;
next 1.21;
1.21
date 99.01.13.07.18.42; author ryu; state Exp;
branches;
next 1.20;
1.20
date 98.09.12.19.54.02; author ryu; state Exp;
branches;
next 1.19;
1.19
date 98.09.11.06.19.45; author ryu; state Exp;
branches;
next 1.18;
1.18
date 98.09.08.13.16.49; author ryu; state Exp;
branches;
next 1.17;
1.17
date 98.09.06.20.43.23; author ryu; state Exp;
branches;
next 1.16;
1.16
date 98.09.05.22.10.32; author ryu; state Exp;
branches;
next 1.15;
1.15
date 98.09.01.04.49.20; author ryu; state Exp;
branches;
next 1.14;
1.14
date 98.08.30.19.24.00; author ryu; state Exp;
branches;
next 1.13;
1.13
date 98.08.29.19.50.27; author ryu; state Exp;
branches;
next 1.12;
1.12
date 98.08.29.17.23.56; author ryu; state Exp;
branches;
next 1.11;
1.11
date 98.08.24.06.16.21; author ryu; state Exp;
branches;
next 1.10;
1.10
date 98.08.23.22.11.24; author ryu; state Exp;
branches;
next 1.9;
1.9
date 98.08.23.21.59.07; author ryu; state Exp;
branches;
next 1.8;
1.8
date 98.08.23.21.16.02; author ryu; state Exp;
branches;
next 1.7;
1.7
date 98.08.23.12.03.44; author ryu; state Exp;
branches;
next 1.6;
1.6
date 98.08.23.10.07.56; author ryu; state Exp;
branches;
next 1.5;
1.5
date 98.08.23.06.56.57; author ryu; state Exp;
branches;
next 1.4;
1.4
date 98.08.18.09.33.00; author ryu; state Exp;
branches;
next 1.3;
1.3
date 98.08.17.16.58.24; author ryu; state Exp;
branches;
next 1.2;
1.2
date 98.08.17.16.45.11; author ryu; state Exp;
branches;
next 1.1;
1.1
date 98.08.17.16.41.14; author ryu; state Exp;
branches;
next ;
desc
@Completed coding
@
1.25
log
@Optional space in measure results
@
text
@# $Id: clock_q.pl,v 1.24 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.
# cq_run --
# Top-level function setup/hold characterization.
# Generate the spice netlists, run hspice, and extract
# data.
#
sub cq_run {
local($d, $clktype, $clk, $qtype, $q, $tie, @@tie_list) = @@_;
local($run_name);
# check
if (($clktype ne 'rising') && ($clktype ne 'falling')) {
die "ERROR: clock type must be either 'rising' or 'falling'\n";
}
if (($qtype ne 'inverting') && ($qtype ne 'non_inverting')) {
die "ERROR: q type must be either 'inverting' or 'non_inverting'\n";
}
$run_name = &run_file_name($cellname, $clk, $q, 'cq');
open(SPICEIN,">$run_name") || die "ERROR: Cannot open file '$run_name'.";
# Create the hspice netlist(s)
&print_header(SPICEIN, '*');
printf SPICEIN "* Char: D-Flop Clock-Q Characterization\n";
printf SPICEIN "* Data: \"$d\"\n";
printf SPICEIN "* Clock: \"$clk\"\n";
printf SPICEIN "* Q: \"$q\"\n";
&cq_print_setup (SPICEIN);
&cq_print_source (SPICEIN, $clktype, $qtype);
&cq_print_dut (SPICEIN, $d, $clk, $q, $tie, @@tie_list);
&cq_print_measure (SPICEIN, $clktype, $qtype);
&cq_print_trans (SPICEIN, $clktype);
&cq_print_alter (SPICEIN);
printf SPICEIN ".end\n";
close(SPICEIN);
&run_spice($run_name);
&cq_report_spice($run_name, $d, $clktype, $clk, $qtype, $q);
}
sub cq_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 setup = 'pwidth'\n" ;
printf $fp ".param cload = '$cload[0]'\n" ;
}
sub cq_print_source {
my ($fp, $clktype, $qtype) = @@_;
printf $fp "\n*--- INPUTS --------------------------------------------------\n";
if ($clktype eq 'rising') {
printf $fp "vclk0 vclk0 $low_value pulse (
+ '$low_value'
+ '$high_value'
+ '$trans_delay'
+ '$trans_risetime'
+ '$trans_falltime'
+ '$trans_pulse_width'
+ '$trans_period')\n";
printf $fp "vclk1 vclk1 $low_value pulse (
+ '$low_value'
+ '$high_value'
+ '$trans_delay'
+ '$trans_risetime'
+ '$trans_falltime'
+ '$trans_pulse_width'
+ '$trans_period')\n";
} elsif ($clktype eq 'falling') {
printf $fp "vclk0 vclk0 $low_value pulse (
+ '$high_value'
+ '$low_value'
+ '$trans_delay'
+ '$trans_risetime'
+ '$trans_falltime'
+ '$trans_pulse_width'
+ '$trans_period')\n";
printf $fp "vclk1 vclk1 $low_value pulse (
+ '$high_value'
+ '$low_value'
+ '$trans_delay'
+ '$trans_risetime'
+ '$trans_falltime'
+ '$trans_pulse_width'
+ '$trans_period')\n";
} else {
die "ERROR: unknown clock transition type '$clktype'\n";
}
printf $fp "vd0 vd0 $low_value pulse (
+ '$low_value'
+ '$high_value'
+ '$trans_delay+$trans_risetime+2*$trans_pulse_width+$trans_falltime-setup'
+ '$trans_risetime'
+ '$trans_falltime'
+ '3*$trans_period'
+ '4*$trans_period')\n";
printf $fp "vd1 vd1 $low_value pulse (
+ '$high_value'
+ '$low_value'
+ '$trans_delay+$trans_risetime+2*$trans_pulse_width+$trans_falltime-setup'
+ '$trans_risetime'
+ '$trans_falltime'
+ '3*$trans_period'
+ '4*$trans_period')\n";
}
sub cq_print_dut {
my($fp, $d, $clk, $q, $tie, $tie_list) = @@_;
my($term, $termname, $termtype);
my($dbuf, $clkbuf, $outload, $vcvs);
local($term_no, @@vcvs_list, @@output_loads);
my(@@inlist, @@reflist);
$term_no = 0;
if ($buffer{$d} ne '') {
$dbuf = $buffer{$d};
} else {
$dbuf = $buffer{'default'};
}
if ($buffer{$clk} ne '') {
$clkbuf = $buffer{$clk};
} else {
$clkbuf = $buffer{'default'};
}
@@inlist = ($d, $clk);
printf $fp "\n*--- TEST CIRCUIT --------------------------------------------\n";
if ($dbuf eq 'none') {
printf $fp "vshortd0 vd0 d0 DC 0\n";
printf $fp "vshortd1 vd1 d1 DC 0\n";
} else {
printf $fp "xdbuf0 vd0 d0 $dbuf\n";
printf $fp "xdbuf1 vd1 d1 $dbuf\n";
}
if ($clkbuf eq 'none') {
printf $fp "vshortclk0 vclk0 clk0 DC 0\n";
printf $fp "vshortclk1 vclk1 clk1 DC 0\n";
} else {
printf $fp "xclkbuf0 vclk0 clk0 $clkbuf\n";
printf $fp "xclkbuf1 vclk1 clk1 $clkbuf\n";
}
printf $fp "xflop0\n";
@@reflist = ('d0', 'clk0');
foreach $term (@@termlist) {
($termname, $termtype) = split(':', $term);
if ($termname eq $d) {
printf $fp "+\td0\t\$ $term\n";
next;
}
if ($termname eq $clk) {
printf $fp "+\tclk0\t\$ $term\n";
next;
}
if ($termname eq $q) {
printf $fp "+\tq0\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";
printf $fp "xflop1\n";
@@reflist = ('d1', 'clk1');
foreach $term (@@termlist) {
($termname, $termtype) = split(':', $term);
if ($termname eq $d) {
printf $fp "+\td1\t\$ $term\n";
next;
}
if ($termname eq $clk) {
printf $fp "+\tclk1\t\$ $term\n";
next;
}
if ($termname eq $q) {
printf $fp "+\tq1\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";
printf $fp "cload0 q0 $low_value cload\n";
printf $fp "cload1 q1 $low_value cload\n";
# if any
foreach $outload (@@output_loads) {
printf $fp "$outload\n";
}
}
sub cq_print_measure {
my($fp, $clktype, $qtype) = @@_;
printf $fp "\n*--- MEASURE -------------------------------------------------\n";
printf $fp ".option autostop\n";
printf $fp "\n* Measure clock->q time:\n";
if ($qtype eq 'non_inverting') {
if ($clktype eq 'rising') {
printf $fp ".measure tran clk_q_lh %s v(clk0) val='$input_prop_r' rise=1\n",
&trig_word();
printf $fp "+\ttarg=v(q0) val='$output_prop_r' rise=1\n";
printf $fp ".measure tran clk_q_hl %s v(clk1) val='$input_prop_r' rise=1\n",
&trig_word();
printf $fp "+\ttarg=v(q1) val='$output_prop_f' fall=1\n";
} else {
printf $fp ".measure tran clk_q_lh %s v(clk0) val='$input_prop_f' fall=1\n",
&trig_word();
printf $fp "+\ttarg=v(q0) val='$output_prop_r' rise=1\n";
printf $fp ".measure tran clk_q_hl %s v(clk1) val='$input_prop_f' fall=1\n",
&trig_word();
printf $fp "+\ttarg=v(q1) val='$output_prop_f' fall=1\n";
}
printf $fp
".measure tran risetime %s v(q0) val='$trans_r1' rise=1\n",
&trig_word();
printf $fp
"+\ttarg=v(q0) val='$trans_r2' rise=1\n";
printf $fp
".measure tran falltime %s v(q1) val='$trans_f1' fall=1\n",
&trig_word();
printf $fp
"+\ttarg=v(q1) val='$trans_f2' fall=1\n";
} else {
if ($clktype eq 'rising') {
printf $fp ".measure tran clk_q_lh %s v(clk1) val='$input_prop_r' rise=1\n",
&trig_word();
printf $fp "+\ttarg=v(q1) val='$output_prop_r' rise=1\n";
printf $fp ".measure tran clk_q_hl %s v(clk0) val='$input_prop_r' rise=1\n",
&trig_word();
printf $fp "+\ttarg=v(q0) val='$output_prop_f' fall=1\n";
} else {
printf $fp ".measure tran clk_q_lh %s v(clk1) val='$input_prop_f' fall=1\n",
&trig_word();
printf $fp "+\ttarg=v(q1) val='$output_prop_r' rise=1\n";
printf $fp ".measure tran clk_q_hl %s v(clk0) val='$input_prop_f' fall=1\n",
&trig_word();
printf $fp "+\ttarg=v(q0) val='$output_prop_f' fall=1\n";
}
printf $fp
".measure tran risetime %s v(q1) val='$trans_r1' rise=1\n",
&trig_word();
printf $fp
"+\ttarg=v(q1) val='$trans_r2' rise=1\n";
printf $fp
".measure tran falltime %s v(q0) val='$trans_f1' fall=1\n",
&trig_word();
printf $fp
"+\ttarg=v(q0) val='$trans_f2' fall=1\n";
}
}
sub cq_print_trans {
my($fp, $clktype) = @@_;
printf $fp "\n*--- TRANSIENT -----------------------------------------------\n";
printf $fp ".trans $trans_timestep '$trans_timestop' start='$trans_delay+$trans_pulse_width'\n";
}
sub cq_print_alter {
my($fp) = @@_;
my($i);
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" ;
}
}
sub cq_report_spice {
my ($run_name, $d, $clktype, $clk, $qtype, $q) = @@_;
my($base,$dir,$ext,$spiceout);
local(@@clk_q_lh, @@clk_q_hl, @@risetime, @@falltime, @@creal);
($base,$dir,$ext) = fileparse($run_name, '\.sp');
$spiceout = $base . '.out';
printf STDERR "Extracting results from '$spiceout' ...\n";
# grab the last values
open(SPICEOUT, $spiceout) || die "ERROR: Cannot find '$spiceout'.\n";
while (<SPICEOUT>) {
if (($name, $value) = /^ *(clk_q_lh) *= +([0-9\+\-eE\.]+)/) {
push(@@clk_q_lh, $value);
}
if (($name, $value) = /^ *(clk_q_hl) *= +([0-9\+\-eE\.]+)/) {
push(@@clk_q_hl, $value);
}
if (($name, $value) = /^ *(risetime) *= +([0-9\+\-eE\.]+)/) {
push(@@risetime, $value);
}
if (($name, $value) = /^ *(falltime) *= +([0-9\+\-eE\.]+)/) {
push(@@falltime, $value);
}
}
close SPICEOUT;
printf OUT "### CLOCK to Q #############################################################\n\n";
printf OUT "Cellname:\t\"$cellname\"\n";
printf OUT "D Input:\t\"$d\"\n";
printf OUT "Clock Input:\t\"$clk\"\t($clktype)\n";
printf OUT "Q Output:\t\"$q\"\t($qtype)\n";
# change to real numbers
@@creal = &convert_spice_values(@@cload);
printf OUT "\n";
&cq_report_spice_1(0);
# report it again, this time scaled.
if (($scale_cload != 1) || ($scale_delay != 1)) {
@@creal = &div_list($scale_cload, @@creal);
@@clk_q_lh = &div_list($scale_delay, @@clk_q_lh);
@@clk_q_hl = &div_list($scale_delay, @@clk_q_hl);
@@risetime = &div_list($scale_delay, @@risetime);
@@falltime = &div_list($scale_delay, @@falltime);
printf OUT "\n Scaled:\n\n";
&cq_report_spice_1(1);
printf OUT "\n\n";
}
&cq_save_data($cellname, $clk, $q, $clktype,
\@@creal, \@@clk_q_lh, \@@clk_q_hl, \@@risetime, \@@falltime);
}
#
# cq_report_spice_1 --
# Code fragment, called by cq_report_spice only.
#
sub cq_report_spice_1 {
my($scaled) = @@_;
my($i);
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);
}
if ($debug) {
&dump_list (creal, @@creal);
&dump_list (clk_q_lh, @@clk_q_lh);
&dump_list (clk_q_hl, @@clk_q_hl);
&dump_list (risetime, @@risetime);
&dump_list (falltime, @@falltime);
}
printf OUT " Cload\tClk_Q_lh\tClk_Q_hl\tRiseTime\tFallTime\n";
printf OUT " [F]\t\t[s]\t\t[s]\t\t[s]\t\t[s]\n" unless $scaled;
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], $clk_q_lh[$i], $clk_q_hl[$i], $risetime[$i], $falltime[$i];
}
printf OUT "\n";
printf OUT " Clk_Q_lh\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
$clk_q_lha, $clk_q_lhb, $clk_q_lhr2;
printf OUT " Clk_Q_hl\t= %.4e + %.4e * Cload\t(r2=%.4f)\n",
$clk_q_hla, $clk_q_hlb, $clk_q_hlr2;
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.24
log
@smartspice trig_word
@
text
@d1 1
a1 1
# $Id: clock_q.pl,v 1.23 1999/01/20 07:44:59 ryu Exp ryu $
d369 1
a369 1
if (($name, $value) = /^ *(clk_q_lh) += +([0-9\+\-eE\.]+)/) {
d372 1
a372 1
if (($name, $value) = /^ *(clk_q_hl) += +([0-9\+\-eE\.]+)/) {
d375 1
a375 1
if (($name, $value) = /^ *(risetime) += +([0-9\+\-eE\.]+)/) {
d378 1
a378 1
if (($name, $value) = /^ *(falltime) += +([0-9\+\-eE\.]+)/) {
@
1.23
log
@No perl header
@
text
@d1 1
a1 1
# $Id: clock_q.pl,v 1.22 1999/01/14 10:19:02 ryu Exp ryu $
d79 5
d277 2
a278 1
printf $fp ".measure tran clk_q_lh trig=v(clk0) val='$input_prop_r' rise=1\n";
d280 2
a281 1
printf $fp ".measure tran clk_q_hl trig=v(clk1) val='$input_prop_r' rise=1\n";
d284 2
a285 1
printf $fp ".measure tran clk_q_lh trig=v(clk0) val='$input_prop_f' fall=1\n";
d287 2
a288 1
printf $fp ".measure tran clk_q_hl trig=v(clk1) val='$input_prop_f' fall=1\n";
d292 2
a293 1
".measure tran risetime trig=v(q0) val='$trans_r1' rise=1\n";
d297 2
a298 1
".measure tran falltime trig=v(q1) val='$trans_f1' fall=1\n";
d303 2
a304 1
printf $fp ".measure tran clk_q_lh trig=v(clk1) val='$input_prop_r' rise=1\n";
d306 2
a307 1
printf $fp ".measure tran clk_q_hl trig=v(clk0) val='$input_prop_r' rise=1\n";
d310 2
a311 1
printf $fp ".measure tran clk_q_lh trig=v(clk1) val='$input_prop_f' fall=1\n";
d313 2
a314 1
printf $fp ".measure tran clk_q_hl trig=v(clk0) val='$input_prop_f' fall=1\n";
d318 2
a319 1
".measure tran risetime trig=v(q1) val='$trans_r1' rise=1\n";
d323 2
a324 1
".measure tran falltime trig=v(q0) val='$trans_f1' fall=1\n";
d336 1
a336 1
printf $fp ".trans $trans_timestep '$trans_timestop' start='$trans_delay+$trans_pulse_width\n";
d369 1
a369 1
if (($name, $value) = /^ +(clk_q_lh) += +([0-9\+\-eE\.]+)/) {
d372 1
a372 1
if (($name, $value) = /^ +(clk_q_hl) += +([0-9\+\-eE\.]+)/) {
d375 1
a375 1
if (($name, $value) = /^ +(risetime) += +([0-9\+\-eE\.]+)/) {
d378 1
a378 1
if (($name, $value) = /^ +(falltime) += +([0-9\+\-eE\.]+)/) {
@
1.22
log
@Using /usr/bin/perl
@
text
@d1 1
a1 3
#! /usr/bin/perl
# $Id: clock_q.pl,v 1.21 1999/01/13 07:18:42 ryu Exp ryu $
@
1.21
log
@GPL
@
text
@d1 1
a1 1
#! /usr/local/bin/perl
d3 1
a3 1
# $Id$
@
1.20
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: clock_q.pl,v 1.19 1998/09/11 06:19:45 ryu Exp ryu $
# Input Capacitance Characterization Functions
# Author: Robert K. Yu
d8 16
@
1.19
log
@Added slew rate to setup/hold
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.18 1998/09/08 13:16:49 ryu Exp ryu $
d64 1
a64 1
printf $fp ".include '$init{'techpath'}/$init{'corner'}'\n";
d66 2
a67 2
if ($init{'include'} ne 'none') {
printf $fp "$init{'include'}\n";
d69 1
a69 1
printf $fp "$trans{'options'}\n";
d83 16
a98 16
printf $fp "vclk0 vclk0 $init{'low'} pulse (
+ '$init{'low'}'
+ '$init{'high'}'
+ '$trans{'delay'}'
+ '$trans{'risetime'}'
+ '$trans{'falltime'}'
+ '$trans{'pulse_width'}'
+ '$trans{'period'}')\n";
printf $fp "vclk1 vclk1 $init{'low'} pulse (
+ '$init{'low'}'
+ '$init{'high'}'
+ '$trans{'delay'}'
+ '$trans{'risetime'}'
+ '$trans{'falltime'}'
+ '$trans{'pulse_width'}'
+ '$trans{'period'}')\n";
d102 16
a117 16
printf $fp "vclk0 vclk0 $init{'low'} pulse (
+ '$init{'high'}'
+ '$init{'low'}'
+ '$trans{'delay'}'
+ '$trans{'risetime'}'
+ '$trans{'falltime'}'
+ '$trans{'pulse_width'}'
+ '$trans{'period'}')\n";
printf $fp "vclk1 vclk1 $init{'low'} pulse (
+ '$init{'high'}'
+ '$init{'low'}'
+ '$trans{'delay'}'
+ '$trans{'risetime'}'
+ '$trans{'falltime'}'
+ '$trans{'pulse_width'}'
+ '$trans{'period'}')\n";
d123 16
a138 16
printf $fp "vd0 vd0 $init{'low'} pulse (
+ '$init{'low'}'
+ '$init{'high'}'
+ '$trans{'delay'}+$trans{'risetime'}+2*$trans{'pulse_width'}+$trans{'falltime'}-setup'
+ '$trans{'risetime'}'
+ '$trans{'falltime'}'
+ '3*$trans{'period'}'
+ '4*$trans{'period'}')\n";
printf $fp "vd1 vd1 $init{'low'} pulse (
+ '$init{'high'}'
+ '$init{'low'}'
+ '$trans{'delay'}+$trans{'risetime'}+2*$trans{'pulse_width'}+$trans{'falltime'}-setup'
+ '$trans{'risetime'}'
+ '$trans{'falltime'}'
+ '3*$trans{'period'}'
+ '4*$trans{'period'}')\n";
d244 2
a245 2
printf $fp "cload0 q0 $init{'low'} cload\n";
printf $fp "cload1 q1 $init{'low'} cload\n";
d263 1
a263 1
printf $fp ".measure tran clk_q_lh trig=v(clk0) val='$input_prop_r' rise=2\n";
d265 1
a265 1
printf $fp ".measure tran clk_q_hl trig=v(clk1) val='$input_prop_r' rise=2\n";
d268 1
a268 1
printf $fp ".measure tran clk_q_lh trig=v(clk0) val='$input_prop_f' fall=2\n";
d270 1
a270 1
printf $fp ".measure tran clk_q_hl trig=v(clk1) val='$input_prop_f' fall=2\n";
d283 1
a283 1
printf $fp ".measure tran clk_q_lh trig=v(clk1) val='$input_prop_r' rise=2\n";
d285 1
a285 1
printf $fp ".measure tran clk_q_hl trig=v(clk0) val='$input_prop_r' rise=2\n";
d288 1
a288 1
printf $fp ".measure tran clk_q_lh trig=v(clk1) val='$input_prop_f' fall=2\n";
d290 1
a290 1
printf $fp ".measure tran clk_q_hl trig=v(clk0) val='$input_prop_f' fall=2\n";
d310 1
a310 1
printf $fp ".trans $trans{'timestep'} '$trans{'timestop'}'\n";
d358 1
d371 1
a371 1
if (($init{'scale_cload'} != 1) || ($init{'scale_delay'} != 1)) {
d373 5
a377 5
@@creal = &div_list($init{'scale_cload'}, @@creal);
@@clk_q_lh = &div_list($init{'scale_delay'}, @@clk_q_lh);
@@clk_q_hl = &div_list($init{'scale_delay'}, @@clk_q_hl);
@@risetime = &div_list($init{'scale_delay'}, @@risetime);
@@falltime = &div_list($init{'scale_delay'}, @@falltime);
@
1.18
log
@slew rate at the clock input of setup_hold (wip)
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.17 1998/09/06 20:43:23 ryu Exp ryu $
a255 10
my($input_prop_r, $input_prop_f);
my($output_prop_r, $output_prop_f);
my($trans_r1, $trans_r2);
my($trans_f1, $trans_f2);
&set_measure_values (
\$input_prop_r, \$input_prop_f,
\$output_prop_r, \$output_prop_f,
\$trans_r1, \$trans_r2,
\$trans_f1, \$trans_f2);
@
1.17
log
@clock enable
@
text
@d3 1
a3 1
# Copyright (c) 1998, Robert K. Yu. All Rights Reserved.
d9 1
a9 1
# $Id: clock_q.pl,v 1.16 1998/09/05 22:10:32 ryu Exp ryu $
d53 1
a53 1
&cq_run_spice($run_name);
a336 16
sub cq_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.16
log
@Consolidate lookup_input functions into one, using list of names and refnames.
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.15 1998/09/01 04:49:20 ryu Exp ryu $
d187 1
a187 1
printf $fp "+\td0\n";
d191 1
a191 1
printf $fp "+\tclk0\n";
d195 1
a195 1
printf $fp "+\tq0\n";
d199 1
a199 1
printf $fp "+\t%s\n",
d204 1
a204 1
printf $fp "+\t%s\n", &lookup_output_load($termname);
d215 1
a215 1
printf $fp "+\td1\n";
d219 1
a219 1
printf $fp "+\tclk1\n";
d223 1
a223 1
printf $fp "+\tq1\n";
d227 1
a227 1
printf $fp "+\t%s\n",
d232 1
a232 1
printf $fp "+\t%s\n", &lookup_output_load($termname);
d273 1
a273 1
printf $fp ".meas tran clk_q_lh trig=v(clk0) val='$input_prop_r' rise=2\n";
d275 1
a275 1
printf $fp ".meas tran clk_q_hl trig=v(clk1) val='$input_prop_r' rise=2\n";
d278 1
a278 1
printf $fp ".meas tran clk_q_lh trig=v(clk0) val='$input_prop_f' fall=2\n";
d280 1
a280 1
printf $fp ".meas tran clk_q_hl trig=v(clk1) val='$input_prop_f' fall=2\n";
d284 1
a284 1
".meas tran risetime trig=v(q0) val='$trans_r1' rise=1\n";
d288 1
a288 1
".meas tran falltime trig=v(q1) val='$trans_f1' fall=1\n";
d293 1
a293 1
printf $fp ".meas tran clk_q_lh trig=v(clk1) val='$input_prop_r' rise=2\n";
d295 1
a295 1
printf $fp ".meas tran clk_q_hl trig=v(clk0) val='$input_prop_r' rise=2\n";
d298 1
a298 1
printf $fp ".meas tran clk_q_lh trig=v(clk1) val='$input_prop_f' fall=2\n";
d300 1
a300 1
printf $fp ".meas tran clk_q_hl trig=v(clk0) val='$input_prop_f' fall=2\n";
d304 1
a304 1
".meas tran risetime trig=v(q1) val='$trans_r1' rise=1\n";
d308 1
a308 1
".meas tran falltime trig=v(q0) val='$trans_f1' fall=1\n";
@
1.15
log
@Consistent quotes
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.14 1998/08/30 19:24:00 ryu Exp ryu $
d149 1
d163 1
d183 1
d200 1
a200 1
&lookup_input_2($termname, $d, $clk, 'd0', 'clk0', $tie, @@tie_list);
d211 1
d228 1
a228 1
&lookup_input_2($termname, $d, $clk, 'd1', 'clk1', $tie, @@tie_list);
@
1.14
log
@Using term instead of port; extract all cell and terminal properties into synopsys model.
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.13 1998/08/29 19:50:27 ryu Exp ryu $
d34 1
a34 1
open(SPICEIN,">$run_name") || die "ERROR: Cannot open file \"$run_name\".";
d363 1
a363 1
open(SPICEOUT, $spiceout) || die "ERROR: Cannot find \"$spiceout\".\n";
@
1.13
log
@Added div_list and mult_list
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.12 1998/08/29 17:23:56 ryu Exp ryu $
d146 1
a146 1
my($port, $portname, $porttype);
d148 1
a148 1
local($port_no, @@vcvs_list, @@output_loads);
d150 1
a150 1
$port_no = 0;
d181 3
a183 3
foreach $port (@@portlist) {
($portname, $porttype) = split(':', $port);
if ($portname eq $d) {
d187 1
a187 1
if ($portname eq $clk) {
d191 1
a191 1
if ($portname eq $q) {
d195 1
a195 1
if ($porttype eq 'i') {
d197 1
a197 1
&lookup_input_2($portname, $d, $clk, 'd0', 'clk0', $tie, @@tie_list);
d200 2
a201 2
if ($porttype eq 'o') {
printf $fp "+\t%s\n", &lookup_output_load($portname);
d208 3
a210 3
foreach $port (@@portlist) {
($portname, $porttype) = split(':', $port);
if ($portname eq $d) {
d214 1
a214 1
if ($portname eq $clk) {
d218 1
a218 1
if ($portname eq $q) {
d222 1
a222 1
if ($porttype eq 'i') {
d224 1
a224 1
&lookup_input_2($portname, $d, $clk, 'd1', 'clk1', $tie, @@tie_list);
d227 2
a228 2
if ($porttype eq 'o') {
printf $fp "+\t%s\n", &lookup_output_load($portname);
@
1.12
log
@add more control of prop delay measurement
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.11 1998/08/24 06:16:21 ryu Exp ryu $
d394 5
a398 5
@@creal = &scale_list($init{'scale_cload'}, @@creal);
@@clk_q_lh = &scale_list($init{'scale_delay'}, @@clk_q_lh);
@@clk_q_hl = &scale_list($init{'scale_delay'}, @@clk_q_hl);
@@risetime = &scale_list($init{'scale_delay'}, @@risetime);
@@falltime = &scale_list($init{'scale_delay'}, @@falltime);
@
1.11
log
@Added multivariable linear regression
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.10 1998/08/23 22:11:24 ryu Exp ryu $
d252 10
d269 4
a272 4
printf $fp ".meas tran clk_q_lh trig=v(clk0) val='$init{'midpoint'}' rise=2\n";
printf $fp "+\ttarg=v(q0) val='$init{'midpoint'}' rise=1\n";
printf $fp ".meas tran clk_q_hl trig=v(clk1) val='$init{'midpoint'}' rise=2\n";
printf $fp "+\ttarg=v(q1) val='$init{'midpoint'}' fall=1\n";
d274 4
a277 4
printf $fp ".meas tran clk_q_lh trig=v(clk0) val='$init{'midpoint'}' fall=2\n";
printf $fp "+\ttarg=v(q0) val='$init{'midpoint'}' rise=1\n";
printf $fp ".meas tran clk_q_hl trig=v(clk1) val='$init{'midpoint'}' fall=2\n";
printf $fp "+\ttarg=v(q1) val='$init{'midpoint'}' fall=1\n";
d280 1
a280 1
".meas tran risetime trig=v(q0) val='$init{'low'}+$trans{'low_percent'}*$init{'high'}' rise=1\n";
d282 1
a282 1
"+\ttarg=v(q0) val='$init{'low'}+$trans{'high_percent'}*$init{'high'}' rise=1\n";
d284 1
a284 1
".meas tran falltime trig=v(q1) val='$init{'low'}+$trans{'high_percent'}*$init{'high'}' fall=1\n";
d286 1
a286 1
"+\ttarg=v(q1) val='$init{'low'}+$trans{'low_percent'}*$init{'high'}' fall=1\n";
d289 4
a292 4
printf $fp ".meas tran clk_q_lh trig=v(clk1) val='$init{'midpoint'}' rise=2\n";
printf $fp "+\ttarg=v(q1) val='$init{'midpoint'}' rise=1\n";
printf $fp ".meas tran clk_q_hl trig=v(clk0) val='$init{'midpoint'}' rise=2\n";
printf $fp "+\ttarg=v(q0) val='$init{'midpoint'}' fall=1\n";
d294 4
a297 4
printf $fp ".meas tran clk_q_lh trig=v(clk1) val='$init{'midpoint'}' fall=2\n";
printf $fp "+\ttarg=v(q1) val='$init{'midpoint'}' rise=1\n";
printf $fp ".meas tran clk_q_hl trig=v(clk0) val='$init{'midpoint'}' fall=2\n";
printf $fp "+\ttarg=v(q0) val='$init{'midpoint'}' fall=1\n";
d300 1
a300 1
".meas tran risetime trig=v(q1) val='$init{'low'}+$trans{'low_percent'}*$init{'high'}' rise=1\n";
d302 1
a302 1
"+\ttarg=v(q1) val='$init{'low'}+$trans{'high_percent'}*$init{'high'}' rise=1\n";
d304 1
a304 1
".meas tran falltime trig=v(q0) val='$init{'low'}+$trans{'high_percent'}*$init{'high'}' fall=1\n";
d306 1
a306 1
"+\ttarg=v(q0) val='$init{'low'}+$trans{'low_percent'}*$init{'high'}' fall=1\n";
@
1.10
log
@Robert K. Yu
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.9 1998/08/23 21:59:07 ryu Exp ryu $
d414 1
a414 1
($clk_q_lha, $clk_q_lhb, $clk_q_lhr2) = &linreg('lin', \@@creal, \@@clk_q_lh);
d417 1
a417 1
($clk_q_hla, $clk_q_hlb, $clk_q_hlr2) = &linreg('lin', \@@creal, \@@clk_q_hl);
d420 1
a420 1
($risetimea, $risetimeb, $risetimer2) = &linreg('lin', \@@creal, \@@risetime);
d423 1
a423 1
($falltimea, $falltimeb, $falltimer2) = &linreg('lin', \@@creal, \@@falltime);
@
1.9
log
@save_data functions moved into model.pl; pass lists by reference
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.8 1998/08/23 21:16:02 ryu Exp ryu $
d11 1
a11 1
# Author: Robert Yu
@
1.8
log
@Write out synopsys lib.
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.7 1998/08/23 12:03:44 ryu Exp ryu $
d395 2
a396 1
&cq_save_data();
d414 1
a414 1
($clk_q_lha, $clk_q_lhb, $clk_q_lhr2) = &linreg('lin', @@creal, @@clk_q_lh);
d417 1
a417 1
($clk_q_hla, $clk_q_hlb, $clk_q_hlr2) = &linreg('lin', @@creal, @@clk_q_hl);
d420 1
a420 1
($risetimea, $risetimeb, $risetimer2) = &linreg('lin', @@creal, @@risetime);
d423 1
a423 1
($falltimea, $falltimeb, $falltimer2) = &linreg('lin', @@creal, @@falltime);
a453 34
#
# cq_save_data --
# Code fragment, called by cq_report_spice only.
#
sub cq_save_data {
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) = &linreg('lin', @@creal, @@clk_q_lh);
}
if ($#clk_q_hl == $#creal) {
($clk_q_hla, $clk_q_hlb, $clk_q_hlr2) = &linreg('lin', @@creal, @@clk_q_hl);
}
if ($#risetime == $#creal) {
($risetimea, $risetimeb, $risetimer2) = &linreg('lin', @@creal, @@risetime);
}
if ($#falltime == $#creal) {
($falltimea, $falltimeb, $falltimer2) = &linreg('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;
}
@
1.7
log
@celldata
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.6 1998/08/23 10:07:56 ryu Exp ryu $
d476 10
a485 8
$celldata{"$cellname:clock_q:$d:$clk:$q:clk_q_lha"} = $clk_q_lha;
$celldata{"$cellname:clock_q:$d:$clk:$q:clk_q_lhb"} = $clk_q_lhb;
$celldata{"$cellname:clock_q:$d:$clk:$q:clk_q_hla"} = $clk_q_hla;
$celldata{"$cellname:clock_q:$d:$clk:$q:clk_q_hlb"} = $clk_q_hlb;
$celldata{"$cellname:clock_q:$d:$clk:$q:risetimea"} = $risetimea;
$celldata{"$cellname:clock_q:$d:$clk:$q:risetimeb"} = $risetimeb;
$celldata{"$cellname:clock_q:$d:$clk:$q:falltimea"} = $falltimea;
$celldata{"$cellname:clock_q:$d:$clk:$q:falltimeb"} = $falltimeb;
@
1.6
log
@Added writing of data fle
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.5 1998/08/23 06:56:57 ryu Exp ryu $
d395 1
a395 1
&cq_write_data();
d454 1
a454 1
# cq_write_data --
d457 1
a457 1
sub cq_write_data {
d476 8
a483 8
printf DATA "\$data{'$cellname:clock_q:$d:$clk:$q:clk_q_lha'} = %.5e;\n", $clk_q_lha;
printf DATA "\$data{'$cellname:clock_q:$d:$clk:$q:clk_q_lhb'} = %.5e;\n", $clk_q_lhb;
printf DATA "\$data{'$cellname:clock_q:$d:$clk:$q:clk_q_hla'} = %.5e;\n", $clk_q_hla;
printf DATA "\$data{'$cellname:clock_q:$d:$clk:$q:clk_q_hlb'} = %.5e;\n", $clk_q_hlb;
printf DATA "\$data{'$cellname:clock_q:$d:$clk:$q:risetimea'} = %.5e;\n", $risetimea;
printf DATA "\$data{'$cellname:clock_q:$d:$clk:$q:risetimeb'} = %.5e;\n", $risetimeb;
printf DATA "\$data{'$cellname:clock_q:$d:$clk:$q:falltimea'} = %.5e;\n", $falltimea;
printf DATA "\$data{'$cellname:clock_q:$d:$clk:$q:falltimeb'} = %.5e;\n", $falltimeb;
@
1.5
log
@Using my and use instead of local and require.
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.4 1998/08/18 09:33:00 ryu Exp ryu $
d394 2
d450 34
@
1.4
log
@Debugged clock to q module; changed generated file convention
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.3 1998/08/17 16:58:24 ryu Exp ryu $
d61 1
a61 1
local ($fp) = @@_;
d77 1
a77 1
local ($fp, $clktype, $qtype) = @@_;
d145 4
a148 4
local($fp, $d, $clk, $q, $tie, $tie_list) = @@_;
local($port, $portname, $porttype);
local($dbuf, $clkbuf, $port_no, $outload, @@output_loads);
local($vcvs, @@vcvs_list);
d251 1
a251 1
local($fp, $clktype, $qtype) = @@_;
d303 1
a303 1
local($fp, $clktype) = @@_;
d312 2
a313 2
local($fp) = @@_;
local($i);
d325 2
a326 2
local($run_name) = @@_;
local($base,$dir,$type,$spiceout);
d342 1
a342 1
local ($run_name, $d, $clktype, $clk, $qtype, $q) = @@_;
d344 1
a344 1
local($base,$dir,$ext,$spiceout);
d402 2
a403 2
local($scaled) = @@_;
local($i);
d405 4
a408 4
local($risetimea, $risetimeb, $risetimer2);
local($falltimea, $falltimeb, $falltimer2);
local($clk_q_lha, $clk_q_lhb, $clk_q_lhr2);
local($clk_q_hla, $clk_q_hlb, $clk_q_hlr2);
@
1.3
log
@Clean up clock_q module
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.2 1998/08/17 16:45:11 ryu Exp ryu $
d20 1
d33 1
a33 1
$run_name = &run_file_name($cellname, $clk, $q);
d70 1
a70 1
printf $fp ".param setup = 'pulse_width'\n" ;
d303 1
a303 1
local($fp, $clktype, $out_trans) = @@_;
d333 1
a333 1
printf STDERR "\"%s\" found, skipping run.\n", $spiceout;
d342 1
a342 1
local ($run_name, $out_trans, $d, $clktype, $clk, $qtype, $q) = @@_;
a345 1
local($i);
d350 2
d371 3
a373 3
printf OUT "Input:\t\t\"$in\"\n";
printf OUT "Output:\t\t\"$out\"\n";
printf OUT "Transition:\t\"$type\"\n";
d403 1
d431 2
a432 2
printf OUT " Cload\tClk_Q_lh\t\tClk_Q_hl\t\tRiseTime\tFallTime\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;
@
1.2
log
@Setup time parameterized; set to pulse_width
@
text
@d9 1
a9 1
# $Id: clock_q.pl,v 1.1 1998/08/17 16:41:14 ryu Exp ryu $
d147 1
a147 1
local($vcvs, @@vcvs_list, $drefname, $clkrefname);
a178 2
$drefname = 'd0';
$clkrefname = 'clk0';
d191 1
a191 1
printf $fp "+\t%s\n", &lookup_output_load($portname, 'q0');
d196 1
a196 1
&lookup_input_2($portname, $d, $clk, $drefname, $clkrefname, $tie, @@tie_list);
a205 2
$drefname = 'd1';
$clkrefname = 'clk1';
d218 1
a218 1
printf $fp "+\t%s\n", &lookup_output_load($portname, 'q1');
d223 1
a223 1
&lookup_input_2($portname, $d, $clk, $drefname, $clkrefname, $tie, @@tie_list);
a304 4
printf $fp ".trans $trans{'timestep'} '$trans{'timestop'}'\n";
printf $fp "\n\n* Final value:\n";
printf $fp ".alter\n";
@
1.1
log
@Initial revision
@
text
@d9 1
a9 1
# $Id: setup_hold.pl,v 1.7 1998/08/17 04:25:02 ryu Exp $
d69 1
@