mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Changed more code to the new RTLIL::Wire constructors
This commit is contained in:
		
							parent
							
								
									946ddff9ce
								
							
						
					
					
						commit
						d68c993ed2
					
				
					 8 changed files with 52 additions and 81 deletions
				
			
		| 
						 | 
					@ -777,7 +777,7 @@ void RTLIL::Module::cloneInto(RTLIL::Module *new_mod) const
 | 
				
			||||||
	new_mod->attributes = attributes;
 | 
						new_mod->attributes = attributes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (auto &it : wires)
 | 
						for (auto &it : wires)
 | 
				
			||||||
		new_mod->wires[it.first] = new RTLIL::Wire(*it.second);
 | 
							new_mod->addWire(it.first, it.second);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (auto &it : memories)
 | 
						for (auto &it : memories)
 | 
				
			||||||
		new_mod->memories[it.first] = new RTLIL::Memory(*it.second);
 | 
							new_mod->memories[it.first] = new RTLIL::Memory(*it.second);
 | 
				
			||||||
| 
						 | 
					@ -952,6 +952,18 @@ RTLIL::Wire *RTLIL::Module::addWire(RTLIL::IdString name, int width)
 | 
				
			||||||
	return wire;
 | 
						return wire;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RTLIL::Wire *RTLIL::Module::addWire(RTLIL::IdString name, const RTLIL::Wire *other)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						RTLIL::Wire *wire = addWire(name);
 | 
				
			||||||
 | 
						wire->width = other->width;
 | 
				
			||||||
 | 
						wire->start_offset = other->start_offset;
 | 
				
			||||||
 | 
						wire->port_id = other->port_id;
 | 
				
			||||||
 | 
						wire->port_input = other->port_input;
 | 
				
			||||||
 | 
						wire->port_output = other->port_output;
 | 
				
			||||||
 | 
						wire->attributes = other->attributes;
 | 
				
			||||||
 | 
						return wire;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, RTLIL::IdString type)
 | 
					RTLIL::Cell *RTLIL::Module::addCell(RTLIL::IdString name, RTLIL::IdString type)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	RTLIL::Cell *cell = new RTLIL::Cell;
 | 
						RTLIL::Cell *cell = new RTLIL::Cell;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -273,6 +273,11 @@ struct RTLIL::Design {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct RTLIL::Module
 | 
					struct RTLIL::Module
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
						void add(RTLIL::Wire *wire);
 | 
				
			||||||
 | 
						void add(RTLIL::Cell *cell);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
	RTLIL::IdString name;
 | 
						RTLIL::IdString name;
 | 
				
			||||||
	std::set<RTLIL::IdString> avail_parameters;
 | 
						std::set<RTLIL::IdString> avail_parameters;
 | 
				
			||||||
	std::map<RTLIL::IdString, RTLIL::Wire*> wires;
 | 
						std::map<RTLIL::IdString, RTLIL::Wire*> wires;
 | 
				
			||||||
| 
						 | 
					@ -297,9 +302,6 @@ struct RTLIL::Module
 | 
				
			||||||
	void cloneInto(RTLIL::Module *new_mod) const;
 | 
						void cloneInto(RTLIL::Module *new_mod) const;
 | 
				
			||||||
	virtual RTLIL::Module *clone() const;
 | 
						virtual RTLIL::Module *clone() const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void add(RTLIL::Wire *wire);
 | 
					 | 
				
			||||||
	void add(RTLIL::Cell *cell);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// Removing wires is expensive. If you have to remove wires, remove them all at once.
 | 
						// Removing wires is expensive. If you have to remove wires, remove them all at once.
 | 
				
			||||||
	void remove(const std::set<RTLIL::Wire*> &wires);
 | 
						void remove(const std::set<RTLIL::Wire*> &wires);
 | 
				
			||||||
	void remove(RTLIL::Cell *cell);
 | 
						void remove(RTLIL::Cell *cell);
 | 
				
			||||||
| 
						 | 
					@ -309,6 +311,8 @@ struct RTLIL::Module
 | 
				
			||||||
	void rename(RTLIL::IdString old_name, RTLIL::IdString new_name);
 | 
						void rename(RTLIL::IdString old_name, RTLIL::IdString new_name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RTLIL::Wire *addWire(RTLIL::IdString name, int width = 1);
 | 
						RTLIL::Wire *addWire(RTLIL::IdString name, int width = 1);
 | 
				
			||||||
 | 
						RTLIL::Wire *addWire(RTLIL::IdString name, const RTLIL::Wire *other);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RTLIL::Cell *addCell(RTLIL::IdString name, RTLIL::IdString type);
 | 
						RTLIL::Cell *addCell(RTLIL::IdString name, RTLIL::IdString type);
 | 
				
			||||||
	RTLIL::Cell *addCell(RTLIL::IdString name, const RTLIL::Cell *other);
 | 
						RTLIL::Cell *addCell(RTLIL::IdString name, const RTLIL::Cell *other);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -445,7 +449,7 @@ struct RTLIL::Module
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct RTLIL::Wire
 | 
					struct RTLIL::Wire
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
//protected:
 | 
					protected:
 | 
				
			||||||
	// use module->addWire() and module->remove() to create or destroy wires
 | 
						// use module->addWire() and module->remove() to create or destroy wires
 | 
				
			||||||
	friend struct RTLIL::Module;
 | 
						friend struct RTLIL::Module;
 | 
				
			||||||
	Wire();
 | 
						Wire();
 | 
				
			||||||
| 
						 | 
					@ -453,8 +457,8 @@ struct RTLIL::Wire
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
	// do not simply copy wires
 | 
						// do not simply copy wires
 | 
				
			||||||
	//Wire(RTLIL::Wire &other) = delete;
 | 
						Wire(RTLIL::Wire &other) = delete;
 | 
				
			||||||
	//void operator=(RTLIL::Wire &other) = delete;
 | 
						void operator=(RTLIL::Wire &other) = delete;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RTLIL::IdString name;
 | 
						RTLIL::IdString name;
 | 
				
			||||||
	int width, start_offset, port_id;
 | 
						int width, start_offset, port_id;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,21 +31,15 @@ static void rename_in_module(RTLIL::Module *module, std::string from_name, std::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (auto &it : module->wires)
 | 
						for (auto &it : module->wires)
 | 
				
			||||||
		if (it.first == from_name) {
 | 
							if (it.first == from_name) {
 | 
				
			||||||
			RTLIL::Wire *wire = it.second;
 | 
								log("Renaming wire %s to %s in module %s.\n", log_id(it.second), log_id(to_name), log_id(module));
 | 
				
			||||||
			log("Renaming wire %s to %s in module %s.\n", wire->name.c_str(), to_name.c_str(), module->name.c_str());
 | 
								module->rename(it.second, to_name);
 | 
				
			||||||
			module->wires.erase(wire->name);
 | 
					 | 
				
			||||||
			wire->name = to_name;
 | 
					 | 
				
			||||||
			module->add(wire);
 | 
					 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (auto &it : module->cells)
 | 
						for (auto &it : module->cells)
 | 
				
			||||||
		if (it.first == from_name) {
 | 
							if (it.first == from_name) {
 | 
				
			||||||
			RTLIL::Cell *cell = it.second;
 | 
								log("Renaming cell %s to %s in module %s.\n", log_id(it.second), log_id(to_name), log_id(module));
 | 
				
			||||||
			log("Renaming cell %s to %s in module %s.\n", cell->name.c_str(), to_name.c_str(), module->name.c_str());
 | 
								module->rename(it.second, to_name);
 | 
				
			||||||
			module->cells.erase(cell->name);
 | 
					 | 
				
			||||||
			cell->name = to_name;
 | 
					 | 
				
			||||||
			module->add(cell);
 | 
					 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -224,14 +224,14 @@ struct SpliceWorker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (auto &it : rework_wires)
 | 
							for (auto &it : rework_wires)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			module->wires.erase(it.first->name);
 | 
								std::string orig_name = it.first->name;
 | 
				
			||||||
			RTLIL::Wire *new_port = new RTLIL::Wire(*it.first);
 | 
								module->rename(it.first, NEW_ID);
 | 
				
			||||||
			it.first->name = NEW_ID;
 | 
					
 | 
				
			||||||
 | 
								RTLIL::Wire *new_port = module->addWire(orig_name, it.first);
 | 
				
			||||||
			it.first->port_id = 0;
 | 
								it.first->port_id = 0;
 | 
				
			||||||
			it.first->port_input = false;
 | 
								it.first->port_input = false;
 | 
				
			||||||
			it.first->port_output = false;
 | 
								it.first->port_output = false;
 | 
				
			||||||
			module->add(it.first);
 | 
					
 | 
				
			||||||
			module->add(new_port);
 | 
					 | 
				
			||||||
			module->connect(RTLIL::SigSig(new_port, it.second));
 | 
								module->connect(RTLIL::SigSig(new_port, it.second));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -208,11 +208,11 @@ static void create_dff_dq_map(std::map<std::string, dff_map_info_t> &map, RTLIL:
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void add_new_wire(RTLIL::Module *module, RTLIL::Wire *wire)
 | 
					static RTLIL::Wire *add_new_wire(RTLIL::Module *module, std::string name, int width = 1)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (module->count_id(wire->name))
 | 
						if (module->count_id(name))
 | 
				
			||||||
		log_error("Attempting to create wire %s, but a wire of this name exists already! Hint: Try another value for -sep.\n", RTLIL::id2cstr(wire->name));
 | 
							log_error("Attempting to create wire %s, but a wire of this name exists already! Hint: Try another value for -sep.\n", log_id(name));
 | 
				
			||||||
	module->add(wire);
 | 
						return module->addWire(name, width);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct ExposePass : public Pass {
 | 
					struct ExposePass : public Pass {
 | 
				
			||||||
| 
						 | 
					@ -448,7 +448,6 @@ struct ExposePass : public Pass {
 | 
				
			||||||
			SigMap sigmap(module);
 | 
								SigMap sigmap(module);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			SigMap out_to_in_map;
 | 
								SigMap out_to_in_map;
 | 
				
			||||||
			std::vector<RTLIL::Wire*> new_wires;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			for (auto &it : module->wires)
 | 
								for (auto &it : module->wires)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					@ -468,20 +467,14 @@ struct ExposePass : public Pass {
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (flag_cut) {
 | 
									if (flag_cut) {
 | 
				
			||||||
					RTLIL::Wire *in_wire = new RTLIL::Wire;
 | 
										RTLIL::Wire *in_wire = add_new_wire(module, it.second->name + sep + "i", it.second->width);
 | 
				
			||||||
					in_wire->name = it.second->name + sep + "i";
 | 
					 | 
				
			||||||
					in_wire->width = it.second->width;
 | 
					 | 
				
			||||||
					in_wire->port_input = true;
 | 
										in_wire->port_input = true;
 | 
				
			||||||
					out_to_in_map.add(sigmap(it.second), in_wire);
 | 
										out_to_in_map.add(sigmap(it.second), in_wire);
 | 
				
			||||||
					new_wires.push_back(in_wire);
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (flag_cut)
 | 
								if (flag_cut)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				for (auto it : new_wires)
 | 
					 | 
				
			||||||
					add_new_wire(module, it);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
				for (auto &it : module->cells) {
 | 
									for (auto &it : module->cells) {
 | 
				
			||||||
					if (!ct.cell_known(it.second->type))
 | 
										if (!ct.cell_known(it.second->type))
 | 
				
			||||||
						continue;
 | 
											continue;
 | 
				
			||||||
| 
						 | 
					@ -507,10 +500,7 @@ struct ExposePass : public Pass {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				dff_map_info_t &info = dq.second;
 | 
									dff_map_info_t &info = dq.second;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				RTLIL::Wire *wire_dummy_q = new RTLIL::Wire;
 | 
									RTLIL::Wire *wire_dummy_q = add_new_wire(module, NEW_ID, 0);
 | 
				
			||||||
				wire_dummy_q->name = NEW_ID;
 | 
					 | 
				
			||||||
				wire_dummy_q->width = 0;
 | 
					 | 
				
			||||||
				add_new_wire(module, wire_dummy_q);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for (auto &cell_name : info.cells) {
 | 
									for (auto &cell_name : info.cells) {
 | 
				
			||||||
					RTLIL::Cell *cell = module->cells.at(cell_name);
 | 
										RTLIL::Cell *cell = module->cells.at(cell_name);
 | 
				
			||||||
| 
						 | 
					@ -521,12 +511,9 @@ struct ExposePass : public Pass {
 | 
				
			||||||
					cell->set("\\Q", cell_q_bits);
 | 
										cell->set("\\Q", cell_q_bits);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				RTLIL::Wire *wire_q = new RTLIL::Wire;
 | 
									RTLIL::Wire *wire_q = add_new_wire(module, wire->name + sep + "q", wire->width);
 | 
				
			||||||
				wire_q->name = wire->name + sep + "q";
 | 
					 | 
				
			||||||
				wire_q->width = wire->width;
 | 
					 | 
				
			||||||
				wire_q->port_input = true;
 | 
									wire_q->port_input = true;
 | 
				
			||||||
				log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_q->name));
 | 
									log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_q->name));
 | 
				
			||||||
				add_new_wire(module, wire_q);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				RTLIL::SigSig connect_q;
 | 
									RTLIL::SigSig connect_q;
 | 
				
			||||||
				for (size_t i = 0; i < wire_bits_vec.size(); i++) {
 | 
									for (size_t i = 0; i < wire_bits_vec.size(); i++) {
 | 
				
			||||||
| 
						 | 
					@ -538,19 +525,14 @@ struct ExposePass : public Pass {
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				module->connect(connect_q);
 | 
									module->connect(connect_q);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				RTLIL::Wire *wire_d = new RTLIL::Wire;
 | 
									RTLIL::Wire *wire_d = add_new_wire(module, wire->name + sep + "d", wire->width);
 | 
				
			||||||
				wire_d->name = wire->name + sep + "d";
 | 
					 | 
				
			||||||
				wire_d->width = wire->width;
 | 
					 | 
				
			||||||
				wire_d->port_output = true;
 | 
									wire_d->port_output = true;
 | 
				
			||||||
				log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_d->name));
 | 
									log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_d->name));
 | 
				
			||||||
				add_new_wire(module, wire_d);
 | 
					 | 
				
			||||||
				module->connect(RTLIL::SigSig(wire_d, info.sig_d));
 | 
									module->connect(RTLIL::SigSig(wire_d, info.sig_d));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				RTLIL::Wire *wire_c = new RTLIL::Wire;
 | 
									RTLIL::Wire *wire_c = add_new_wire(module, wire->name + sep + "c");
 | 
				
			||||||
				wire_c->name = wire->name + sep + "c";
 | 
					 | 
				
			||||||
				wire_c->port_output = true;
 | 
									wire_c->port_output = true;
 | 
				
			||||||
				log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_c->name));
 | 
									log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_c->name));
 | 
				
			||||||
				add_new_wire(module, wire_c);
 | 
					 | 
				
			||||||
				if (info.clk_polarity) {
 | 
									if (info.clk_polarity) {
 | 
				
			||||||
					module->connect(RTLIL::SigSig(wire_c, info.sig_clk));
 | 
										module->connect(RTLIL::SigSig(wire_c, info.sig_clk));
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
| 
						 | 
					@ -564,11 +546,9 @@ struct ExposePass : public Pass {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (info.sig_arst != RTLIL::State::Sm)
 | 
									if (info.sig_arst != RTLIL::State::Sm)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					RTLIL::Wire *wire_r = new RTLIL::Wire;
 | 
										RTLIL::Wire *wire_r = add_new_wire(module, wire->name + sep + "r");
 | 
				
			||||||
					wire_r->name = wire->name + sep + "r";
 | 
					 | 
				
			||||||
					wire_r->port_output = true;
 | 
										wire_r->port_output = true;
 | 
				
			||||||
					log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_r->name));
 | 
										log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_r->name));
 | 
				
			||||||
					add_new_wire(module, wire_r);
 | 
					 | 
				
			||||||
					if (info.arst_polarity) {
 | 
										if (info.arst_polarity) {
 | 
				
			||||||
						module->connect(RTLIL::SigSig(wire_r, info.sig_arst));
 | 
											module->connect(RTLIL::SigSig(wire_r, info.sig_arst));
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
| 
						 | 
					@ -580,12 +560,9 @@ struct ExposePass : public Pass {
 | 
				
			||||||
						c->set("\\Y", wire_r);
 | 
											c->set("\\Y", wire_r);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					RTLIL::Wire *wire_v = new RTLIL::Wire;
 | 
										RTLIL::Wire *wire_v = add_new_wire(module, wire->name + sep + "v", wire->width);
 | 
				
			||||||
					wire_v->name = wire->name + sep + "v";
 | 
					 | 
				
			||||||
					wire_v->width = wire->width;
 | 
					 | 
				
			||||||
					wire_v->port_output = true;
 | 
										wire_v->port_output = true;
 | 
				
			||||||
					log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_v->name));
 | 
										log("New module port: %s/%s\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire_v->name));
 | 
				
			||||||
					add_new_wire(module, wire_v);
 | 
					 | 
				
			||||||
					module->connect(RTLIL::SigSig(wire_v, info.arst_value));
 | 
										module->connect(RTLIL::SigSig(wire_v, info.arst_value));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -616,14 +593,11 @@ struct ExposePass : public Pass {
 | 
				
			||||||
							if (!p->port_input && !p->port_output)
 | 
												if (!p->port_input && !p->port_output)
 | 
				
			||||||
								continue;
 | 
													continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							RTLIL::Wire *w = new RTLIL::Wire;
 | 
												RTLIL::Wire *w = add_new_wire(module, cell->name + sep + RTLIL::unescape_id(p->name), p->width);
 | 
				
			||||||
							w->name = cell->name + sep + RTLIL::unescape_id(p->name);
 | 
					 | 
				
			||||||
							w->width = p->width;
 | 
					 | 
				
			||||||
							if (p->port_input)
 | 
												if (p->port_input)
 | 
				
			||||||
								w->port_output = true;
 | 
													w->port_output = true;
 | 
				
			||||||
							if (p->port_output)
 | 
												if (p->port_output)
 | 
				
			||||||
								w->port_input = true;
 | 
													w->port_input = true;
 | 
				
			||||||
							add_new_wire(module, w);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
							log("New module port: %s/%s (%s)\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(w->name), RTLIL::id2cstr(cell->type));
 | 
												log("New module port: %s/%s (%s)\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(w->name), RTLIL::id2cstr(cell->type));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -641,14 +615,11 @@ struct ExposePass : public Pass {
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						for (auto &it : cell->connections())
 | 
											for (auto &it : cell->connections())
 | 
				
			||||||
						{
 | 
											{
 | 
				
			||||||
							RTLIL::Wire *w = new RTLIL::Wire;
 | 
												RTLIL::Wire *w = add_new_wire(module, cell->name + sep + RTLIL::unescape_id(it.first), it.second.size());
 | 
				
			||||||
							w->name = cell->name + sep + RTLIL::unescape_id(it.first);
 | 
					 | 
				
			||||||
							w->width = it.second.size();
 | 
					 | 
				
			||||||
							if (ct.cell_input(cell->type, it.first))
 | 
												if (ct.cell_input(cell->type, it.first))
 | 
				
			||||||
								w->port_output = true;
 | 
													w->port_output = true;
 | 
				
			||||||
							if (ct.cell_output(cell->type, it.first))
 | 
												if (ct.cell_output(cell->type, it.first))
 | 
				
			||||||
								w->port_input = true;
 | 
													w->port_input = true;
 | 
				
			||||||
							add_new_wire(module, w);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
							log("New module port: %s/%s (%s)\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(w->name), RTLIL::id2cstr(cell->type));
 | 
												log("New module port: %s/%s (%s)\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(w->name), RTLIL::id2cstr(cell->type));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -729,13 +729,10 @@ struct ExtractPass : public Pass {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				int portCounter = 1;
 | 
									int portCounter = 1;
 | 
				
			||||||
				for (auto wire : wires) {
 | 
									for (auto wire : wires) {
 | 
				
			||||||
					RTLIL::Wire *newWire = new RTLIL::Wire;
 | 
										RTLIL::Wire *newWire = newMod->addWire(wire->name, wire->width);
 | 
				
			||||||
					newWire->name = wire->name;
 | 
					 | 
				
			||||||
					newWire->width = wire->width;
 | 
					 | 
				
			||||||
					newWire->port_id = portCounter++;
 | 
										newWire->port_id = portCounter++;
 | 
				
			||||||
					newWire->port_input = true;
 | 
										newWire->port_input = true;
 | 
				
			||||||
					newWire->port_output = true;
 | 
										newWire->port_output = true;
 | 
				
			||||||
					newMod->add(newWire);
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for (auto cell : cells) {
 | 
									for (auto cell : cells) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -164,13 +164,8 @@ struct IopadmapPass : public Pass {
 | 
				
			||||||
				log("Mapping port %s.%s using %s.\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire->name), celltype.c_str());
 | 
									log("Mapping port %s.%s using %s.\n", RTLIL::id2cstr(module->name), RTLIL::id2cstr(wire->name), celltype.c_str());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				RTLIL::Wire *new_wire = NULL;
 | 
									RTLIL::Wire *new_wire = NULL;
 | 
				
			||||||
				if (!portname2.empty()) {
 | 
									if (!portname2.empty())
 | 
				
			||||||
					new_wire = new RTLIL::Wire;
 | 
										new_wire = module->addWire(NEW_ID, wire);
 | 
				
			||||||
					*new_wire = *wire;
 | 
					 | 
				
			||||||
					wire->name = NEW_ID;
 | 
					 | 
				
			||||||
					module->wires[wire->name] = wire;
 | 
					 | 
				
			||||||
					module->wires[new_wire->name] = new_wire;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (flag_bits)
 | 
									if (flag_bits)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -128,14 +128,14 @@ struct TechmapWorker
 | 
				
			||||||
		for (auto &it : tpl->wires) {
 | 
							for (auto &it : tpl->wires) {
 | 
				
			||||||
			if (it.second->port_id > 0)
 | 
								if (it.second->port_id > 0)
 | 
				
			||||||
				positional_ports[stringf("$%d", it.second->port_id)] = it.first;
 | 
									positional_ports[stringf("$%d", it.second->port_id)] = it.first;
 | 
				
			||||||
			RTLIL::Wire *w = new RTLIL::Wire(*it.second);
 | 
								std::string w_name = it.second->name;
 | 
				
			||||||
			apply_prefix(cell->name, w->name);
 | 
								apply_prefix(cell->name, w_name);
 | 
				
			||||||
 | 
								RTLIL::Wire *w = module->addWire(w_name, it.second);
 | 
				
			||||||
			w->port_input = false;
 | 
								w->port_input = false;
 | 
				
			||||||
			w->port_output = false;
 | 
								w->port_output = false;
 | 
				
			||||||
			w->port_id = 0;
 | 
								w->port_id = 0;
 | 
				
			||||||
			if (it.second->get_bool_attribute("\\_techmap_special_"))
 | 
								if (it.second->get_bool_attribute("\\_techmap_special_"))
 | 
				
			||||||
				w->attributes.clear();
 | 
									w->attributes.clear();
 | 
				
			||||||
			module->add(w);
 | 
					 | 
				
			||||||
			design->select(module, w);
 | 
								design->select(module, w);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -381,7 +381,6 @@ struct TechmapWorker
 | 
				
			||||||
								log_error("Techmap yielded config wire %s with non-const value %s.\n", RTLIL::id2cstr(data.wire->name), log_signal(data.value));
 | 
													log_error("Techmap yielded config wire %s with non-const value %s.\n", RTLIL::id2cstr(data.wire->name), log_signal(data.value));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							techmap_wire_names.erase(it.first);
 | 
												techmap_wire_names.erase(it.first);
 | 
				
			||||||
							tpl->wires.erase(data.wire->name);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
							const char *p = data.wire->name.c_str();
 | 
												const char *p = data.wire->name.c_str();
 | 
				
			||||||
							const char *q = strrchr(p+1, '.');
 | 
												const char *q = strrchr(p+1, '.');
 | 
				
			||||||
| 
						 | 
					@ -391,8 +390,7 @@ struct TechmapWorker
 | 
				
			||||||
							std::string new_name = data.wire->name.substr(0, q-p) + "_TECHMAP_DONE_" + data.wire->name.substr(q-p+12);
 | 
												std::string new_name = data.wire->name.substr(0, q-p) + "_TECHMAP_DONE_" + data.wire->name.substr(q-p+12);
 | 
				
			||||||
							while (tpl->wires.count(new_name))
 | 
												while (tpl->wires.count(new_name))
 | 
				
			||||||
								new_name += "_";
 | 
													new_name += "_";
 | 
				
			||||||
							data.wire->name = new_name;
 | 
												tpl->rename(data.wire, new_name);
 | 
				
			||||||
							tpl->add(data.wire);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
							std::string cmd_string = data.value.as_const().decode_string();
 | 
												std::string cmd_string = data.value.as_const().decode_string();
 | 
				
			||||||
							Pass::call_on_module(map, tpl, cmd_string);
 | 
												Pass::call_on_module(map, tpl, cmd_string);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue