diff options
| author | Eddie Hung <eddie@fpgeh.com> | 2019-12-09 14:29:29 -0800 | 
|---|---|---|
| committer | Eddie Hung <eddie@fpgeh.com> | 2019-12-09 14:29:29 -0800 | 
| commit | fb203d2a2c02c3df1a2c6a92ec196e579495c8d4 (patch) | |
| tree | 19e0dadf7b74910c9bfb2751f36a2ce319fd34e5 /techlibs/ice40 | |
| parent | 36a88be609b942f9bc1a5e44ecdbe432a3fa56e8 (diff) | |
| download | yosys-fb203d2a2c02c3df1a2c6a92ec196e579495c8d4.tar.gz yosys-fb203d2a2c02c3df1a2c6a92ec196e579495c8d4.tar.bz2 yosys-fb203d2a2c02c3df1a2c6a92ec196e579495c8d4.zip | |
ice40_opt to restore attributes/name when unwrapping
Diffstat (limited to 'techlibs/ice40')
| -rw-r--r-- | techlibs/ice40/ice40_opt.cc | 15 | 
1 files changed, 15 insertions, 0 deletions
| diff --git a/techlibs/ice40/ice40_opt.cc b/techlibs/ice40/ice40_opt.cc index aa5c43649..371ceb623 100644 --- a/techlibs/ice40/ice40_opt.cc +++ b/techlibs/ice40/ice40_opt.cc @@ -117,6 +117,21 @@ static void run_ice40_opts(Module *module)  			if (GetSize(replacement_output)) {  				optimized_co.insert(sigmap(cell->getPort("\\CO")[0])); +				auto it = cell->attributes.find(ID(SB_LUT4.name)); +				if (it != cell->attributes.end()) { +					module->rename(cell, it->second.decode_string()); +					decltype(Cell::attributes) new_attr; +					for (const auto &a : cell->attributes) +						if (a.first.begins_with("\\SB_LUT4.\\")) +							new_attr[a.first.c_str() + strlen("\\SB_LUT4.")] = a.second; +						else if (a.first == ID(src)) +							new_attr.insert(std::make_pair(a.first, a.second)); +						else if (a.first.in(ID(SB_LUT4.name), ID::keep, ID(module_not_derived))) +							continue; +						else +							log_abort(); +					cell->attributes = std::move(new_attr); +				}  				module->connect(cell->getPort("\\CO")[0], replacement_output);  				module->design->scratchpad_set_bool("opt.did_something", true);  				log("Optimized $__ICE40_CARRY_WRAPPER cell back to logic (without SB_CARRY) %s.%s: CO=%s\n", | 
