mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 19:52:31 +00:00 
			
		
		
		
	Add src attribute to extra cells generated by proc_dlatch
This commit is contained in:
		
							parent
							
								
									13eb47c692
								
							
						
					
					
						commit
						f9d023c53f
					
				
					 1 changed files with 9 additions and 7 deletions
				
			
		|  | @ -217,7 +217,7 @@ struct proc_dlatch_db_t | |||
| 		return make_inner(children); | ||||
| 	} | ||||
| 
 | ||||
| 	SigBit make_hold(int n) | ||||
| 	SigBit make_hold(int n, string &src) | ||||
| 	{ | ||||
| 		if (n == true_node) | ||||
| 			return State::S1; | ||||
|  | @ -235,20 +235,20 @@ struct proc_dlatch_db_t | |||
| 			if (rule.match == State::S1) | ||||
| 				and_bits.append(rule.signal); | ||||
| 			else if (rule.match == State::S0) | ||||
| 				and_bits.append(module->Not(NEW_ID, rule.signal)); | ||||
| 				and_bits.append(module->Not(NEW_ID, rule.signal, false, src)); | ||||
| 			else | ||||
| 				and_bits.append(module->Eq(NEW_ID, rule.signal, rule.match)); | ||||
| 				and_bits.append(module->Eq(NEW_ID, rule.signal, rule.match, false, src)); | ||||
| 		} | ||||
| 
 | ||||
| 		if (!rule.children.empty()) { | ||||
| 			SigSpec or_bits; | ||||
| 			for (int k : rule.children) | ||||
| 				or_bits.append(make_hold(k)); | ||||
| 			and_bits.append(module->ReduceOr(NEW_ID, or_bits)); | ||||
| 				or_bits.append(make_hold(k, src)); | ||||
| 			and_bits.append(module->ReduceOr(NEW_ID, or_bits, false, src)); | ||||
| 		} | ||||
| 
 | ||||
| 		if (GetSize(and_bits) == 2) | ||||
| 			and_bits = module->And(NEW_ID, and_bits[0], and_bits[1]); | ||||
| 			and_bits = module->And(NEW_ID, and_bits[0], and_bits[1], false, src); | ||||
| 		log_assert(GetSize(and_bits) == 1); | ||||
| 
 | ||||
| 		rules_sig[n] = and_bits[0]; | ||||
|  | @ -340,6 +340,7 @@ void proc_dlatch(proc_dlatch_db_t &db, RTLIL::Process *proc) | |||
| 	RTLIL::SigSig latches_bits, nolatches_bits; | ||||
| 	dict<SigBit, SigBit> latches_out_in; | ||||
| 	dict<SigBit, int> latches_hold; | ||||
| 	std::string src = proc->get_src_attribute(); | ||||
| 
 | ||||
| 	for (auto sr : proc->syncs) | ||||
| 	{ | ||||
|  | @ -405,7 +406,8 @@ void proc_dlatch(proc_dlatch_db_t &db, RTLIL::Process *proc) | |||
| 			SigSpec lhs = latches_bits.first.extract(offset, width); | ||||
| 			SigSpec rhs = latches_bits.second.extract(offset, width); | ||||
| 
 | ||||
| 			Cell *cell = db.module->addDlatch(NEW_ID, db.module->Not(NEW_ID, db.make_hold(n)), rhs, lhs); | ||||
| 			Cell *cell = db.module->addDlatch(NEW_ID, db.module->Not(NEW_ID, db.make_hold(n, src)), rhs, lhs); | ||||
| 			cell->set_src_attribute(src); | ||||
| 			db.generated_dlatches.insert(cell); | ||||
| 
 | ||||
| 			log("Latch inferred for signal `%s.%s' from process `%s.%s': %s\n", | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue