#! /usr/bin/perl -w

############################################################
## Copyright: 2011 Integrated Sytems Laboratory, ETH Zurich
##            http://www.iis.ee.ethz.ch/~sha3
############################################################
use strict;

# v0.3 - kgf@ee.ethz.ch - Wed Sep 21 10:39:14 CEST 2011
# - added an argument to control the multiplier. If it is not
#   there use 1.0
# v0.2 - kgf@ee.ethz.ch - Sat Sep 17 14:06:17 CEST 2011
# - added a 'set_diable_timing' for MsgLen
# v0.1 - kgf@ee.ethz.ch - Tue Sep 13 10:33:47 CEST 2011
# - should generate the mmmc.sdc files for all algorithms

my @ALGS=qw|ethz_sha2 ethz_blake ethz_groestl ethz_jh ethz_keccak ethz_skein
             gmu_sha2  gmu_blake  gmu_groestl  gmu_jh  gmu_keccak  gmu_skein
            dummy ram1 ram2 ram3 |;
             
my %CONF= ( "ethz_sha2"    => "0000",
            "ethz_blake"   => "0001",
            "ethz_groestl" => "0010",
            "ethz_jh"      => "0011",
            "ethz_keccak"  => "0100",
            "ethz_skein"   => "0101",
            "ram1"         => "0110",
            "ram2"         => "0111",
            "gmu_sha2"     => "1000",
            "gmu_blake"    => "1001",
            "gmu_groestl"  => "1010",
            "gmu_jh"       => "1011",
            "gmu_keccak"   => "1100",
            "gmu_skein"    => "1101",
            "ram3"         => "1110",
            "dummy"        => "1111");

# clock speeds 
my %CLK=  ( "ethz_sha2"    => 10,
            "ethz_blake"   => 10,
            "ethz_groestl" => 10,
            "ethz_jh "     => 10,
            "ethz_keccak " => 10,
            "ethz_skein"   => 10,
            "ram1"         => 10,
            "ram2"         => 10,
            "gmu_sha2"     => 10,
            "gmu_blake"    => 10,
            "gmu_groestl"  => 10,
            "gmu_jh"       => 10,
            "gmu_keccak"   => 10,
            "gmu_skein"    => 10,
            "ram3"         => 10,
            "dummy"        => 10);

## use the argument as a multiplier
my $MULT= ($#ARGV > -1)?$ARGV[0] :1.0;   # to multiply the period

my $DEBUG=1;  # set to 0 for less messages 

# update clocks from the design_settings.tcl for the algorithms
foreach my $a (@ALGS){
 next unless ($a=~/^(ethz|gmu)/); #skip dummy and ram
 my $file = "../../../${a}/synopsys/scripts/design_settings.tcl";
 if (-f $file){
   open (F, "< $file") or die "ERROR: can not open $file for reading\n";
   print "opening $file\n" if $DEBUG;
   while (F){
     if (s/^\s*set CLOCKLIST\s*\{//){  # only when this executes true
       s/\}//;                         # get rid of the last paranthesis
       my @s = split;                  # should be just alist of numbers
       $CLK{$a} = pop (@s) *$MULT;     # we want the last one (or only one), scaled
     }
   }
   close(F);
 }
}

# generate the file
foreach my $a (@ALGS){
  my $f = "shabziger_mmmc_${a}.sdc";
  open (S, "> $f") or die "ERROR: can not open $f fro writing\n";
  print S <<"BUGU";
create_clock -period  $CLK{$a} [get_ports {ClkxCI}]
set_propagated_clock [get_ports {ClkxCI}]

set_case_analysis 0 [get_ports {ClkDxCI}]
set_case_analysis 0 [get_ports {FuncScanEnxTI}]
set_case_analysis 0 [get_ports {CoreScanEnxTI}]

## The following are our test inputs, they are not required during the normal
## mode.
set_false_path -from [get_ports {FuncScanEnxTI}]
set_false_path -from [get_ports {CoreScanEnxTI}]

## select algorithm
BUGU
  # now the algorithm select 
  print "algorithm [$a] Config [$CONF{$a}] Clk [$CLK{$a}]\n" if $DEBUG;
  my @bits=split('',$CONF{$a});
  for my $i (0..3){
  print S "set_case_analysis $bits[3-$i] AlgSelxSI\\[$i\\]\n";
  }

  print S "\n## disable timing in all other cores \n";
  foreach my $b (@ALGS){
    next unless ($b=~/^(ethz|gmu)/); #skip dummy and ram
    print S "### " if ($a eq $b);    #skip current algorithm          
    print S "set_disable_timing [get_cells  -hierarchical -regexp top/i_${b}/.*]\n";
  }
  
  unless ($a=~/(blake|skein|ram)/){
    print S "\n### This algorithm [$a] does not use the MsgLength directly\n";
    print S "set_false_path -from [get_pins  -hierarchical -regexp top/i_inputblock.*reg.*/CK] -to [get_pins  -hierarchical -regexp top/i_inputblock_MsgLenxDP_reg.*/D]\n"
  }
  
  
  close(S);



}

Generated on Tue Nov 22 15:16:34 CET 2011
Home