mirror of https://github.com/VLSIDA/OpenRAM.git
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 <kbastian@mail.uni-paderborn.de>
This commit is contained in:
parent
7ff5121d8c
commit
c0c89e465a
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class vector3d():
|
|||
self.x = x
|
||||
self.y = y
|
||||
self.z = z
|
||||
|
||||
self._hash = hash((self.x,self.y,self.z))
|
||||
|
||||
def __str__(self):
|
||||
""" override print function output """
|
||||
|
|
@ -96,7 +96,7 @@ class vector3d():
|
|||
Note: This assumes that you DON'T CHANGE THE VECTOR or it will
|
||||
break things.
|
||||
"""
|
||||
return hash((self.x,self.y,self.z))
|
||||
return self._hash
|
||||
|
||||
|
||||
def __rsub__(self, other):
|
||||
|
|
|
|||
Loading…
Reference in New Issue