mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	verilog: allow spaces in macro arguments
This commit is contained in:
		
							parent
							
								
									4762cc06c6
								
							
						
					
					
						commit
						4fadcc8f25
					
				
					 2 changed files with 28 additions and 1 deletions
				
			
		| 
						 | 
					@ -392,7 +392,6 @@ static bool read_argument(std::string &dest)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	std::vector<char> openers;
 | 
						std::vector<char> openers;
 | 
				
			||||||
	for (;;) {
 | 
						for (;;) {
 | 
				
			||||||
		skip_spaces();
 | 
					 | 
				
			||||||
		std::string tok = next_token(true);
 | 
							std::string tok = next_token(true);
 | 
				
			||||||
		if (tok == ")") {
 | 
							if (tok == ")") {
 | 
				
			||||||
			if (openers.empty())
 | 
								if (openers.empty())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										28
									
								
								tests/simple/macro_arg_spaces.sv
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								tests/simple/macro_arg_spaces.sv
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,28 @@
 | 
				
			||||||
 | 
					module top(
 | 
				
			||||||
 | 
						input wire [31:0] i,
 | 
				
			||||||
 | 
						output wire [31:0] x, y, z
 | 
				
			||||||
 | 
					);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`define BAR(a) a
 | 
				
			||||||
 | 
					`define FOO(a = function automatic [31:0] f) a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`BAR(function automatic [31:0] a);
 | 
				
			||||||
 | 
						input [31:0] i;
 | 
				
			||||||
 | 
						a = i * 2;
 | 
				
			||||||
 | 
					endfunction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`FOO();
 | 
				
			||||||
 | 
						input [31:0] i;
 | 
				
			||||||
 | 
						f = i * 3;
 | 
				
			||||||
 | 
					endfunction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`FOO(function automatic [31:0] b);
 | 
				
			||||||
 | 
						input [31:0] i;
 | 
				
			||||||
 | 
						b = i * 5;
 | 
				
			||||||
 | 
					endfunction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					assign x = a(i);
 | 
				
			||||||
 | 
					assign y = f(i);
 | 
				
			||||||
 | 
					assign z = b(i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					endmodule
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue