mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Merge remote-tracking branch 'origin/eddie/submod_po' into xaig_dff
This commit is contained in:
		
						commit
						0806b8e398
					
				
					 2 changed files with 44 additions and 1 deletions
				
			
		| 
						 | 
					@ -20,6 +20,7 @@
 | 
				
			||||||
#include "kernel/register.h"
 | 
					#include "kernel/register.h"
 | 
				
			||||||
#include "kernel/celltypes.h"
 | 
					#include "kernel/celltypes.h"
 | 
				
			||||||
#include "kernel/log.h"
 | 
					#include "kernel/log.h"
 | 
				
			||||||
 | 
					#include "kernel/sigtools.h"
 | 
				
			||||||
#include <stdlib.h>
 | 
					#include <stdlib.h>
 | 
				
			||||||
#include <stdio.h>
 | 
					#include <stdio.h>
 | 
				
			||||||
#include <set>
 | 
					#include <set>
 | 
				
			||||||
| 
						 | 
					@ -32,6 +33,7 @@ struct SubmodWorker
 | 
				
			||||||
	CellTypes ct;
 | 
						CellTypes ct;
 | 
				
			||||||
	RTLIL::Design *design;
 | 
						RTLIL::Design *design;
 | 
				
			||||||
	RTLIL::Module *module;
 | 
						RTLIL::Module *module;
 | 
				
			||||||
 | 
						pool<Wire*> outputs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool copy_mode;
 | 
						bool copy_mode;
 | 
				
			||||||
	std::string opt_name;
 | 
						std::string opt_name;
 | 
				
			||||||
| 
						 | 
					@ -125,7 +127,7 @@ struct SubmodWorker
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (wire->port_input)
 | 
								if (wire->port_input)
 | 
				
			||||||
				flags.is_ext_driven = true;
 | 
									flags.is_ext_driven = true;
 | 
				
			||||||
			if (wire->port_output)
 | 
								if (wire->port_output || outputs.count(wire))
 | 
				
			||||||
				flags.is_ext_used = true;
 | 
									flags.is_ext_used = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			bool new_wire_port_input = false;
 | 
								bool new_wire_port_input = false;
 | 
				
			||||||
| 
						 | 
					@ -219,6 +221,22 @@ struct SubmodWorker
 | 
				
			||||||
		ct.setup_stdcells_mem();
 | 
							ct.setup_stdcells_mem();
 | 
				
			||||||
		ct.setup_design(design);
 | 
							ct.setup_design(design);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							SigMap sigmap(module);
 | 
				
			||||||
 | 
							for (auto port : module->ports) {
 | 
				
			||||||
 | 
								auto wire = module->wire(port);
 | 
				
			||||||
 | 
								if (!wire->port_output)
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								auto sig = sigmap(wire);
 | 
				
			||||||
 | 
								for (auto c : sig.chunks()) {
 | 
				
			||||||
 | 
									if (!c.wire)
 | 
				
			||||||
 | 
										continue;
 | 
				
			||||||
 | 
									if (c.wire == wire)
 | 
				
			||||||
 | 
										continue;
 | 
				
			||||||
 | 
									outputs.insert(c.wire);
 | 
				
			||||||
 | 
									log_dump(c.wire->name);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (opt_name.empty())
 | 
							if (opt_name.empty())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			for (auto &it : module->wires_)
 | 
								for (auto &it : module->wires_)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										25
									
								
								tests/various/submod.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								tests/various/submod.ys
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,25 @@
 | 
				
			||||||
 | 
					read_verilog <<EOT
 | 
				
			||||||
 | 
					module top(input a, output [1:0] b);
 | 
				
			||||||
 | 
					wire c;
 | 
				
			||||||
 | 
					(* submod="bar" *) sub s1(a, c);
 | 
				
			||||||
 | 
					assign b[0] = c;
 | 
				
			||||||
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module sub(input a, output c);
 | 
				
			||||||
 | 
					assign c = a;
 | 
				
			||||||
 | 
					endmodule
 | 
				
			||||||
 | 
					EOT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					hierarchy -top top
 | 
				
			||||||
 | 
					proc
 | 
				
			||||||
 | 
					design -save gold
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					submod
 | 
				
			||||||
 | 
					flatten
 | 
				
			||||||
 | 
					design -stash gate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					design -import gold -as gold
 | 
				
			||||||
 | 
					design -import gate -as gate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					miter -equiv -flatten -make_assert -make_outputs gold gate miter
 | 
				
			||||||
 | 
					sat -verify -prove-asserts -show-ports miter
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue