mirror of https://github.com/VLSIDA/OpenRAM.git
52 lines
1.2 KiB
Python
52 lines
1.2 KiB
Python
# See LICENSE for licensing information.
|
|
#
|
|
#Copyright (c) 2016-2019 Regents of the University of California and The Board
|
|
#of Regents for the Oklahoma Agricultural and Mechanical College
|
|
#(acting for and on behalf of Oklahoma State University)
|
|
#All rights reserved.
|
|
#
|
|
class grid_cell:
|
|
"""
|
|
A single cell that can be occupied in a given layer, blocked,
|
|
visited, etc.
|
|
"""
|
|
def __init__(self):
|
|
self.path = False
|
|
self.blocked = False
|
|
self.source = False
|
|
self.target = False
|
|
# -1 means it isn't visited yet
|
|
self.min_cost = -1
|
|
|
|
def reset(self):
|
|
"""
|
|
Reset the dynamic info about routing. The pins/blockages are not reset so
|
|
that they can be reused.
|
|
"""
|
|
self.min_cost=-1
|
|
self.min_path=None
|
|
self.blocked=False
|
|
self.source=False
|
|
self.target=False
|
|
|
|
def get_cost(self):
|
|
# We can display the cost of the frontier
|
|
if self.min_cost > 0:
|
|
return self.min_cost
|
|
|
|
|
|
def get_type(self):
|
|
if self.blocked:
|
|
return "X"
|
|
|
|
if self.source:
|
|
return "S"
|
|
|
|
if self.target:
|
|
return "T"
|
|
|
|
if self.path:
|
|
return "P"
|
|
|
|
return None
|