mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Use Verific hier_tree component for elaboration
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									8b604004da
								
							
						
					
					
						commit
						a15208f301
					
				
					 2 changed files with 55 additions and 1 deletions
				
			
		
							
								
								
									
										2
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
										
									
									
									
								
							| 
						 | 
					@ -279,7 +279,7 @@ endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(ENABLE_VERIFIC),1)
 | 
					ifeq ($(ENABLE_VERIFIC),1)
 | 
				
			||||||
VERIFIC_DIR ?= /usr/local/src/verific_lib_eval
 | 
					VERIFIC_DIR ?= /usr/local/src/verific_lib_eval
 | 
				
			||||||
VERIFIC_COMPONENTS ?= verilog vhdl database util containers sdf
 | 
					VERIFIC_COMPONENTS ?= verilog vhdl database util containers sdf hier_tree
 | 
				
			||||||
CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
 | 
					CXXFLAGS += $(patsubst %,-I$(VERIFIC_DIR)/%,$(VERIFIC_COMPONENTS)) -DYOSYS_ENABLE_VERIFIC
 | 
				
			||||||
LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS)) -lz
 | 
					LDLIBS += $(patsubst %,$(VERIFIC_DIR)/%/*-linux.a,$(VERIFIC_COMPONENTS)) -lz
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,6 +42,7 @@ USING_YOSYS_NAMESPACE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "veri_file.h"
 | 
					#include "veri_file.h"
 | 
				
			||||||
#include "vhdl_file.h"
 | 
					#include "vhdl_file.h"
 | 
				
			||||||
 | 
					#include "hier_tree.h"
 | 
				
			||||||
#include "VeriModule.h"
 | 
					#include "VeriModule.h"
 | 
				
			||||||
#include "VeriWrite.h"
 | 
					#include "VeriWrite.h"
 | 
				
			||||||
#include "VhdlUnits.h"
 | 
					#include "VhdlUnits.h"
 | 
				
			||||||
| 
						 | 
					@ -1789,6 +1790,7 @@ struct VerificPass : public Pass {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (mode_all)
 | 
								if (mode_all)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
				log("Running veri_file::ElaborateAll().\n");
 | 
									log("Running veri_file::ElaborateAll().\n");
 | 
				
			||||||
				if (!veri_file::ElaborateAll())
 | 
									if (!veri_file::ElaborateAll())
 | 
				
			||||||
					log_cmd_error("Elaboration of Verilog modules failed.\n");
 | 
										log_cmd_error("Elaboration of Verilog modules failed.\n");
 | 
				
			||||||
| 
						 | 
					@ -1823,12 +1825,31 @@ struct VerificPass : public Pass {
 | 
				
			||||||
						cell->GetFirstNetlist()->SetPresentDesign();
 | 
											cell->GetFirstNetlist()->SetPresentDesign();
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
									log("Running hier_tree::ElaborateAll().\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									VhdlLibrary *vhdl_lib = vhdl_file::GetLibrary("work", 1);
 | 
				
			||||||
 | 
									VeriLibrary *veri_lib = veri_file::GetLibrary("work", 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									Array veri_libs, vhdl_libs;
 | 
				
			||||||
 | 
									if (vhdl_lib) vhdl_libs.InsertLast(vhdl_lib);
 | 
				
			||||||
 | 
									if (veri_lib) veri_libs.InsertLast(veri_lib);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									Array *netlists = hier_tree::ElaborateAll(&veri_libs, &vhdl_libs);
 | 
				
			||||||
 | 
									Netlist *nl;
 | 
				
			||||||
 | 
									int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									FOREACH_ARRAY_ITEM(netlists, i, nl)
 | 
				
			||||||
 | 
										nl_todo.insert(nl);
 | 
				
			||||||
 | 
									delete netlists;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (argidx == GetSize(args))
 | 
									if (argidx == GetSize(args))
 | 
				
			||||||
					log_cmd_error("No top module specified.\n");
 | 
										log_cmd_error("No top module specified.\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
				for (; argidx < GetSize(args); argidx++) {
 | 
									for (; argidx < GetSize(args); argidx++) {
 | 
				
			||||||
					if (veri_file::GetModule(args[argidx].c_str())) {
 | 
										if (veri_file::GetModule(args[argidx].c_str())) {
 | 
				
			||||||
						log("Running veri_file::Elaborate(\"%s\").\n", args[argidx].c_str());
 | 
											log("Running veri_file::Elaborate(\"%s\").\n", args[argidx].c_str());
 | 
				
			||||||
| 
						 | 
					@ -1842,6 +1863,39 @@ struct VerificPass : public Pass {
 | 
				
			||||||
						nl_todo.insert(Netlist::PresentDesign());
 | 
											nl_todo.insert(Netlist::PresentDesign());
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
									Array veri_modules, vhdl_units;
 | 
				
			||||||
 | 
									for (; argidx < GetSize(args); argidx++)
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										const char *name = args[argidx].c_str();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										VeriModule *veri_module = veri_file::GetModule(name);
 | 
				
			||||||
 | 
										if (veri_module) {
 | 
				
			||||||
 | 
											log("Adding Verilog module '%s' to elaboration queue.\n", name);
 | 
				
			||||||
 | 
											veri_modules.InsertLast(veri_module);
 | 
				
			||||||
 | 
											continue;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										VhdlLibrary *vhdl_lib = vhdl_file::GetLibrary("work", 1);
 | 
				
			||||||
 | 
										VhdlDesignUnit *vhdl_unit = vhdl_lib->GetPrimUnit(name);
 | 
				
			||||||
 | 
										if (vhdl_unit) {
 | 
				
			||||||
 | 
											log("Adding VHDL unit '%s' to elaboration queue.\n", name);
 | 
				
			||||||
 | 
											vhdl_units.InsertLast(vhdl_unit);
 | 
				
			||||||
 | 
											continue;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
										log_error("Can't find module/unit '%s'.\n", name);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									log("Running hier_tree::Elaborate().\n");
 | 
				
			||||||
 | 
									Array *netlists = hier_tree::Elaborate(&veri_modules, &vhdl_units);
 | 
				
			||||||
 | 
									Netlist *nl;
 | 
				
			||||||
 | 
									int i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
									FOREACH_ARRAY_ITEM(netlists, i, nl)
 | 
				
			||||||
 | 
										nl_todo.insert(nl);
 | 
				
			||||||
 | 
									delete netlists;
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (flatten) {
 | 
								if (flatten) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue