mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Fixed all users of SigSpec::chunks_rw() and removed it
This commit is contained in:
		
							parent
							
								
									85db102e13
								
							
						
					
					
						commit
						4e802eb7f6
					
				
					 11 changed files with 80 additions and 91 deletions
				
			
		| 
						 | 
					@ -533,7 +533,6 @@ public:
 | 
				
			||||||
	SigSpec(std::vector<RTLIL::SigBit> bits);
 | 
						SigSpec(std::vector<RTLIL::SigBit> bits);
 | 
				
			||||||
	SigSpec(std::set<RTLIL::SigBit> bits);
 | 
						SigSpec(std::set<RTLIL::SigBit> bits);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	inline std::vector<RTLIL::SigChunk> &chunks_rw() { pack(); return chunks_; }
 | 
					 | 
				
			||||||
	inline const std::vector<RTLIL::SigChunk> &chunks() const { pack(); return chunks_; }
 | 
						inline const std::vector<RTLIL::SigChunk> &chunks() const { pack(); return chunks_; }
 | 
				
			||||||
	inline const std::vector<RTLIL::SigBit> &bits() const { inline_unpack(); return bits_; }
 | 
						inline const std::vector<RTLIL::SigBit> &bits() const { inline_unpack(); return bits_; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -597,7 +596,8 @@ public:
 | 
				
			||||||
	static bool parse_sel(RTLIL::SigSpec &sig, RTLIL::Design *design, RTLIL::Module *module, std::string str);
 | 
						static bool parse_sel(RTLIL::SigSpec &sig, RTLIL::Design *design, RTLIL::Module *module, std::string str);
 | 
				
			||||||
	static bool parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str);
 | 
						static bool parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	operator std::vector<RTLIL::SigBit>() const { return to_sigbit_vector(); }
 | 
						operator std::vector<RTLIL::SigChunk>() const { return chunks(); }
 | 
				
			||||||
 | 
						operator std::vector<RTLIL::SigBit>() const { return bits(); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void check() const;
 | 
						void check() const;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -27,12 +27,13 @@ struct DeleteWireWorker
 | 
				
			||||||
	std::set<std::string> *delete_wires_p;
 | 
						std::set<std::string> *delete_wires_p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void operator()(RTLIL::SigSpec &sig) {
 | 
						void operator()(RTLIL::SigSpec &sig) {
 | 
				
			||||||
		sig.optimize();
 | 
							std::vector<RTLIL::SigChunk> chunks = sig;
 | 
				
			||||||
		for (auto &c : sig.chunks_rw())
 | 
							for (auto &c : chunks)
 | 
				
			||||||
			if (c.wire != NULL && delete_wires_p->count(c.wire->name)) {
 | 
								if (c.wire != NULL && delete_wires_p->count(c.wire->name)) {
 | 
				
			||||||
				c.wire = module->addWire(NEW_ID, c.width);
 | 
									c.wire = module->addWire(NEW_ID, c.width);
 | 
				
			||||||
				c.offset = 0;
 | 
									c.offset = 0;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							sig = chunks;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,10 +23,12 @@
 | 
				
			||||||
#include "kernel/rtlil.h"
 | 
					#include "kernel/rtlil.h"
 | 
				
			||||||
#include "kernel/log.h"
 | 
					#include "kernel/log.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int next_bit_mode;
 | 
					struct SetundefWorker
 | 
				
			||||||
static uint32_t next_bit_state;
 | 
					{
 | 
				
			||||||
 | 
						int next_bit_mode;
 | 
				
			||||||
 | 
						uint32_t next_bit_state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static RTLIL::State next_bit()
 | 
						RTLIL::State next_bit()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (next_bit_mode == 0)
 | 
							if (next_bit_mode == 0)
 | 
				
			||||||
			return RTLIL::State::S0;
 | 
								return RTLIL::State::S0;
 | 
				
			||||||
| 
						 | 
					@ -43,15 +45,11 @@ static RTLIL::State next_bit()
 | 
				
			||||||
		return ((next_bit_state >> (next_bit_state & 15)) & 16) ? RTLIL::State::S0 : RTLIL::State::S1;
 | 
							return ((next_bit_state >> (next_bit_state & 15)) & 16) ? RTLIL::State::S0 : RTLIL::State::S1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct SetundefWorker
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	void operator()(RTLIL::SigSpec &sig)
 | 
						void operator()(RTLIL::SigSpec &sig)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		sig.expand();
 | 
							for (auto &bit : sig)
 | 
				
			||||||
		for (auto &c : sig.chunks_rw())
 | 
								if (bit.wire == NULL && bit.data > RTLIL::State::S1)
 | 
				
			||||||
			if (c.wire == NULL && c.data.bits.at(0) > RTLIL::State::S1)
 | 
									bit = next_bit();
 | 
				
			||||||
				c.data.bits.at(0) = next_bit();
 | 
					 | 
				
			||||||
		sig.optimize();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -83,6 +81,7 @@ struct SetundefPass : public Pass {
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		bool got_value = false;
 | 
							bool got_value = false;
 | 
				
			||||||
		bool undriven_mode = false;
 | 
							bool undriven_mode = false;
 | 
				
			||||||
 | 
							SetundefWorker worker;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		size_t argidx;
 | 
							size_t argidx;
 | 
				
			||||||
		for (argidx = 1; argidx < args.size(); argidx++)
 | 
							for (argidx = 1; argidx < args.size(); argidx++)
 | 
				
			||||||
| 
						 | 
					@ -93,20 +92,20 @@ struct SetundefPass : public Pass {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (args[argidx] == "-zero") {
 | 
								if (args[argidx] == "-zero") {
 | 
				
			||||||
				got_value = true;
 | 
									got_value = true;
 | 
				
			||||||
				next_bit_mode = 0;
 | 
									worker.next_bit_mode = 0;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (args[argidx] == "-one") {
 | 
								if (args[argidx] == "-one") {
 | 
				
			||||||
				got_value = true;
 | 
									got_value = true;
 | 
				
			||||||
				next_bit_mode = 1;
 | 
									worker.next_bit_mode = 1;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (args[argidx] == "-random" && !got_value && argidx+1 < args.size()) {
 | 
								if (args[argidx] == "-random" && !got_value && argidx+1 < args.size()) {
 | 
				
			||||||
				got_value = true;
 | 
									got_value = true;
 | 
				
			||||||
				next_bit_mode = 2;
 | 
									worker.next_bit_mode = 2;
 | 
				
			||||||
				next_bit_state = atoi(args[++argidx].c_str()) + 1;
 | 
									worker.next_bit_state = atoi(args[++argidx].c_str()) + 1;
 | 
				
			||||||
				for (int i = 0; i < 10; i++)
 | 
									for (int i = 0; i < 10; i++)
 | 
				
			||||||
					next_bit();
 | 
										worker.next_bit();
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
| 
						 | 
					@ -144,13 +143,13 @@ struct SetundefPass : public Pass {
 | 
				
			||||||
				for (auto &c : sig.chunks()) {
 | 
									for (auto &c : sig.chunks()) {
 | 
				
			||||||
					RTLIL::SigSpec bits;
 | 
										RTLIL::SigSpec bits;
 | 
				
			||||||
					for (int i = 0; i < c.width; i++)
 | 
										for (int i = 0; i < c.width; i++)
 | 
				
			||||||
						bits.append(next_bit());
 | 
											bits.append(worker.next_bit());
 | 
				
			||||||
					bits.optimize();
 | 
										bits.optimize();
 | 
				
			||||||
					module->connections.push_back(RTLIL::SigSig(c, bits));
 | 
										module->connections.push_back(RTLIL::SigSig(c, bits));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			module->rewrite_sigspecs(SetundefWorker());
 | 
								module->rewrite_sigspecs(worker);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
} SetundefPass;
 | 
					} SetundefPass;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,11 +62,9 @@ struct SplitnetsWorker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void operator()(RTLIL::SigSpec &sig)
 | 
						void operator()(RTLIL::SigSpec &sig)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		sig.expand();
 | 
							for (auto &bit : sig)
 | 
				
			||||||
		for (auto &c : sig.chunks_rw())
 | 
								if (splitmap.count(bit.wire) > 0)
 | 
				
			||||||
			if (splitmap.count(c.wire) > 0)
 | 
									bit = splitmap.at(bit.wire).at(bit.offset);
 | 
				
			||||||
				c = splitmap.at(c.wire).at(c.offset);
 | 
					 | 
				
			||||||
		sig.optimize();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -164,10 +164,10 @@ struct SubmodWorker
 | 
				
			||||||
		for (RTLIL::Cell *cell : submod.cells) {
 | 
							for (RTLIL::Cell *cell : submod.cells) {
 | 
				
			||||||
			RTLIL::Cell *new_cell = new RTLIL::Cell(*cell);
 | 
								RTLIL::Cell *new_cell = new RTLIL::Cell(*cell);
 | 
				
			||||||
			for (auto &conn : new_cell->connections)
 | 
								for (auto &conn : new_cell->connections)
 | 
				
			||||||
				for (auto &c : conn.second.chunks_rw())
 | 
									for (auto &bit : conn.second)
 | 
				
			||||||
					if (c.wire != NULL) {
 | 
										if (bit.wire != NULL) {
 | 
				
			||||||
						assert(wire_flags.count(c.wire) > 0);
 | 
											assert(wire_flags.count(bit.wire) > 0);
 | 
				
			||||||
						c.wire = wire_flags[c.wire].new_wire;
 | 
											bit.wire = wire_flags[bit.wire].new_wire;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
			log("  cell %s (%s)\n", new_cell->name.c_str(), new_cell->type.c_str());
 | 
								log("  cell %s (%s)\n", new_cell->name.c_str(), new_cell->type.c_str());
 | 
				
			||||||
			new_mod->cells[new_cell->name] = new_cell;
 | 
								new_mod->cells[new_cell->name] = new_cell;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,13 +32,10 @@ static void normalize_sig(RTLIL::Module *module, RTLIL::SigSpec &sig)
 | 
				
			||||||
static bool find_sig_before_dff(RTLIL::Module *module, RTLIL::SigSpec &sig, RTLIL::SigSpec &clk, bool &clk_polarity, bool after = false)
 | 
					static bool find_sig_before_dff(RTLIL::Module *module, RTLIL::SigSpec &sig, RTLIL::SigSpec &clk, bool &clk_polarity, bool after = false)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	normalize_sig(module, sig);
 | 
						normalize_sig(module, sig);
 | 
				
			||||||
	sig.expand();
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (size_t i = 0; i < sig.chunks().size(); i++)
 | 
						for (auto &bit : sig)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		RTLIL::SigChunk &chunk = sig.chunks_rw()[i];
 | 
							if (bit.wire == NULL)
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (chunk.wire == NULL)
 | 
					 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (auto &cell_it : module->cells)
 | 
							for (auto &cell_it : module->cells)
 | 
				
			||||||
| 
						 | 
					@ -58,12 +55,11 @@ static bool find_sig_before_dff(RTLIL::Module *module, RTLIL::SigSpec &sig, RTLI
 | 
				
			||||||
			RTLIL::SigSpec q_norm = cell->connections[after ? "\\D" : "\\Q"];
 | 
								RTLIL::SigSpec q_norm = cell->connections[after ? "\\D" : "\\Q"];
 | 
				
			||||||
			normalize_sig(module, q_norm);
 | 
								normalize_sig(module, q_norm);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			RTLIL::SigSpec d = q_norm.extract(chunk, &cell->connections[after ? "\\Q" : "\\D"]);
 | 
								RTLIL::SigSpec d = q_norm.extract(bit, &cell->connections[after ? "\\Q" : "\\D"]);
 | 
				
			||||||
			if (d.size() != 1)
 | 
								if (d.size() != 1)
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			assert(d.chunks().size() == 1);
 | 
								bit = d;
 | 
				
			||||||
			chunk = d.chunks()[0];
 | 
					 | 
				
			||||||
			clk = cell->connections["\\CLK"];
 | 
								clk = cell->connections["\\CLK"];
 | 
				
			||||||
			clk_polarity = cell->parameters["\\CLK_POLARITY"].as_bool();
 | 
								clk_polarity = cell->parameters["\\CLK_POLARITY"].as_bool();
 | 
				
			||||||
			goto replaced_this_bit;
 | 
								goto replaced_this_bit;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -165,11 +165,9 @@ restart_proc_arst:
 | 
				
			||||||
				for (auto &action : sync->actions) {
 | 
									for (auto &action : sync->actions) {
 | 
				
			||||||
					RTLIL::SigSpec rspec = action.second;
 | 
										RTLIL::SigSpec rspec = action.second;
 | 
				
			||||||
					RTLIL::SigSpec rval = RTLIL::SigSpec(RTLIL::State::Sm, rspec.size());
 | 
										RTLIL::SigSpec rval = RTLIL::SigSpec(RTLIL::State::Sm, rspec.size());
 | 
				
			||||||
					rspec.expand(), rval.expand();
 | 
										for (int i = 0; i < SIZE(rspec); i++)
 | 
				
			||||||
					for (int i = 0; i < int(rspec.chunks().size()); i++)
 | 
											if (rspec[i].wire == NULL)
 | 
				
			||||||
						if (rspec.chunks()[i].wire == NULL)
 | 
												rval[i] = rspec[i];
 | 
				
			||||||
							rval.chunks_rw()[i] = rspec.chunks()[i];
 | 
					 | 
				
			||||||
					rspec.optimize(), rval.optimize();
 | 
					 | 
				
			||||||
					RTLIL::SigSpec last_rval;
 | 
										RTLIL::SigSpec last_rval;
 | 
				
			||||||
					for (int count = 0; rval != last_rval; count++) {
 | 
										for (int count = 0; rval != last_rval; count++) {
 | 
				
			||||||
						last_rval = rval;
 | 
											last_rval = rval;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,11 +70,9 @@ struct BruteForceEquivChecker
 | 
				
			||||||
					log_signal(undef2), log_signal(mod1_inputs), log_signal(inputs));
 | 
										log_signal(undef2), log_signal(mod1_inputs), log_signal(inputs));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (ignore_x_mod1) {
 | 
							if (ignore_x_mod1) {
 | 
				
			||||||
			sig1.expand(), sig2.expand();
 | 
								for (int i = 0; i < SIZE(sig1); i++)
 | 
				
			||||||
			for (size_t i = 0; i < sig1.chunks().size(); i++)
 | 
									if (sig1[i] == RTLIL::State::Sx)
 | 
				
			||||||
				if (sig1.chunks().at(i) == RTLIL::SigChunk(RTLIL::State::Sx))
 | 
										sig2[i] = RTLIL::State::Sx;
 | 
				
			||||||
					sig2.chunks_rw().at(i) = RTLIL::SigChunk(RTLIL::State::Sx);
 | 
					 | 
				
			||||||
			sig1.optimize(), sig2.optimize();
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (sig1 != sig2) {
 | 
							if (sig1 != sig2) {
 | 
				
			||||||
| 
						 | 
					@ -297,9 +295,9 @@ struct VlogHammerReporter
 | 
				
			||||||
					sig.expand();
 | 
										sig.expand();
 | 
				
			||||||
					if (rtl_sig.size() != sig.size())
 | 
										if (rtl_sig.size() != sig.size())
 | 
				
			||||||
						log_error("Output (y) has a different width in module %s compared to rtl!\n", RTLIL::id2cstr(module->name));
 | 
											log_error("Output (y) has a different width in module %s compared to rtl!\n", RTLIL::id2cstr(module->name));
 | 
				
			||||||
					for (int i = 0; i < sig.size(); i++)
 | 
										for (int i = 0; i < SIZE(sig); i++)
 | 
				
			||||||
						if (rtl_sig.chunks().at(i).data.bits.at(0) == RTLIL::State::Sx)
 | 
											if (rtl_sig[i] == RTLIL::State::Sx)
 | 
				
			||||||
							sig.chunks_rw().at(i).data.bits.at(0) = RTLIL::State::Sx;
 | 
												sig[i] = RTLIL::State::Sx;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				log("++RPT++ %d%s %s %s\n", idx, input_pattern_list.c_str(), sig.as_const().as_string().c_str(), module_name.c_str());
 | 
									log("++RPT++ %d%s %s %s\n", idx, input_pattern_list.c_str(), sig.as_const().as_string().c_str(), module_name.c_str());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -755,11 +755,11 @@ struct ExtractPass : public Pass {
 | 
				
			||||||
					newCell->type = cell->type;
 | 
										newCell->type = cell->type;
 | 
				
			||||||
					newCell->parameters = cell->parameters;
 | 
										newCell->parameters = cell->parameters;
 | 
				
			||||||
					for (auto &conn : cell->connections) {
 | 
										for (auto &conn : cell->connections) {
 | 
				
			||||||
						RTLIL::SigSpec sig = sigmap(conn.second);
 | 
											std::vector<RTLIL::SigChunk> chunks = sigmap(conn.second);
 | 
				
			||||||
						for (auto &chunk : sig.chunks_rw())
 | 
											for (auto &chunk : chunks)
 | 
				
			||||||
							if (chunk.wire != NULL)
 | 
												if (chunk.wire != NULL)
 | 
				
			||||||
								chunk.wire = newMod->wires.at(chunk.wire->name);
 | 
													chunk.wire = newMod->wires.at(chunk.wire->name);
 | 
				
			||||||
						newCell->connections[conn.first] = sig;
 | 
											newCell->connections[conn.first] = chunks;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					newMod->add(newCell);
 | 
										newMod->add(newCell);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,36 +26,34 @@ static std::string locell_celltype, locell_portname;
 | 
				
			||||||
static bool singleton_mode;
 | 
					static bool singleton_mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static RTLIL::Module *module;
 | 
					static RTLIL::Module *module;
 | 
				
			||||||
static RTLIL::SigChunk last_hi, last_lo;
 | 
					static RTLIL::SigBit last_hi, last_lo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void hilomap_worker(RTLIL::SigSpec &sig)
 | 
					void hilomap_worker(RTLIL::SigSpec &sig)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	sig.expand();
 | 
						for (auto &bit : sig) {
 | 
				
			||||||
	for (auto &c : sig.chunks_rw()) {
 | 
							if (bit == RTLIL::State::S1 && !hicell_celltype.empty()) {
 | 
				
			||||||
		if (c.wire == NULL && (c.data.bits.at(0) == RTLIL::State::S1) && !hicell_celltype.empty()) {
 | 
								if (!singleton_mode || last_hi == RTLIL::State::Sm) {
 | 
				
			||||||
			if (!singleton_mode || last_hi.width == 0) {
 | 
									last_hi = module->addWire(NEW_ID);
 | 
				
			||||||
				last_hi = RTLIL::SigChunk(module->addWire(NEW_ID));
 | 
					 | 
				
			||||||
				RTLIL::Cell *cell = new RTLIL::Cell;
 | 
									RTLIL::Cell *cell = new RTLIL::Cell;
 | 
				
			||||||
				cell->name = NEW_ID;
 | 
									cell->name = NEW_ID;
 | 
				
			||||||
				cell->type = RTLIL::escape_id(hicell_celltype);
 | 
									cell->type = RTLIL::escape_id(hicell_celltype);
 | 
				
			||||||
				cell->connections[RTLIL::escape_id(hicell_portname)] = last_hi;
 | 
									cell->connections[RTLIL::escape_id(hicell_portname)] = last_hi;
 | 
				
			||||||
				module->add(cell);
 | 
									module->add(cell);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			c = last_hi;
 | 
								bit = last_hi;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (c.wire == NULL && (c.data.bits.at(0) == RTLIL::State::S0) && !locell_celltype.empty()) {
 | 
							if (bit == RTLIL::State::S0 && !locell_celltype.empty()) {
 | 
				
			||||||
			if (!singleton_mode || last_lo.width == 0) {
 | 
								if (!singleton_mode || last_lo == RTLIL::State::Sm) {
 | 
				
			||||||
				last_lo = RTLIL::SigChunk(module->addWire(NEW_ID));
 | 
									last_lo = module->addWire(NEW_ID);
 | 
				
			||||||
				RTLIL::Cell *cell = new RTLIL::Cell;
 | 
									RTLIL::Cell *cell = new RTLIL::Cell;
 | 
				
			||||||
				cell->name = NEW_ID;
 | 
									cell->name = NEW_ID;
 | 
				
			||||||
				cell->type = RTLIL::escape_id(locell_celltype);
 | 
									cell->type = RTLIL::escape_id(locell_celltype);
 | 
				
			||||||
				cell->connections[RTLIL::escape_id(locell_portname)] = last_lo;
 | 
									cell->connections[RTLIL::escape_id(locell_portname)] = last_lo;
 | 
				
			||||||
				module->add(cell);
 | 
									module->add(cell);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			c = last_lo;
 | 
								bit = last_lo;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sig.optimize();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct HilomapPass : public Pass {
 | 
					struct HilomapPass : public Pass {
 | 
				
			||||||
| 
						 | 
					@ -119,8 +117,8 @@ struct HilomapPass : public Pass {
 | 
				
			||||||
			if (!design->selected(module))
 | 
								if (!design->selected(module))
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			last_hi = RTLIL::SigChunk();
 | 
								last_hi = RTLIL::State::Sm;
 | 
				
			||||||
			last_lo = RTLIL::SigChunk();
 | 
								last_lo = RTLIL::State::Sm;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			module->rewrite_sigspecs(hilomap_worker);
 | 
								module->rewrite_sigspecs(hilomap_worker);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,14 +41,15 @@ static void apply_prefix(std::string prefix, std::string &id)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void apply_prefix(std::string prefix, RTLIL::SigSpec &sig, RTLIL::Module *module)
 | 
					static void apply_prefix(std::string prefix, RTLIL::SigSpec &sig, RTLIL::Module *module)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	for (size_t i = 0; i < sig.chunks().size(); i++) {
 | 
						std::vector<RTLIL::SigChunk> chunks = sig;
 | 
				
			||||||
		if (sig.chunks()[i].wire == NULL)
 | 
						for (auto &chunk : chunks)
 | 
				
			||||||
			continue;
 | 
							if (chunk.wire != NULL) {
 | 
				
			||||||
		std::string wire_name = sig.chunks()[i].wire->name;
 | 
								std::string wire_name = chunk.wire->name;
 | 
				
			||||||
			apply_prefix(prefix, wire_name);
 | 
								apply_prefix(prefix, wire_name);
 | 
				
			||||||
			assert(module->wires.count(wire_name) > 0);
 | 
								assert(module->wires.count(wire_name) > 0);
 | 
				
			||||||
		sig.chunks_rw()[i].wire = module->wires[wire_name];
 | 
								chunk.wire = module->wires[wire_name];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						sig = chunks;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct TechmapWorker
 | 
					struct TechmapWorker
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue