mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	This is accomplished by generating a unique name for the genvar, renaming references to the genvar only in the loop's initialization, guard, and incrementation, and finally adding a localparam inside the loop body with the original name so that the genvar can be shadowed as expected.
		
			
				
	
	
		
			7 lines
		
	
	
	
		
			215 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			7 lines
		
	
	
	
		
			215 B
		
	
	
	
		
			Text
		
	
	
	
	
	
| logger -expect error "Generate for loop inline variable declaration is only supported in SystemVerilog mode!" 1
 | |
| read_verilog <<EOT
 | |
| module top;
 | |
|     for (genvar i = 1; i < 10; i = i + 1)
 | |
|         wire x;
 | |
| endmodule
 | |
| EOT
 |