diff options
| author | Eddie Hung <eddie@fpgeh.com> | 2019-08-19 09:51:49 -0700 | 
|---|---|---|
| committer | Eddie Hung <eddie@fpgeh.com> | 2019-08-19 09:51:49 -0700 | 
| commit | e301440a0bae76dcff159c77274c91aad40021c0 (patch) | |
| tree | 43cedc2d3f7e88a826232c118cb435debdc91fba /passes | |
| parent | 9bfe924e17a87fac8a35fcb7ff5e067f6c520e07 (diff) | |
| download | yosys-e301440a0bae76dcff159c77274c91aad40021c0.tar.gz yosys-e301440a0bae76dcff159c77274c91aad40021c0.tar.bz2 yosys-e301440a0bae76dcff159c77274c91aad40021c0.zip  | |
Use attributes instead of params
Diffstat (limited to 'passes')
| -rw-r--r-- | passes/techmap/abc9.cc | 36 | 
1 files changed, 25 insertions, 11 deletions
diff --git a/passes/techmap/abc9.cc b/passes/techmap/abc9.cc index df62b4fa5..d52be1836 100644 --- a/passes/techmap/abc9.cc +++ b/passes/techmap/abc9.cc @@ -646,12 +646,8 @@ void abc9_module(RTLIL::Design *design, RTLIL::Module *current_module, std::stri  				cell->parameters = existing_cell->parameters;  				cell->attributes = existing_cell->attributes; -				auto it = cell->parameters.find("\\$abc_flop_clk_pol"); -				if (it != cell->parameters.end()) -					cell->parameters.erase(it); -				it = cell->parameters.find("\\$abc_flop_en_pol"); -				if (it != cell->parameters.end()) -					cell->parameters.erase(it); +				cell->attributes.erase("\\abc_flop_clk_pol"); +				cell->attributes.erase("\\abc_flop_en_pol");  			}  			else {  				cell->parameters = mapped_cell->parameters; @@ -1265,14 +1261,32 @@ struct Abc9Pass : public Pass {  						continue;  				} -				auto jt = cell->parameters.find("\\$abc_flop_clk_pol"); +				auto jt = cell->attributes.find("\\abc_flop_clk_pol");  				if (jt == cell->parameters.end()) -					log_error("'$abc_flop_clk_pol' parameter not found on module '%s'.\n", log_id(cell->type)); -				bool this_clk_pol = jt->second.as_bool(); +					log_error("'abc_flop_clk_pol' attribute not found on module '%s'.\n", log_id(cell->type)); +				bool this_clk_pol; +				if (jt->second.flags == RTLIL::ConstFlags::CONST_FLAG_STRING) { +					auto param = jt->second.decode_string(); +					auto kt = cell->parameters.find(param); +					if (kt == cell->parameters.end()) +						log_error("'abc_flop_clk_pol' value '%s' is not a parameter on module '%s'.\n", param.c_str(), log_id(cell->type)); +					this_clk_pol = kt->second.as_bool(); +				} +				else +					this_clk_pol = jt->second.as_bool();  				jt = cell->parameters.find("\\$abc_flop_en_pol");  				if (jt == cell->parameters.end()) -					log_error("'$abc_flop_en_pol' parameter not found on module '%s'.\n", log_id(cell->type)); -				bool this_en_pol = jt->second.as_bool(); +					log_error("'abc_flop_en_pol' attribute not found on module '%s'.\n", log_id(cell->type)); +				bool this_en_pol; +				if (jt->second.flags == RTLIL::ConstFlags::CONST_FLAG_STRING) { +					auto param = jt->second.decode_string(); +					auto kt = cell->parameters.find(param); +					if (kt == cell->parameters.end()) +						log_error("'abc_flop_en_pol' value '%s' is not a parameter on module '%s'.\n", param.c_str(), log_id(cell->type)); +					this_en_pol = kt->second.as_bool(); +				} +				else +					this_en_pol = jt->second.as_bool();  				const auto &data = it->second;  				key = clkdomain_t(this_clk_pol, assign_map(cell->getPort(data.first)), this_en_pol, assign_map(cell->getPort(data.second)));  | 
