mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-30 19:22:31 +00:00 
			
		
		
		
	Bugfix in name resolution with generate blocks
This commit is contained in:
		
							parent
							
								
									672229eda5
								
							
						
					
					
						commit
						4df7e03ec9
					
				
					 2 changed files with 25 additions and 1 deletions
				
			
		|  | @ -1478,7 +1478,7 @@ void AstNode::expand_genblock(std::string index_var, std::string prefix, std::ma | ||||||
| 
 | 
 | ||||||
| 	for (size_t i = 0; i < children.size(); i++) { | 	for (size_t i = 0; i < children.size(); i++) { | ||||||
| 		AstNode *child = children[i]; | 		AstNode *child = children[i]; | ||||||
| 		if (child->type != AST_FUNCTION && child->type != AST_TASK) | 		if (child->type != AST_FUNCTION && child->type != AST_TASK && child->type != AST_PREFIX) | ||||||
| 			child->expand_genblock(index_var, prefix, name_map); | 			child->expand_genblock(index_var, prefix, name_map); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										24
									
								
								tests/simple/carryadd.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								tests/simple/carryadd.v
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | ||||||
|  | module carryadd(a, b, y); | ||||||
|  | 
 | ||||||
|  | parameter WIDTH = 8; | ||||||
|  | 
 | ||||||
|  | input [WIDTH-1:0] a, b; | ||||||
|  | output [WIDTH-1:0] y; | ||||||
|  | 
 | ||||||
|  | genvar i; | ||||||
|  | generate | ||||||
|  | 	for (i = 0; i < WIDTH; i = i+1) begin:STAGE | ||||||
|  | 		wire IN1 = a[i], IN2 = b[i]; | ||||||
|  | 		wire C, Y; | ||||||
|  | 		if (i == 0) | ||||||
|  | 			assign C = IN1 & IN2, Y = IN1 ^ IN2; | ||||||
|  | 		else | ||||||
|  | 			assign C = (IN1 & IN2) | ((IN1 | IN2) & STAGE[i-1].C), | ||||||
|  | 			       Y = IN1 ^ IN2 ^ STAGE[i-1].C; | ||||||
|  | 		assign y[i] = Y; | ||||||
|  | 	end | ||||||
|  | endgenerate | ||||||
|  | 
 | ||||||
|  | // assert property (y == a + b); | ||||||
|  | 
 | ||||||
|  | endmodule | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue