mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Be slightly less aggressive in "deminout" pass
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									25c5002f83
								
							
						
					
					
						commit
						675a44b41a
					
				
					 1 changed files with 28 additions and 4 deletions
				
			
		|  | @ -57,7 +57,7 @@ struct DeminoutPass : public Pass { | ||||||
| 			for (auto module : design->selected_modules()) | 			for (auto module : design->selected_modules()) | ||||||
| 			{ | 			{ | ||||||
| 				SigMap sigmap(module); | 				SigMap sigmap(module); | ||||||
| 				pool<SigBit> bits_written, bits_used, bits_inout; | 				pool<SigBit> bits_written, bits_used, bits_inout, bits_tribuf; | ||||||
| 				dict<SigBit, int> bits_numports; | 				dict<SigBit, int> bits_numports; | ||||||
| 
 | 
 | ||||||
| 				for (auto wire : module->wires()) | 				for (auto wire : module->wires()) | ||||||
|  | @ -82,6 +82,25 @@ struct DeminoutPass : public Pass { | ||||||
| 					if (cellport_in) | 					if (cellport_in) | ||||||
| 						for (auto bit : sigmap(conn.second)) | 						for (auto bit : sigmap(conn.second)) | ||||||
| 							bits_used.insert(bit); | 							bits_used.insert(bit); | ||||||
|  | 
 | ||||||
|  | 					if (conn.first == "\\Y" && cell->type.in("$mux", "$pmux", "$_MUX_", "$_TBUF_")) | ||||||
|  | 					{ | ||||||
|  | 						bool tribuf = (cell->type == "$_TBUF_"); | ||||||
|  | 
 | ||||||
|  | 						if (!tribuf) { | ||||||
|  | 							for (auto &c : cell->connections()) { | ||||||
|  | 								if (!c.first.in("\\A", "\\B")) | ||||||
|  | 									continue; | ||||||
|  | 								for (auto b : sigmap(c.second)) | ||||||
|  | 									if (b == State::Sz) | ||||||
|  | 										tribuf = true; | ||||||
|  | 							} | ||||||
|  | 						} | ||||||
|  | 
 | ||||||
|  | 						if (tribuf) | ||||||
|  | 							for (auto bit : sigmap(conn.second)) | ||||||
|  | 								bits_tribuf.insert(bit); | ||||||
|  | 					} | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				for (auto wire : module->selected_wires()) | 				for (auto wire : module->selected_wires()) | ||||||
|  | @ -95,11 +114,16 @@ struct DeminoutPass : public Pass { | ||||||
| 							if (bits_numports[bit] > 1 || bits_inout.count(bit)) | 							if (bits_numports[bit] > 1 || bits_inout.count(bit)) | ||||||
| 								new_input = true, new_output = true; | 								new_input = true, new_output = true; | ||||||
| 
 | 
 | ||||||
| 							if (bits_written.count(bit)) | 							if (bits_written.count(bit)) { | ||||||
| 								new_output = true; | 								new_output = true; | ||||||
| 							else if (bits_used.count(bit)) | 								if (bits_tribuf.count(bit)) | ||||||
|  | 									goto tribuf_bit; | ||||||
|  | 							} else { | ||||||
|  | 						tribuf_bit: | ||||||
|  | 								if (bits_used.count(bit)) | ||||||
| 									new_input = true; | 									new_input = true; | ||||||
| 							} | 							} | ||||||
|  | 						} | ||||||
| 
 | 
 | ||||||
| 						if (new_input != new_output) { | 						if (new_input != new_output) { | ||||||
| 							log("Demoting inout port %s.%s to %s.\n", log_id(module), log_id(wire), new_input ? "input" : "output"); | 							log("Demoting inout port %s.%s to %s.\n", log_id(module), log_id(wire), new_input ? "input" : "output"); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue