Skip to content

Commit

Permalink
fix parser
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelmoresco committed Oct 18, 2024
1 parent 2c0f665 commit 6243b19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions src/ppl/src/IOPlacer.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ sta::define_cmd_args "place_pins" {[-hor_layers h_layers]\
}

proc place_pins { args } {
set fileId [open "args_input.txt" "w"]
foreach arg $args {
puts $fileId $arg
}
close $fileId
set regions [ppl::parse_excludes_arg $args]
set pin_groups [ppl::parse_group_pins_arg $args]
sta::parse_key_args "place_pins" args \
Expand Down
18 changes: 12 additions & 6 deletions src/tut/src/Tutorial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ PinParser Tutorial::parserArguments(string filepath)
inputData.open(filepath);
std::string line;
std::string currentCategory;

int unit = db_->getChip()->getBlock()->getTech()->getLefUnits();
// Regex to match exclude patterns like left:500-800 or top:*
std::regex excludePattern(R"((\w+):(?:([\d]+|\*)\-([\d]+|\*)|(\*)))");
std::smatch match;
Expand Down Expand Up @@ -1777,19 +1777,19 @@ PinParser Tutorial::parserArguments(string filepath)
if (std::regex_match(line, match, excludePattern)) {
exclude_struct exclude_item;
exclude_item.edge = pPlacer_->getEdge(match[1]);
if(match[2]!="*"&&match[5]!="*") {
if(match[2]!="*"&&match[4]!="*") {
// std::cout<<match[2]<<" "<<typeid(match[2].str().c_str()).name()<<std::endl;
exclude_item.begin = atoi(match[2].str().c_str());
exclude_item.begin = atoi(match[2].str().c_str()) * unit;
}
else {
if(match[1]=="top"||match[1]=="bottom")
exclude_item.begin = db_->getChip()->getBlock()->getDieArea().xMin();
else
exclude_item.begin = db_->getChip()->getBlock()->getDieArea().yMin();
}
if(match[3]!="*"&&match[5]!="*") {
if(match[3]!="*"&&match[4]!="*") {
// std::cout<<match[3]<<" "<<typeid(match[3].str().c_str()).name()<<std::endl;
exclude_item.end = atoi(match[3].str().c_str());
exclude_item.end = atoi(match[3].str().c_str()) * unit;
}
else {
if(match[1]=="top"||match[1]=="bottom")
Expand Down Expand Up @@ -1835,8 +1835,10 @@ Tutorial::resetIoplacer()
}
for (auto exclude : inputFlags.exclude_list)
{
// logger_->report("edge {}, begin {}, end {}", exclude.edge, exclude.begin, exclude.end);
pPlacer_->excludeInterval(exclude.edge, exclude.begin, exclude.end);
}
//pPlacer_->setAnnealingConfig(1000.0, 1000, 10, 0.9);
}

void
Expand Down Expand Up @@ -1872,7 +1874,7 @@ Tutorial::placeMacrosCornerMinWL2()
pPlacer_->run(false);
double wirelenght2 = getWeightedWL();
logger_->report("Current wWL = {}", wirelenght2);
if (wirelenght < wirelenght2) {
if (wirelenght <= wirelenght2) {
logger_->report("Breaking the Cycle");
break;
}
Expand All @@ -1882,8 +1884,11 @@ Tutorial::placeMacrosCornerMinWL2()
void
Tutorial::placeMacrosCornerMaxWl2()
{
logger_->report("Initial Macro Placement");
placeMacrosCornerMaxWl();
first_time_ = false;
resetIoplacer();
logger_->report("Running IOPlacer");
pPlacer_->run(false);
double wirelenght = getWeightedWL();
for (int i = 0; i < 3 ; i++){
Expand All @@ -1893,6 +1898,7 @@ Tutorial::placeMacrosCornerMaxWl2()
pPlacer_->run(false);
double wirelenght2 = getWeightedWL();
if (wirelenght < wirelenght2) {
logger_->report("Breaking the Cycle");
break;
}
}
Expand Down

0 comments on commit 6243b19

Please sign in to comment.