#! /usr/bin/perl -w
############################################################
## Copyright: 2011 Integrated Sytems Laboratory, ETH Zurich
## http://www.iis.ee.ethz.ch/~sha3
############################################################
use strict;
# v0.2 - kgf@ee.ethz.ch - Wed Oct 5 10:32:24 CEST 2011
# - write the results to a common data file
# v0.1 - kgf@ee.ethz.ch - Tue Oct 4 17:02:05 CEST 2011
# - this will extract the information from the multiple encounter rusn
unless ($ENV{PWD}=~/(ethz|gmu)_(blake|skein|sha2|jh|keccak|groestl)\/encounter$/){
die "Current directory is [$ENV{PWD}] not in encounter\n";
}
my $flavor= $1;
my $alg = $2;
my $GATE=1.44; # constant
my $FILE="gnuplot_enc_result.dat";
my $date=`date`;
chomp($date);
my %LATENCY = (
"ethz_sha2" => 67,
"ethz_blake" => 57,
"ethz_groestl" => 81,
"ethz_jh" => 42,
"ethz_keccak" => 24,
"ethz_skein" => 92,
"gmu_sha2" => 65,
"gmu_blake" => 29,
"gmu_groestl" => 21,
"gmu_jh" => 43,
"gmu_keccak" => 24,
"gmu_skein" => 19
);
## determine the actual runs:
my @RUNS=`ls encounter_*.cmd`;
print<<"BUGU";
+--------------------------------------------------------------------------------------------+
| $flavor $alg
|
| Constraints | Achieved Results |
+---------+---------+----------+----------+-------------+-------------+----------------------+
|Clock |Util. | Timing | Util | Gate Equiv | Throughput | Throughput per Area |
+---------+---------+----------+----------+-------------+-------------+----------------------+
BUGU
open (R, "> $FILE") or die "can not open $FILE for writing\n";
foreach my $r (@RUNS){
chomp ($r);
$r=~/encounter_(\d+\.\d+)_(\d+\.\d+)\.cmd/;
my $clk= $1;
my $util=$2;
# print "$alg $flavor $clk - $util \n";
#### Read area information
my $fp_file="timingReports_${clk}_${util}/${flavor}_${alg}_analyzeFP.rpt";
open(F, "< $fp_file") or die "Can not open Floorplan file [${fp_file}]\n";
my $area=0;
my $density=0;
my $instances=0;
while (F){
if (/Core Area.*:\s*(\d+\.\d+)/){ $area= $1}
elsif (/Core Density.*:\s*(\d+\.\d+)/){ $density= $1}
elsif (/Number of instance.*:\s*(\d+)/){ $instances= $1}
}
my $gates=int($area/$GATE) / 1000 ;
close(F);
#### Read timing information
my $tim_file="timingReports_${clk}_${util}/${flavor}_${alg}.postroute-opt.summary";
open(T, "< $tim_file") or die "Can not open timing report [${tim_file}]\n";
my $slack = 0;
while (T){
if (/WNS .ns.:.\s*(-?\d+\.\d+)/){ $slack= $1}
}
close(T);
my $timing = $clk - $slack;
my $bpc = ($alg eq "keccak") ? 1088 : 512 ; # bits per block
my $tput = $bpc / ($timing * $LATENCY{"${flavor}_${alg}"});
printf("| %3.2f ns | %5.1f %% | %5.3f ns | %5.2f %% | %7.3f kGE | %6.3f Gb/s | %7.3f kbits/s/gate |\n",
$clk, $util *100, $timing, $density, $gates, $tput, (1000*$tput)/ ($area/(1000*$GATE)));
# print to file
printf R ("%7.3f %5.3f %6.3f\n",$gates, $timing,$tput);
}
print "+---------+---------+----------+----------+-------------+-------------+----------------------+\n";
# done with the file
close(R);