mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Added "test_cell -w" feature
This commit is contained in:
		
							parent
							
								
									170788a3de
								
							
						
					
					
						commit
						7dece74fae
					
				
					 1 changed files with 39 additions and 18 deletions
				
			
		| 
						 | 
					@ -508,7 +508,7 @@ struct TestCellPass : public Pass {
 | 
				
			||||||
		log("by comparing SAT solver, EVAL and TECHMAP implementations of the cell types..\n");
 | 
							log("by comparing SAT solver, EVAL and TECHMAP implementations of the cell types..\n");
 | 
				
			||||||
		log("\n");
 | 
							log("\n");
 | 
				
			||||||
		log("Run with 'all' instead of a cell type to run the test on all supported\n");
 | 
							log("Run with 'all' instead of a cell type to run the test on all supported\n");
 | 
				
			||||||
		log("cell types.\n");
 | 
							log("cell types. Use for example 'all /$add' for all cell types except $add.\n");
 | 
				
			||||||
		log("\n");
 | 
							log("\n");
 | 
				
			||||||
		log("    -n {integer}\n");
 | 
							log("    -n {integer}\n");
 | 
				
			||||||
		log("        create this number of cell instances and test them (default = 100).\n");
 | 
							log("        create this number of cell instances and test them (default = 100).\n");
 | 
				
			||||||
| 
						 | 
					@ -519,6 +519,10 @@ struct TestCellPass : public Pass {
 | 
				
			||||||
		log("    -f {ilang_file}\n");
 | 
							log("    -f {ilang_file}\n");
 | 
				
			||||||
		log("        don't generate circuits. instead load the specified ilang file.\n");
 | 
							log("        don't generate circuits. instead load the specified ilang file.\n");
 | 
				
			||||||
		log("\n");
 | 
							log("\n");
 | 
				
			||||||
 | 
							log("    -w {filename_prefix}\n");
 | 
				
			||||||
 | 
							log("        don't test anything. just generate the circuits and write them\n");
 | 
				
			||||||
 | 
							log("        to ilang files with the specified prefix\n");
 | 
				
			||||||
 | 
							log("\n");
 | 
				
			||||||
		log("    -map {filename}\n");
 | 
							log("    -map {filename}\n");
 | 
				
			||||||
		log("        pass this option to techmap.\n");
 | 
							log("        pass this option to techmap.\n");
 | 
				
			||||||
		log("\n");
 | 
							log("\n");
 | 
				
			||||||
| 
						 | 
					@ -545,7 +549,7 @@ struct TestCellPass : public Pass {
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		int num_iter = 100;
 | 
							int num_iter = 100;
 | 
				
			||||||
		std::string techmap_cmd = "techmap -assert";
 | 
							std::string techmap_cmd = "techmap -assert";
 | 
				
			||||||
		std::string ilang_file;
 | 
							std::string ilang_file, write_prefix;
 | 
				
			||||||
		xorshift32_state = 0;
 | 
							xorshift32_state = 0;
 | 
				
			||||||
		std::ofstream vlog_file;
 | 
							std::ofstream vlog_file;
 | 
				
			||||||
		bool verbose = false;
 | 
							bool verbose = false;
 | 
				
			||||||
| 
						 | 
					@ -572,6 +576,10 @@ struct TestCellPass : public Pass {
 | 
				
			||||||
				num_iter = 1;
 | 
									num_iter = 1;
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								if (args[argidx] == "-w" && argidx+1 < GetSize(args)) {
 | 
				
			||||||
 | 
									write_prefix = args[++argidx];
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			if (args[argidx] == "-script" && argidx+1 < GetSize(args)) {
 | 
								if (args[argidx] == "-script" && argidx+1 < GetSize(args)) {
 | 
				
			||||||
				techmap_cmd = "script " + args[++argidx];
 | 
									techmap_cmd = "script " + args[++argidx];
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
| 
						 | 
					@ -675,6 +683,15 @@ struct TestCellPass : public Pass {
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (args[argidx].substr(0, 1) == "/") {
 | 
				
			||||||
 | 
									std::vector<std::string> new_selected_cell_types;
 | 
				
			||||||
 | 
									for (auto it : selected_cell_types)
 | 
				
			||||||
 | 
										if (it != args[argidx].substr(1))
 | 
				
			||||||
 | 
											new_selected_cell_types.push_back(it);
 | 
				
			||||||
 | 
									new_selected_cell_types.swap(selected_cell_types);
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (cell_types.count(args[argidx]) == 0) {
 | 
								if (cell_types.count(args[argidx]) == 0) {
 | 
				
			||||||
				std::string cell_type_list;
 | 
									std::string cell_type_list;
 | 
				
			||||||
				int charcount = 100;
 | 
									int charcount = 100;
 | 
				
			||||||
| 
						 | 
					@ -713,6 +730,9 @@ struct TestCellPass : public Pass {
 | 
				
			||||||
					Frontend::frontend_call(design, NULL, std::string(), "ilang " + ilang_file);
 | 
										Frontend::frontend_call(design, NULL, std::string(), "ilang " + ilang_file);
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					create_gold_module(design, cell_type, cell_types.at(cell_type), constmode);
 | 
										create_gold_module(design, cell_type, cell_types.at(cell_type), constmode);
 | 
				
			||||||
 | 
									if (!write_prefix.empty()) {
 | 
				
			||||||
 | 
										Pass::call(design, stringf("write_ilang %s_%s_%05d.il", write_prefix.c_str(), cell_type.c_str()+1, i));
 | 
				
			||||||
 | 
									} else {
 | 
				
			||||||
					Pass::call(design, stringf("copy gold gate; cd gate; %s; cd ..; opt -fast gate", techmap_cmd.c_str()));
 | 
										Pass::call(design, stringf("copy gold gate; cd gate; %s; cd ..; opt -fast gate", techmap_cmd.c_str()));
 | 
				
			||||||
					if (!nosat)
 | 
										if (!nosat)
 | 
				
			||||||
						Pass::call(design, "miter -equiv -flatten -make_outputs -ignore_gold_x gold gate miter");
 | 
											Pass::call(design, "miter -equiv -flatten -make_outputs -ignore_gold_x gold gate miter");
 | 
				
			||||||
| 
						 | 
					@ -730,6 +750,7 @@ struct TestCellPass : public Pass {
 | 
				
			||||||
						uut_names.push_back(uut_name);
 | 
											uut_names.push_back(uut_name);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					run_eval_test(design, verbose, nosat, uut_name, vlog_file);
 | 
										run_eval_test(design, verbose, nosat, uut_name, vlog_file);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
				delete design;
 | 
									delete design;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue