mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-30 19:22:31 +00:00 
			
		
		
		
	Optionally suppress output from display system tasks in read_verilog
This commit is contained in:
		
							parent
							
								
									510d137996
								
							
						
					
					
						commit
						3ed9030eb4
					
				
					 4 changed files with 35 additions and 27 deletions
				
			
		|  | @ -45,7 +45,7 @@ namespace AST { | |||
| 
 | ||||
| // instantiate global variables (private API)
 | ||||
| namespace AST_INTERNAL { | ||||
| 	bool flag_dump_ast1, flag_dump_ast2, flag_no_dump_ptr, flag_dump_vlog1, flag_dump_vlog2, flag_dump_rtlil, flag_nolatches, flag_nomeminit; | ||||
| 	bool flag_nodisplay, flag_dump_ast1, flag_dump_ast2, flag_no_dump_ptr, flag_dump_vlog1, flag_dump_vlog2, flag_dump_rtlil, flag_nolatches, flag_nomeminit; | ||||
| 	bool flag_nomem2reg, flag_mem2reg, flag_noblackbox, flag_lib, flag_nowb, flag_noopt, flag_icells, flag_pwires, flag_autowire; | ||||
| 	AstNode *current_ast, *current_ast_mod; | ||||
| 	std::map<std::string, AstNode*> current_scope; | ||||
|  | @ -1320,11 +1320,12 @@ static void rename_in_package_stmts(AstNode *pkg) | |||
| } | ||||
| 
 | ||||
| // create AstModule instances for all modules in the AST tree and add them to 'design'
 | ||||
| void AST::process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump_ast2, bool no_dump_ptr, bool dump_vlog1, bool dump_vlog2, bool dump_rtlil, | ||||
| void AST::process(RTLIL::Design *design, AstNode *ast, bool nodisplay, bool dump_ast1, bool dump_ast2, bool no_dump_ptr, bool dump_vlog1, bool dump_vlog2, bool dump_rtlil, | ||||
| 		bool nolatches, bool nomeminit, bool nomem2reg, bool mem2reg, bool noblackbox, bool lib, bool nowb, bool noopt, bool icells, bool pwires, bool nooverwrite, bool overwrite, bool defer, bool autowire) | ||||
| { | ||||
| 	current_ast = ast; | ||||
| 	current_ast_mod = nullptr; | ||||
| 	flag_nodisplay = nodisplay; | ||||
| 	flag_dump_ast1 = dump_ast1; | ||||
| 	flag_dump_ast2 = dump_ast2; | ||||
| 	flag_no_dump_ptr = no_dump_ptr; | ||||
|  |  | |||
|  | @ -376,7 +376,7 @@ namespace AST | |||
| 	}; | ||||
| 
 | ||||
| 	// process an AST tree (ast must point to an AST_DESIGN node) and generate RTLIL code
 | ||||
| 	void process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump_ast2, bool no_dump_ptr, bool dump_vlog1, bool dump_vlog2, bool dump_rtlil, bool nolatches, bool nomeminit, | ||||
| 	void process(RTLIL::Design *design, AstNode *ast, bool nodisplay, bool dump_ast1, bool dump_ast2, bool no_dump_ptr, bool dump_vlog1, bool dump_vlog2, bool dump_rtlil, bool nolatches, bool nomeminit, | ||||
| 			bool nomem2reg, bool mem2reg, bool noblackbox, bool lib, bool nowb, bool noopt, bool icells, bool pwires, bool nooverwrite, bool overwrite, bool defer, bool autowire); | ||||
| 
 | ||||
| 	// parametric modules are supported directly by the AST library
 | ||||
|  | @ -432,7 +432,7 @@ namespace AST | |||
| namespace AST_INTERNAL | ||||
| { | ||||
| 	// internal state variables
 | ||||
| 	extern bool flag_dump_ast1, flag_dump_ast2, flag_no_dump_ptr, flag_dump_rtlil, flag_nolatches, flag_nomeminit; | ||||
| 	extern bool flag_nodisplay, flag_dump_ast1, flag_dump_ast2, flag_no_dump_ptr, flag_dump_rtlil, flag_nolatches, flag_nomeminit; | ||||
| 	extern bool flag_nomem2reg, flag_mem2reg, flag_lib, flag_noopt, flag_icells, flag_pwires, flag_autowire; | ||||
| 	extern AST::AstNode *current_ast, *current_ast_mod; | ||||
| 	extern std::map<std::string, AST::AstNode*> current_scope; | ||||
|  |  | |||
|  | @ -1058,33 +1058,31 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin | |||
| 	{ | ||||
| 		if (!current_always) { | ||||
| 			log_file_warning(filename, location.first_line, "System task `%s' outside initial or always block is unsupported.\n", str.c_str()); | ||||
| 		} else if (current_always->type == AST_INITIAL) { | ||||
| 			int default_base = 10; | ||||
| 			if (str.back() == 'b') | ||||
| 				default_base = 2; | ||||
| 			else if (str.back() == 'o') | ||||
| 				default_base = 8; | ||||
| 			else if (str.back() == 'h') | ||||
| 				default_base = 16; | ||||
| 
 | ||||
| 			// when $display()/$write() functions are used in an initial block, print them during synthesis
 | ||||
| 			Fmt fmt = processFormat(stage, /*sformat_like=*/false, default_base, /*first_arg_at=*/0, /*may_fail=*/true); | ||||
| 			if (str.substr(0, 8) == "$display") | ||||
| 				fmt.append_string("\n"); | ||||
| 			log("%s", fmt.render().c_str()); | ||||
| 			for (auto node : children) | ||||
| 				while (node->simplify(true, stage, -1, false)) {} | ||||
| 			return false; | ||||
| 			delete_children(); | ||||
| 			str = std::string(); | ||||
| 		} else { | ||||
| 			// when $display()/$write() functions are used in an always block, simplify the expressions and
 | ||||
| 			// convert them to a special cell later in genrtlil
 | ||||
| 			// simplify the expressions and convert them to a special cell later in genrtlil
 | ||||
| 			for (auto node : children) | ||||
| 				while (node->simplify(true, stage, -1, false)) {} | ||||
| 
 | ||||
| 			if (current_always->type == AST_INITIAL && !flag_nodisplay && stage == 2) { | ||||
| 				int default_base = 10; | ||||
| 				if (str.back() == 'b') | ||||
| 					default_base = 2; | ||||
| 				else if (str.back() == 'o') | ||||
| 					default_base = 8; | ||||
| 				else if (str.back() == 'h') | ||||
| 					default_base = 16; | ||||
| 
 | ||||
| 				// when $display()/$write() functions are used in an initial block, print them during synthesis
 | ||||
| 				Fmt fmt = processFormat(stage, /*sformat_like=*/false, default_base, /*first_arg_at=*/0, /*may_fail=*/true); | ||||
| 				if (str.substr(0, 8) == "$display") | ||||
| 					fmt.append_string("\n"); | ||||
| 				log("%s", fmt.render().c_str()); | ||||
| 			} | ||||
| 
 | ||||
| 			return false; | ||||
| 		} | ||||
| 
 | ||||
| 		delete_children(); | ||||
| 		str = std::string(); | ||||
| 	} | ||||
| 
 | ||||
| 	// activate const folding if this is anything that must be evaluated statically (ranges, parameters, attributes, etc.)
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue