mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Tweak default gate costs, cleanup "stat -tech cmos"
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									100c377451
								
							
						
					
					
						commit
						338f6765eb
					
				
					 2 changed files with 10 additions and 20 deletions
				
			
		| 
						 | 
					@ -36,12 +36,12 @@ struct CellCosts
 | 
				
			||||||
			{ "$_NOR_",    4 },
 | 
								{ "$_NOR_",    4 },
 | 
				
			||||||
			{ "$_ANDNOT_", 4 },
 | 
								{ "$_ANDNOT_", 4 },
 | 
				
			||||||
			{ "$_ORNOT_",  4 },
 | 
								{ "$_ORNOT_",  4 },
 | 
				
			||||||
			{ "$_XOR_",    6 },
 | 
								{ "$_XOR_",    5 },
 | 
				
			||||||
			{ "$_XNOR_",   6 },
 | 
								{ "$_XNOR_",   5 },
 | 
				
			||||||
			{ "$_AOI3_",   6 },
 | 
								{ "$_AOI3_",   6 },
 | 
				
			||||||
			{ "$_OAI3_",   6 },
 | 
								{ "$_OAI3_",   6 },
 | 
				
			||||||
			{ "$_AOI4_",   8 },
 | 
								{ "$_AOI4_",   7 },
 | 
				
			||||||
			{ "$_OAI4_",   8 },
 | 
								{ "$_OAI4_",   7 },
 | 
				
			||||||
			{ "$_MUX_",    4 },
 | 
								{ "$_MUX_",    4 },
 | 
				
			||||||
			{ "$_NMUX_",   4 }
 | 
								{ "$_NMUX_",   4 }
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -17,11 +17,10 @@
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "kernel/register.h"
 | 
					#include "kernel/yosys.h"
 | 
				
			||||||
#include "kernel/celltypes.h"
 | 
					#include "kernel/celltypes.h"
 | 
				
			||||||
#include "passes/techmap/libparse.h"
 | 
					#include "passes/techmap/libparse.h"
 | 
				
			||||||
 | 
					#include "kernel/cost.h"
 | 
				
			||||||
#include "kernel/log.h"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
USING_YOSYS_NAMESPACE
 | 
					USING_YOSYS_NAMESPACE
 | 
				
			||||||
PRIVATE_NAMESPACE_BEGIN
 | 
					PRIVATE_NAMESPACE_BEGIN
 | 
				
			||||||
| 
						 | 
					@ -228,25 +227,16 @@ struct statdata_t
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			int tran_cnt = 0;
 | 
								int tran_cnt = 0;
 | 
				
			||||||
			bool tran_cnt_exact = true;
 | 
								bool tran_cnt_exact = true;
 | 
				
			||||||
 | 
								auto &gate_costs = CellCosts::cmos_gate_cost();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			for (auto it : num_cells_by_type) {
 | 
								for (auto it : num_cells_by_type) {
 | 
				
			||||||
				auto ctype = it.first;
 | 
									auto ctype = it.first;
 | 
				
			||||||
				auto cnum = it.second;
 | 
									auto cnum = it.second;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (ctype == "$_NOT_")
 | 
									if (gate_costs.count(ctype))
 | 
				
			||||||
					tran_cnt += 2*cnum;
 | 
										tran_cnt += cnum * gate_costs.at(ctype);
 | 
				
			||||||
				else if (ctype.in("$_NAND_", "$_NOR_"))
 | 
					 | 
				
			||||||
					tran_cnt += 4*cnum;
 | 
					 | 
				
			||||||
				else if (ctype.in("$_AOI3_", "$_OAI3_"))
 | 
					 | 
				
			||||||
					tran_cnt += 6*cnum;
 | 
					 | 
				
			||||||
				else if (ctype.in("$_AOI4_", "$_OAI4_"))
 | 
					 | 
				
			||||||
					tran_cnt += 8*cnum;
 | 
					 | 
				
			||||||
				else if (ctype.in("$_NMUX_"))
 | 
					 | 
				
			||||||
					tran_cnt += 10*cnum;
 | 
					 | 
				
			||||||
				else if (ctype.in("$_MUX_", "$_XOR_", "$_XNOR_"))
 | 
					 | 
				
			||||||
					tran_cnt += 12*cnum;
 | 
					 | 
				
			||||||
				else if (ctype.in("$_DFF_P_", "$_DFF_N_"))
 | 
									else if (ctype.in("$_DFF_P_", "$_DFF_N_"))
 | 
				
			||||||
					tran_cnt += 16*cnum;
 | 
										tran_cnt += cnum * 16;
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					tran_cnt_exact = false;
 | 
										tran_cnt_exact = false;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue