@@ -375,13 +375,6 @@ void ClockGating::run()
375375 abc_factory_->AddDbSta (sta_);
376376 abc_library_ = std::make_unique<cut::AbcLibrary>(abc_factory_->Build ());
377377
378- abc::Abc_SclInstallGenlib (abc_library_->abc_library (),
379- /* Slew=*/ 0 ,
380- /* Gain=*/ 0 ,
381- /* fUseAll=*/ 0 ,
382- /* nGatesMin=*/ 0 );
383- abc::Mio_LibraryTransferCellIds ();
384-
385378 dump (" pre" );
386379
387380 std::vector<sta::Instance*> instances;
@@ -519,7 +512,7 @@ void ClockGating::run()
519512 continue ;
520513 }
521514
522- correct_conds = gate_cond_cover;
515+ correct_conds = std::move ( gate_cond_cover) ;
523516 searchClockGates (instance,
524517 correct_conds,
525518 correct_conds.begin (),
@@ -664,10 +657,11 @@ void ClockGating::searchClockGates(sta::Instance* const instance,
664657 abc::Abc_Ntk_t& abc_network,
665658 const bool clk_enable)
666659{
667- if (end - begin < 2 ) {
660+ size_t half_len = (end - begin) / 2 ;
661+ if (half_len == 0 ) {
668662 return ;
669663 }
670- auto mid = begin + (end - begin) / 2 ;
664+ auto mid = begin + half_len ;
671665 auto combined_candidate_names
672666 = combinedGatingCondNames (sta_->getDbNetwork (), mid, end, clk_enable);
673667 debugPrint (
@@ -691,6 +685,7 @@ void ClockGating::searchClockGates(sta::Instance* const instance,
691685 " Clock gating signals: '{}' can be dropped" ,
692686 combined_candidate_names);
693687 good_gate_conds.erase (mid, end);
688+ mid = begin + half_len;
694689 } else if (end - mid > 1 ) {
695690 debugPrint (logger_,
696691 CGT,
@@ -832,6 +827,8 @@ static abc::Abc_Obj_t* regDataFunctionToAbc(sta::dbNetwork* const network,
832827 case sta::FuncExpr::op_or:
833828 case sta::FuncExpr::op_xor:
834829 expr_stack.push_back (expr->right ());
830+ expr_stack.push_back (expr->left ());
831+ break ;
835832 case sta::FuncExpr::op_not:
836833 expr_stack.push_back (expr->left ());
837834 break ;
0 commit comments