mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Don't re-create hex_dict for each value
This commit is contained in:
		
							parent
							
								
									d88cd0ae7f
								
							
						
					
					
						commit
						948aac9e1e
					
				
					 1 changed files with 10 additions and 7 deletions
				
			
		| 
						 | 
					@ -23,6 +23,16 @@ from select import select
 | 
				
			||||||
from time import time
 | 
					from time import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					hex_dict = {
 | 
				
			||||||
 | 
					    "0": "0000", "1": "0001", "2": "0010", "3": "0011",
 | 
				
			||||||
 | 
					    "4": "0100", "5": "0101", "6": "0110", "7": "0111",
 | 
				
			||||||
 | 
					    "8": "1000", "9": "1001", "A": "1010", "B": "1011",
 | 
				
			||||||
 | 
					    "C": "1100", "D": "1101", "E": "1110", "F": "1111",
 | 
				
			||||||
 | 
					    "a": "1010", "b": "1011", "c": "1100", "d": "1101",
 | 
				
			||||||
 | 
					    "e": "1110", "f": "1111"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SmtModInfo:
 | 
					class SmtModInfo:
 | 
				
			||||||
    def __init__(self):
 | 
					    def __init__(self):
 | 
				
			||||||
        self.inputs = set()
 | 
					        self.inputs = set()
 | 
				
			||||||
| 
						 | 
					@ -294,13 +304,6 @@ class SmtIo:
 | 
				
			||||||
        if v.startswith("#b"):
 | 
					        if v.startswith("#b"):
 | 
				
			||||||
            return v[2:]
 | 
					            return v[2:]
 | 
				
			||||||
        if v.startswith("#x"):
 | 
					        if v.startswith("#x"):
 | 
				
			||||||
            hex_dict = {
 | 
					 | 
				
			||||||
                "0": "0000", "1": "0001", "2": "0010", "3": "0011",
 | 
					 | 
				
			||||||
                "4": "0100", "5": "0101", "6": "0110", "7": "0111",
 | 
					 | 
				
			||||||
                "8": "1000", "9": "1001", "A": "1010", "B": "1011",
 | 
					 | 
				
			||||||
                "C": "1100", "D": "1101", "E": "1110", "F": "1111",
 | 
					 | 
				
			||||||
                "a": "1010", "b": "1011", "c": "1100", "d": "1101",
 | 
					 | 
				
			||||||
                "e": "1110", "f": "1111"}
 | 
					 | 
				
			||||||
            return "".join(hex_dict.get(x) for x in v[2:])
 | 
					            return "".join(hex_dict.get(x) for x in v[2:])
 | 
				
			||||||
        assert False
 | 
					        assert False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue