mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Add "write_verilog -siminit"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									e2fc18f27b
								
							
						
					
					
						commit
						241901461a
					
				
					 2 changed files with 12 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -33,7 +33,7 @@
 | 
			
		|||
USING_YOSYS_NAMESPACE
 | 
			
		||||
PRIVATE_NAMESPACE_BEGIN
 | 
			
		||||
 | 
			
		||||
bool verbose, norename, noattr, attr2comment, noexpr, nodec, nohex, nostr, defparam, decimal;
 | 
			
		||||
bool verbose, norename, noattr, attr2comment, noexpr, nodec, nohex, nostr, defparam, decimal, siminit;
 | 
			
		||||
int auto_name_counter, auto_name_offset, auto_name_digits;
 | 
			
		||||
std::map<RTLIL::IdString, int> auto_name_map;
 | 
			
		||||
std::set<RTLIL::IdString> reg_wires, reg_ct;
 | 
			
		||||
| 
						 | 
				
			
			@ -1310,7 +1310,7 @@ void dump_cell(std::ostream &f, std::string indent, RTLIL::Cell *cell)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (reg_ct.count(cell->type) && cell->hasPort("\\Q")) {
 | 
			
		||||
	if (siminit && reg_ct.count(cell->type) && cell->hasPort("\\Q")) {
 | 
			
		||||
		std::stringstream ss;
 | 
			
		||||
		dump_reg_init(ss, cell->getPort("\\Q"));
 | 
			
		||||
		if (!ss.str().empty()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -1607,6 +1607,10 @@ struct VerilogBackend : public Backend {
 | 
			
		|||
		log("        without this option all internal cells are converted to Verilog\n");
 | 
			
		||||
		log("        expressions.\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("    -siminit\n");
 | 
			
		||||
		log("        add initial statements with hierarchical refs to initialize FFs when\n");
 | 
			
		||||
		log("        in -noexpr mode.\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("    -nodec\n");
 | 
			
		||||
		log("        32-bit constant values are by default dumped as decimal numbers,\n");
 | 
			
		||||
		log("        not bit pattern. This option deactivates this feature and instead\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -1663,6 +1667,7 @@ struct VerilogBackend : public Backend {
 | 
			
		|||
		nostr = false;
 | 
			
		||||
		defparam = false;
 | 
			
		||||
		decimal = false;
 | 
			
		||||
		siminit = false;
 | 
			
		||||
		auto_prefix = "";
 | 
			
		||||
 | 
			
		||||
		bool blackboxes = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -1739,6 +1744,10 @@ struct VerilogBackend : public Backend {
 | 
			
		|||
				decimal = true;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if (arg == "-siminit") {
 | 
			
		||||
				siminit = true;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if (arg == "-blackboxes") {
 | 
			
		||||
				blackboxes = true;
 | 
			
		||||
				continue;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,7 @@ verbose=false
 | 
			
		|||
keeprunning=false
 | 
			
		||||
makejmode=false
 | 
			
		||||
frontend="verilog"
 | 
			
		||||
backend_opts="-noattr -noexpr"
 | 
			
		||||
backend_opts="-noattr -noexpr -siminit"
 | 
			
		||||
autotb_opts=""
 | 
			
		||||
include_opts=""
 | 
			
		||||
xinclude_opts=""
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue