mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	cxxrtl: fix vcd writer scope handling
The vcd writer incorrectly treated two scope vectors as the same, whenever they have the same length of entries and the last item matches. This is however not always true, for example consider a current_scope of ["top", "something0", "same"] and a scope of ["top", "something1", "same"]
This commit is contained in:
		
							parent
							
								
									a8f4bc2904
								
							
						
					
					
						commit
						0f762f75a6
					
				
					 1 changed files with 7 additions and 3 deletions
				
			
		|  | @ -50,9 +50,13 @@ class vcd_writer { | |||
| 
 | ||||
| 	void emit_scope(const std::vector<std::string> &scope) { | ||||
| 		assert(!streaming); | ||||
| 		while (current_scope.size() > scope.size() || | ||||
| 		       (current_scope.size() > 0 && | ||||
| 			current_scope[current_scope.size() - 1] != scope[current_scope.size() - 1])) { | ||||
| 		size_t same_scope_count = 0; | ||||
| 		while ((same_scope_count < current_scope.size()) && | ||||
| 			   (same_scope_count < scope.size()) && | ||||
| 			   (current_scope[same_scope_count] == scope[same_scope_count])) { | ||||
| 			same_scope_count++; | ||||
| 		} | ||||
| 		while (current_scope.size() > same_scope_count) { | ||||
| 			buffer += "$upscope $end\n"; | ||||
| 			current_scope.pop_back(); | ||||
| 		} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue