mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-30 19:22:31 +00:00 
			
		
		
		
	sv: check validity of package end label
This commit is contained in:
		
							parent
							
								
									32a0ce9d68
								
							
						
					
					
						commit
						4452080861
					
				
					 2 changed files with 17 additions and 0 deletions
				
			
		|  | @ -579,6 +579,8 @@ package: | |||
| 		append_attr(mod, $1); | ||||
| 	} ';' package_body TOK_ENDPACKAGE opt_label { | ||||
| 		ast_stack.pop_back(); | ||||
| 		if ($4 != NULL && $9 != NULL && *$4 != *$9) | ||||
| 			frontend_verilog_yyerror("Package name (%s) and end label (%s) don't match.", $4->c_str()+1, $9->c_str()+1); | ||||
| 		current_ast_mod = NULL; | ||||
| 		exitTypeScope(); | ||||
| 	}; | ||||
|  |  | |||
							
								
								
									
										15
									
								
								tests/verilog/package_end_label.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								tests/verilog/package_end_label.ys
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,15 @@ | |||
| logger -expect-no-warnings | ||||
| read_verilog -sv <<EOF | ||||
| package correct_name; | ||||
| localparam X = 1; | ||||
| endpackage : correct_name | ||||
| EOF | ||||
| 
 | ||||
| design -reset | ||||
| 
 | ||||
| logger -expect error "Package name \(correct_name\) and end label \(incorrect_name\) don't match\." 1 | ||||
| read_verilog -sv <<EOF | ||||
| package correct_name; | ||||
| localparam X = 1; | ||||
| endpackage : incorrect_name | ||||
| EOF | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue