mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Added "yosys -D" feature
This commit is contained in:
		
							parent
							
								
									1565d1af69
								
							
						
					
					
						commit
						0bc95f1e04
					
				
					 113 changed files with 172 additions and 145 deletions
				
			
		| 
						 | 
				
			
			@ -616,7 +616,7 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
 | 
			
		|||
	if (!cleanup)
 | 
			
		||||
		tempdir_name[0] = tempdir_name[4] = '_';
 | 
			
		||||
	tempdir_name = make_temp_dir(tempdir_name);
 | 
			
		||||
	log_header("Extracting gate netlist of module `%s' to `%s/input.blif'..\n",
 | 
			
		||||
	log_header(design, "Extracting gate netlist of module `%s' to `%s/input.blif'..\n",
 | 
			
		||||
			module->name.c_str(), replace_tempdir(tempdir_name, tempdir_name, show_tempdir).c_str());
 | 
			
		||||
 | 
			
		||||
	std::string abc_script = stringf("read_blif %s/input.blif; ", tempdir_name.c_str());
 | 
			
		||||
| 
						 | 
				
			
			@ -834,7 +834,7 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
 | 
			
		|||
 | 
			
		||||
	if (count_output > 0)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing ABC.\n");
 | 
			
		||||
		log_header(design, "Executing ABC.\n");
 | 
			
		||||
 | 
			
		||||
		buffer = stringf("%s/stdcells.genlib", tempdir_name.c_str());
 | 
			
		||||
		f = fopen(buffer.c_str(), "wt");
 | 
			
		||||
| 
						 | 
				
			
			@ -904,7 +904,7 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin
 | 
			
		|||
 | 
			
		||||
		ifs.close();
 | 
			
		||||
 | 
			
		||||
		log_header("Re-integrating ABC results.\n");
 | 
			
		||||
		log_header(design, "Re-integrating ABC results.\n");
 | 
			
		||||
		RTLIL::Module *mapped_mod = mapped_design->modules_["\\netlist"];
 | 
			
		||||
		if (mapped_mod == NULL)
 | 
			
		||||
			log_error("ABC output file does not contain a module `netlist'.\n");
 | 
			
		||||
| 
						 | 
				
			
			@ -1299,7 +1299,7 @@ struct AbcPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing ABC pass (technology mapping using ABC).\n");
 | 
			
		||||
		log_header(design, "Executing ABC pass (technology mapping using ABC).\n");
 | 
			
		||||
		log_push();
 | 
			
		||||
 | 
			
		||||
#ifdef ABCEXTERNAL
 | 
			
		||||
| 
						 | 
				
			
			@ -1599,7 +1599,7 @@ struct AbcPass : public Pass {
 | 
			
		|||
					assigned_cells_reverse[cell] = key;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				log_header("Summary of detected clock domains:\n");
 | 
			
		||||
				log_header(design, "Summary of detected clock domains:\n");
 | 
			
		||||
				for (auto &it : assigned_cells)
 | 
			
		||||
					log("  %d cells in clk=%s%s, en=%s%s\n", GetSize(it.second),
 | 
			
		||||
							std::get<0>(it.first) ? "" : "!", log_signal(std::get<1>(it.first)),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ struct AigmapPass : public Pass {
 | 
			
		|||
	{
 | 
			
		||||
		bool nand_mode = false;
 | 
			
		||||
 | 
			
		||||
		log_header("Executing AIGMAP pass (map logic to AIG).\n");
 | 
			
		||||
		log_header(design, "Executing AIGMAP pass (map logic to AIG).\n");
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -544,7 +544,7 @@ struct AlumaccPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing ALUMACC pass (create $alu and $macc cells).\n");
 | 
			
		||||
		log_header(design, "Executing ALUMACC pass (create $alu and $macc cells).\n");
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -285,7 +285,7 @@ struct Dff2dffePass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing DFF2DFFE pass (transform $dff to $dffe where applicable).\n");
 | 
			
		||||
		log_header(design, "Executing DFF2DFFE pass (transform $dff to $dffe where applicable).\n");
 | 
			
		||||
 | 
			
		||||
		bool unmap_mode = false;
 | 
			
		||||
		dict<IdString, IdString> direct_dict;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -41,7 +41,7 @@ struct DffinitPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing DFFINIT pass (set INIT param on FF cells).\n");
 | 
			
		||||
		log_header(design, "Executing DFFINIT pass (set INIT param on FF cells).\n");
 | 
			
		||||
 | 
			
		||||
		dict<IdString, dict<IdString, IdString>> ff_types;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -547,7 +547,7 @@ struct DfflibmapPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing DFFLIBMAP pass (mapping DFF cells to sequential cells from liberty file).\n");
 | 
			
		||||
		log_header(design, "Executing DFFLIBMAP pass (mapping DFF cells to sequential cells from liberty file).\n");
 | 
			
		||||
 | 
			
		||||
		std::string liberty_file;
 | 
			
		||||
		bool prepare_mode = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -188,7 +188,7 @@ struct Dffsr2dffPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing DFFSR2DFF pass (mapping DFFSR cells to simpler FFs).\n");
 | 
			
		||||
		log_header(design, "Executing DFFSR2DFF pass (mapping DFFSR cells to simpler FFs).\n");
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -442,7 +442,7 @@ struct ExtractPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing EXTRACT pass (map subcircuits to cells).\n");
 | 
			
		||||
		log_header(design, "Executing EXTRACT pass (map subcircuits to cells).\n");
 | 
			
		||||
		log_push();
 | 
			
		||||
 | 
			
		||||
		SubCircuitSolver solver;
 | 
			
		||||
| 
						 | 
				
			
			@ -627,7 +627,7 @@ struct ExtractPass : public Pass {
 | 
			
		|||
		std::map<std::string, RTLIL::Module*> needle_map, haystack_map;
 | 
			
		||||
		std::vector<RTLIL::Module*> needle_list;
 | 
			
		||||
 | 
			
		||||
		log_header("Creating graphs for SubCircuit library.\n");
 | 
			
		||||
		log_header(design, "Creating graphs for SubCircuit library.\n");
 | 
			
		||||
 | 
			
		||||
		if (!mine_mode)
 | 
			
		||||
			for (auto &mod_it : map->modules_) {
 | 
			
		||||
| 
						 | 
				
			
			@ -654,7 +654,7 @@ struct ExtractPass : public Pass {
 | 
			
		|||
		if (!mine_mode)
 | 
			
		||||
		{
 | 
			
		||||
			std::vector<SubCircuit::Solver::Result> results;
 | 
			
		||||
			log_header("Running solver from SubCircuit library.\n");
 | 
			
		||||
			log_header(design, "Running solver from SubCircuit library.\n");
 | 
			
		||||
 | 
			
		||||
			std::sort(needle_list.begin(), needle_list.end(), compareSortNeedleList);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -667,7 +667,7 @@ struct ExtractPass : public Pass {
 | 
			
		|||
 | 
			
		||||
			if (results.size() > 0)
 | 
			
		||||
			{
 | 
			
		||||
				log_header("Substitute SubCircuits with cells.\n");
 | 
			
		||||
				log_header(design, "Substitute SubCircuits with cells.\n");
 | 
			
		||||
 | 
			
		||||
				for (int i = 0; i < int(results.size()); i++) {
 | 
			
		||||
					auto &result = results[i];
 | 
			
		||||
| 
						 | 
				
			
			@ -688,7 +688,7 @@ struct ExtractPass : public Pass {
 | 
			
		|||
		{
 | 
			
		||||
			std::vector<SubCircuit::Solver::MineResult> results;
 | 
			
		||||
 | 
			
		||||
			log_header("Running miner from SubCircuit library.\n");
 | 
			
		||||
			log_header(design, "Running miner from SubCircuit library.\n");
 | 
			
		||||
			solver.mine(results, mine_cells_min, mine_cells_max, mine_min_freq, mine_limit_mod);
 | 
			
		||||
 | 
			
		||||
			map = new RTLIL::Design;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -76,7 +76,7 @@ struct HilomapPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing HILOMAP pass (mapping to constant drivers).\n");
 | 
			
		||||
		log_header(design, "Executing HILOMAP pass (mapping to constant drivers).\n");
 | 
			
		||||
 | 
			
		||||
		hicell_celltype = std::string();
 | 
			
		||||
		hicell_portname = std::string();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -68,7 +68,7 @@ struct IopadmapPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing IOPADMAP pass (mapping inputs/outputs to IO-PAD cells).\n");
 | 
			
		||||
		log_header(design, "Executing IOPADMAP pass (mapping inputs/outputs to IO-PAD cells).\n");
 | 
			
		||||
 | 
			
		||||
		std::string inpad_celltype, inpad_portname, inpad_portname2;
 | 
			
		||||
		std::string outpad_celltype, outpad_portname, outpad_portname2;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -67,7 +67,7 @@ struct Lut2muxPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing LUT2MUX pass (convert $lut to $_MUX_).\n");
 | 
			
		||||
		log_header(design, "Executing LUT2MUX pass (convert $lut to $_MUX_).\n");
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -379,7 +379,7 @@ struct MaccmapPass : public Pass {
 | 
			
		|||
	{
 | 
			
		||||
		bool unmap_mode = false;
 | 
			
		||||
 | 
			
		||||
		log_header("Executing MACCMAP pass (map $macc cells).\n");
 | 
			
		||||
		log_header(design, "Executing MACCMAP pass (map $macc cells).\n");
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -581,7 +581,7 @@ struct MuxcoverPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing MUXCOVER pass (mapping to wider MUXes).\n");
 | 
			
		||||
		log_header(design, "Executing MUXCOVER pass (mapping to wider MUXes).\n");
 | 
			
		||||
 | 
			
		||||
		bool use_mux4 = false;
 | 
			
		||||
		bool use_mux8 = false;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -143,7 +143,7 @@ struct NlutmapPass : public Pass {
 | 
			
		|||
	{
 | 
			
		||||
		NlutmapConfig config;
 | 
			
		||||
 | 
			
		||||
		log_header("Executing NLUTMAP pass (mapping to constant drivers).\n");
 | 
			
		||||
		log_header(design, "Executing NLUTMAP pass (mapping to constant drivers).\n");
 | 
			
		||||
		log_push();
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -78,7 +78,7 @@ struct PmuxtreePass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing PMUXTREE pass.\n");
 | 
			
		||||
		log_header(design, "Executing PMUXTREE pass.\n");
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -360,7 +360,7 @@ struct ShregmapPass : public Pass {
 | 
			
		|||
		ShregmapOptions opts;
 | 
			
		||||
		string clkpol, enpol;
 | 
			
		||||
 | 
			
		||||
		log_header("Executing SHREGMAP pass (map shift registers).\n");
 | 
			
		||||
		log_header(design, "Executing SHREGMAP pass (map shift registers).\n");
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -543,7 +543,7 @@ struct SimplemapPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing SIMPLEMAP pass (map simple cells to gate primitives).\n");
 | 
			
		||||
		log_header(design, "Executing SIMPLEMAP pass (map simple cells to gate primitives).\n");
 | 
			
		||||
		extra_args(args, 1, design);
 | 
			
		||||
 | 
			
		||||
		std::map<RTLIL::IdString, void(*)(RTLIL::Module*, RTLIL::Cell*)> mappers;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -779,7 +779,7 @@ struct TechmapWorker
 | 
			
		|||
 | 
			
		||||
					if (recursive_mode) {
 | 
			
		||||
						if (log_continue) {
 | 
			
		||||
							log_header("Continuing TECHMAP pass.\n");
 | 
			
		||||
							log_header(design, "Continuing TECHMAP pass.\n");
 | 
			
		||||
							log_continue = false;
 | 
			
		||||
						}
 | 
			
		||||
						while (techmap_module(map, tpl, map, handled_cells, celltypeMap, true)) { }
 | 
			
		||||
| 
						 | 
				
			
			@ -790,7 +790,7 @@ struct TechmapWorker
 | 
			
		|||
					continue;
 | 
			
		||||
 | 
			
		||||
				if (log_continue) {
 | 
			
		||||
					log_header("Continuing TECHMAP pass.\n");
 | 
			
		||||
					log_header(design, "Continuing TECHMAP pass.\n");
 | 
			
		||||
					log_continue = false;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -833,7 +833,7 @@ struct TechmapWorker
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		if (log_continue) {
 | 
			
		||||
			log_header("Continuing TECHMAP pass.\n");
 | 
			
		||||
			log_header(design, "Continuing TECHMAP pass.\n");
 | 
			
		||||
			log_continue = false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -976,7 +976,7 @@ struct TechmapPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing TECHMAP pass (map to technology primitives).\n");
 | 
			
		||||
		log_header(design, "Executing TECHMAP pass (map to technology primitives).\n");
 | 
			
		||||
		log_push();
 | 
			
		||||
 | 
			
		||||
		TechmapWorker worker;
 | 
			
		||||
| 
						 | 
				
			
			@ -1108,7 +1108,7 @@ struct FlattenPass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
	virtual void execute(std::vector<std::string> args, RTLIL::Design *design)
 | 
			
		||||
	{
 | 
			
		||||
		log_header("Executing FLATTEN pass (flatten design).\n");
 | 
			
		||||
		log_header(design, "Executing FLATTEN pass (flatten design).\n");
 | 
			
		||||
		log_push();
 | 
			
		||||
 | 
			
		||||
		extra_args(args, 1, design);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -160,7 +160,7 @@ struct TribufPass : public Pass {
 | 
			
		|||
	{
 | 
			
		||||
		TribufConfig config;
 | 
			
		||||
 | 
			
		||||
		log_header("Executing TRIBUF pass.\n");
 | 
			
		||||
		log_header(design, "Executing TRIBUF pass.\n");
 | 
			
		||||
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue