mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Added $lut support to blif backend (by user eddiehung from reddit)
This commit is contained in:
		
							parent
							
								
									357f3f6e93
								
							
						
					
					
						commit
						337b461d26
					
				
					 1 changed files with 23 additions and 0 deletions
				
			
		| 
						 | 
					@ -190,6 +190,29 @@ struct BlifDumper
 | 
				
			||||||
				continue;
 | 
									continue;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (!config->icells_mode && cell->type == "$lut") {
 | 
				
			||||||
 | 
									fprintf(f, ".names");
 | 
				
			||||||
 | 
									auto &inputs = cell->connections.at("\\I");
 | 
				
			||||||
 | 
									auto width = cell->parameters.at("\\WIDTH").as_int();
 | 
				
			||||||
 | 
									log_assert(inputs.width == width);
 | 
				
			||||||
 | 
									for (int i = 0; i < inputs.width; i++) {
 | 
				
			||||||
 | 
										fprintf(f, " %s", cstr(inputs.extract(i, 1)));
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									auto &output = cell->connections.at("\\O");
 | 
				
			||||||
 | 
									log_assert(output.width == 1);
 | 
				
			||||||
 | 
									fprintf(f, " %s", cstr(output));
 | 
				
			||||||
 | 
									fprintf(f, "\n");
 | 
				
			||||||
 | 
									auto mask = cell->parameters.at("\\LUT").as_string();
 | 
				
			||||||
 | 
									for (int i = 0; i < (1 << width); i++) {
 | 
				
			||||||
 | 
										if (mask[i] == '0') continue;
 | 
				
			||||||
 | 
										for (int j = width-1; j >= 0; j--) {
 | 
				
			||||||
 | 
											fputc((i>>j)&1 ? '1' : '0', f);
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
 | 
										fprintf(f, " %c\n", mask[i]);
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
									continue;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			fprintf(f, ".%s %s", subckt_or_gate(cell->type), cstr(cell->type));
 | 
								fprintf(f, ".%s %s", subckt_or_gate(cell->type), cstr(cell->type));
 | 
				
			||||||
			for (auto &conn : cell->connections)
 | 
								for (auto &conn : cell->connections)
 | 
				
			||||||
			for (int i = 0; i < conn.second.width; i++) {
 | 
								for (int i = 0; i < conn.second.width; i++) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue