mirror of
https://github.com/VLSIDA/OpenRAM.git
synced 2026-09-05 01:01:33 +02:00
vector: Implement hash cache for vector3d and vector
this gives us a small runtime improvement in the router. For FreePDK45 word_size=8, num_words=256 Improved *** Maze routing supplies: 89.8 seconds ** Routing: 279.3 seconds Non-improved *** Maze routing supplies: 105.1 seconds ** Routing: 293.5 seconds Signed-off-by: Bastian Koppelmann <[email protected]>
This commit is contained in:
@@ -28,6 +28,7 @@ class vector():
|
||||
else:
|
||||
self.x = float(x)
|
||||
self.y = float(y)
|
||||
self._hash = hash((self.x,self.y))
|
||||
|
||||
def __str__(self):
|
||||
""" override print function output """
|
||||
@@ -97,7 +98,7 @@ class vector():
|
||||
Note: This assumes that you DON'T CHANGE THE VECTOR or it will
|
||||
break things.
|
||||
"""
|
||||
return hash((self.x,self.y))
|
||||
return self._hash
|
||||
|
||||
def snap_to_grid(self):
|
||||
self.x = self.snap_offset_to_grid(self.x)
|
||||
|
||||
Reference in New Issue
Block a user