mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Added support for signed parameters in ilang
This commit is contained in:
		
							parent
							
								
									7eaad2218d
								
							
						
					
					
						commit
						0ef22c7609
					
				
					 3 changed files with 9 additions and 2 deletions
				
			
		|  | @ -155,7 +155,7 @@ void ILANG_BACKEND::dump_cell(FILE *f, std::string indent, const RTLIL::Cell *ce | ||||||
| 	} | 	} | ||||||
| 	fprintf(f, "%s" "cell %s %s\n", indent.c_str(), cell->type.c_str(), cell->name.c_str()); | 	fprintf(f, "%s" "cell %s %s\n", indent.c_str(), cell->type.c_str(), cell->name.c_str()); | ||||||
| 	for (auto it = cell->parameters.begin(); it != cell->parameters.end(); it++) { | 	for (auto it = cell->parameters.begin(); it != cell->parameters.end(); it++) { | ||||||
| 		fprintf(f, "%s  parameter %s ", indent.c_str(), it->first.c_str()); | 		fprintf(f, "%s  parameter%s %s ", indent.c_str(), cell->signed_parameters.count(it->first) ? " signed" : "", it->first.c_str()); | ||||||
| 		dump_const(f, it->second); | 		dump_const(f, it->second); | ||||||
| 		fprintf(f, "\n"); | 		fprintf(f, "\n"); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -39,6 +39,7 @@ | ||||||
| "module"	{ return TOK_MODULE; } | "module"	{ return TOK_MODULE; } | ||||||
| "attribute"	{ return TOK_ATTRIBUTE; } | "attribute"	{ return TOK_ATTRIBUTE; } | ||||||
| "parameter"	{ return TOK_PARAMETER; } | "parameter"	{ return TOK_PARAMETER; } | ||||||
|  | "signed"	{ return TOK_SIGNED; } | ||||||
| "wire"		{ return TOK_WIRE; } | "wire"		{ return TOK_WIRE; } | ||||||
| "memory"	{ return TOK_MEMORY; } | "memory"	{ return TOK_MEMORY; } | ||||||
| "width"		{ return TOK_WIDTH; } | "width"		{ return TOK_WIDTH; } | ||||||
|  |  | ||||||
|  | @ -54,7 +54,7 @@ using namespace ILANG_FRONTEND; | ||||||
| %token TOK_CELL TOK_CONNECT TOK_SWITCH TOK_CASE TOK_ASSIGN TOK_SYNC | %token TOK_CELL TOK_CONNECT TOK_SWITCH TOK_CASE TOK_ASSIGN TOK_SYNC | ||||||
| %token TOK_LOW TOK_HIGH TOK_POSEDGE TOK_NEGEDGE TOK_EDGE TOK_ALWAYS TOK_INIT | %token TOK_LOW TOK_HIGH TOK_POSEDGE TOK_NEGEDGE TOK_EDGE TOK_ALWAYS TOK_INIT | ||||||
| %token TOK_UPDATE TOK_PROCESS TOK_END TOK_INVALID TOK_EOL TOK_OFFSET | %token TOK_UPDATE TOK_PROCESS TOK_END TOK_INVALID TOK_EOL TOK_OFFSET | ||||||
| %token TOK_PARAMETER TOK_ATTRIBUTE TOK_MEMORY TOK_SIZE | %token TOK_PARAMETER TOK_ATTRIBUTE TOK_MEMORY TOK_SIZE TOK_SIGNED | ||||||
| 
 | 
 | ||||||
| %type <sigspec> sigspec sigspec_list | %type <sigspec> sigspec sigspec_list | ||||||
| %type <integer> sync_type | %type <integer> sync_type | ||||||
|  | @ -189,6 +189,12 @@ cell_body: | ||||||
| 		free($3); | 		free($3); | ||||||
| 		delete $4; | 		delete $4; | ||||||
| 	} | | 	} | | ||||||
|  | 	cell_body TOK_PARAMETER TOK_SIGNED TOK_ID constant TOK_EOL { | ||||||
|  | 		current_cell->parameters[$4] = *$5; | ||||||
|  | 		current_cell->signed_parameters.insert($4); | ||||||
|  | 		free($4); | ||||||
|  | 		delete $5; | ||||||
|  | 	} | | ||||||
| 	cell_body TOK_CONNECT TOK_ID sigspec TOK_EOL { | 	cell_body TOK_CONNECT TOK_ID sigspec TOK_EOL { | ||||||
| 		if (current_cell->connections.count($3) != 0) | 		if (current_cell->connections.count($3) != 0) | ||||||
| 			rtlil_frontend_ilang_yyerror("scope error"); | 			rtlil_frontend_ilang_yyerror("scope error"); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue