Complete fonctions of class Delay

This commit is contained in:
HoangAnhP 2022-07-22 12:39:08 +02:00
parent bf181787cb
commit dedad34585
2 changed files with 24 additions and 3 deletions

View File

@ -21,6 +21,7 @@
Tree.cpp Tree.cpp
Elmore.cpp Elmore.cpp
SeabreezeEngine.cpp SeabreezeEngine.cpp
Delay.cpp
#GraphicSeabreezeEngine.cpp #GraphicSeabreezeEngine.cpp
) )
set( pyCpps PySeabreeze.cpp set( pyCpps PySeabreeze.cpp

View File

@ -14,7 +14,6 @@
// +-----------------------------------------------------------------+ // +-----------------------------------------------------------------+
#pragma once
#include <map> #include <map>
#include <iostream> #include <iostream>
#include "hurricane/RoutingPad.h" #include "hurricane/RoutingPad.h"
@ -39,13 +38,34 @@ namespace Seabreeze {
void Delay::addPair ( RoutingPad* driver, RoutingPad* sink, double delay) void Delay::addPair ( RoutingPad* driver, RoutingPad* sink, double delay)
{ {
if ( _values.count(driver) > 0 ) { if ( _values.count(driver) > 0 ) {
cerr << "Driver already exist." << endl cerr << "Driver " << driver << " already exists." << endl
<< "If you want to add value, please use the function addValue( RoutingPad*, RoutingPad*, double)" << endl << "If you want to add value, please use the function addValue( RoutingPad*, RoutingPad*, double)" << endl
<< "Example : addValue(driver, sink, delay)" << endl; << "Example : addValue(driver, sink, delay)" << endl;
} }
else { else {
map<RoutingPad*, double> val { {sink, delay}, }; map<RoutingPad*, double> val { {sink, delay}, };
_values.insert(driver, val); _values.insert({driver, val});
}
}
void Delay::addValue ( RoutingPad* driver, RoutingPad* sink, double delay )
{
if ( _values[driver].count(sink) > 0 ) {
cerr << "Delay from " << driver << " to " << sink << " is already computed" << endl;
}
else {
_values[driver].insert({sink, delay});
}
}
void Delay::printDelays ()
{
for ( auto dmap : _values ) {
cerr << "Delay from : " << dmap.first << " to :" << endl;
map<RoutingPad*, double>& val = dmap.second;
for ( auto smap : val ) {
cerr << smap.first << " : " << smap.second << endl;
}
} }
} }
} }