mirror of
				https://github.com/YosysHQ/sby.git
				synced 2025-10-31 13:02:28 +00:00 
			
		
		
		
	Merge pull request #140 from nakengelhardt/junit_jny
junit: use write_jny instead of write_json
This commit is contained in:
		
						commit
						1e1aea0b1e
					
				
					 2 changed files with 24 additions and 16 deletions
				
			
		|  | @ -395,7 +395,7 @@ class SbyTask: | ||||||
|                     print(cmd, file=f) |                     print(cmd, file=f) | ||||||
|                 # the user must designate a top module in [script] |                 # the user must designate a top module in [script] | ||||||
|                 print("hierarchy -simcheck", file=f) |                 print("hierarchy -simcheck", file=f) | ||||||
|                 print(f"""write_json ../model/design.json""", file=f) |                 print(f"""write_jny -no-connections ../model/design.json""", file=f) | ||||||
|                 print(f"""write_rtlil ../model/design.il""", file=f) |                 print(f"""write_rtlil ../model/design.il""", file=f) | ||||||
| 
 | 
 | ||||||
|             proc = SbyProc( |             proc = SbyProc( | ||||||
|  |  | ||||||
|  | @ -103,26 +103,34 @@ def design_hierarchy(filename): | ||||||
|     design_json = json.load(filename) |     design_json = json.load(filename) | ||||||
|     def make_mod_hier(instance_name, module_name, hierarchy=""): |     def make_mod_hier(instance_name, module_name, hierarchy=""): | ||||||
|         # print(instance_name,":", module_name) |         # print(instance_name,":", module_name) | ||||||
|  |         sub_hierarchy=f"{hierarchy}/{instance_name}" if hierarchy else instance_name | ||||||
|         mod = SbyModule(name=instance_name, type=module_name) |         mod = SbyModule(name=instance_name, type=module_name) | ||||||
| 
 | 
 | ||||||
|         cells = design_json["modules"][module_name]["cells"] |         for m in design_json["modules"]: | ||||||
|         for cell_name, cell in cells.items(): |             if m["name"] == module_name: | ||||||
|             sub_hierarchy=f"{hierarchy}/{instance_name}" if hierarchy else instance_name |                 cell_sorts = m["cell_sorts"] | ||||||
|             if cell["type"][0] != '$' or cell["type"].startswith("$paramod"): |                 break | ||||||
|                 mod.submodules[cell_name] = make_mod_hier(cell_name, cell["type"], hierarchy=sub_hierarchy) |         else: | ||||||
|             if cell["type"] in ["$assume", "$assert", "$cover", "$live"]: |             raise ValueError(f"Cannot find module {module_name}") | ||||||
|  | 
 | ||||||
|  |         for sort in cell_sorts: | ||||||
|  |             if sort["type"] in ["$assume", "$assert", "$cover", "$live"]: | ||||||
|  |                 for cell in sort["cells"]: | ||||||
|                     try: |                     try: | ||||||
|                         location = cell["attributes"]["src"] |                         location = cell["attributes"]["src"] | ||||||
|                     except KeyError: |                     except KeyError: | ||||||
|                         location = "" |                         location = "" | ||||||
|                 p = SbyProperty(name=cell_name, type=SbyProperty.Type.from_cell(cell["type"]), location=location, hierarchy=sub_hierarchy) |                     p = SbyProperty(name=cell["name"], type=SbyProperty.Type.from_cell(sort["type"]), location=location, hierarchy=sub_hierarchy) | ||||||
|                     mod.properties.append(p) |                     mod.properties.append(p) | ||||||
|  |             if sort["type"][0] != '$' or sort["type"].startswith("$paramod"): | ||||||
|  |                 for cell in sort["cells"]: | ||||||
|  |                     mod.submodules[cell["name"]] = make_mod_hier(cell["name"], sort["type"], hierarchy=sub_hierarchy) | ||||||
|         return mod |         return mod | ||||||
| 
 | 
 | ||||||
|     for module_name in design_json["modules"]: |     for m in design_json["modules"]: | ||||||
|         attrs = design_json["modules"][module_name]["attributes"] |         attrs = m["attributes"] | ||||||
|         if "top" in attrs and int(attrs["top"]) == 1: |         if "top" in attrs and int(attrs["top"]) == 1: | ||||||
|             hierarchy = make_mod_hier(module_name, module_name) |             hierarchy = make_mod_hier(m["name"], m["name"]) | ||||||
|             return hierarchy |             return hierarchy | ||||||
|     else: |     else: | ||||||
|         raise ValueError("Cannot find top module") |         raise ValueError("Cannot find top module") | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue