mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	added $pmux cell translation
This commit is contained in:
		
							parent
							
								
									ac896c63e2
								
							
						
					
					
						commit
						2446b6fbef
					
				
					 1 changed files with 38 additions and 2 deletions
				
			
		|  | @ -638,6 +638,41 @@ struct BtorDumper | |||
| 				fprintf(f, "%s\n", str.c_str()); | ||||
| 				line_ref[cell->name]=line_num; | ||||
| 			} | ||||
| 			else if(cell->type == "$pmux") | ||||
|                         { | ||||
|                           log("writing pmux cell\n"); | ||||
|                           int output_width = cell->parameters.at(RTLIL::IdString("\\WIDTH")).as_int(); | ||||
|                           int select_width = cell->parameters.at(RTLIL::IdString("\\S_WIDTH")).as_int(); | ||||
|                           int default_case = dump_sigspec(&cell->connections.at(RTLIL::IdString("\\A")), output_width); | ||||
|                           int cases = dump_sigspec(&cell->connections.at(RTLIL::IdString("\\B")), output_width*select_width); | ||||
|                           int select = dump_sigspec(&cell->connections.at(RTLIL::IdString("\\S")), select_width); | ||||
|                           int *c = new int[select_width]; | ||||
|                            | ||||
|                           for (int i=0; i<select_width; ++i) | ||||
|                           { | ||||
|                             ++line_num; | ||||
|                             str = stringf ("%d slice 1 %d %d %d", line_num, select, i, i); | ||||
|                             fprintf(f, "%s\n", str.c_str()); | ||||
|                             c[i] = line_num; | ||||
|                             ++line_num; | ||||
|                             str = stringf ("%d slice %d %d %d %d", line_num, output_width, cases, i*output_width+output_width-1,  | ||||
|                                            i*output_width); | ||||
|                             fprintf(f, "%s\n", str.c_str()); | ||||
|                           } | ||||
|                            | ||||
|                           ++line_num; | ||||
|                           str = stringf ("%d cond 1 %d %d %d", line_num, c[select_width-1], c[select_width-1]+1, default_case); | ||||
|                           fprintf(f, "%s\n", str.c_str()); | ||||
|                            | ||||
|                           for (int i=select_width-2; i>=0; --i) | ||||
|                           { | ||||
|                             ++line_num; | ||||
|                             str = stringf ("%d cond 1 %d %d %d", line_num, c[i], c[i]+1, line_num-1); | ||||
|                             fprintf(f, "%s\n", str.c_str()); | ||||
|                           } | ||||
| 
 | ||||
|                           line_ref[cell->name]=line_num; | ||||
|                         } | ||||
|                         //registers
 | ||||
| 			else if(cell->type == "$dff" || cell->type == "$adff" || cell->type == "$dffsr") | ||||
| 			{ | ||||
|  | @ -767,7 +802,8 @@ struct BtorDumper | |||
| 				assert(output->width == output_width); | ||||
| 				int offset = cell->parameters.at(RTLIL::IdString("\\OFFSET")).as_int();	 | ||||
| 				++line_num; | ||||
| 				str = stringf("%d %s %d %d %d %d", line_num, cell_type_translation.at(cell->type).c_str(), output_width, input_line, output_width+offset-1, offset);	 | ||||
| 				str = stringf("%d %s %d %d %d %d", line_num, cell_type_translation.at(cell->type).c_str(),  | ||||
|                                               output_width, input_line, output_width+offset-1, offset);	 | ||||
| 				fprintf(f, "%s\n", str.c_str());				 | ||||
| 				line_ref[cell->name]=line_num;	 | ||||
| 			} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue