def __init__(self, name, fabric, solver): super().__init__(name, fabric, solver) if 2**(self.fabric.cols.bit_length()-1) == self.fabric.cols: #adding extra bit to avoid overflow adjacency self._x_bits = self.fabric.cols.bit_length() self._is_x_pow2 = True else: self._x_bits = self.fabric.cols.bit_length() self._is_x_pow2 = False if 2**(self.fabric.rows.bit_length()-1) == self.fabric.rows: #adding extra bit to avoid overflow adjacency self._y_bits = self.fabric.rows.bit_length() self._is_y_pow2 = True else: self._y_bits = self.fabric.rows.bit_length() self._is_y_pow2 = False self._x = solver.declare_const(self.name + '_x', sorts.BitVec(self._x_bits)) self._y = solver.declare_const(self.name + '_y', sorts.BitVec(self._y_bits))
def encode_y(self, y): return self.solver.theory_const(sorts.BitVec(self._y_bits), y)
def encode_x(self, x): return self.solver.theory_const(sorts.BitVec(self._x_bits), x)
def __init__(self, name, fabric, solver): super().__init__(name, fabric, solver) self._x = self.solver.declare_const(self.name + '_x', sorts.BitVec(self.fabric.cols)) self._y = self.solver.declare_const(self.name + '_y', sorts.BitVec(self.fabric.rows))
def __init__(self, name, fabric, solver): super().__init__(name, fabric, solver) self._flat = self.solver.declare_const(self.name + '_flat', sorts.BitVec(self.fabric.rows + self.fabric.cols))
def encode_y(self, y): return self.solver.theory_const(sorts.BitVec(self.fabric.rows), 2**y)
def encode_x(self, x): return self.solver.theory_const(sorts.BitVec(self.fabric.cols), 2**x)
def delta_y(self, other): delta_y = self.solver.declare_const(self.name+'-'+other.name+'_delta_y', sorts.BitVec(self.fabric.rows)) constraint = Or(self.y == other.y << delta_y, other.y == self.y << delta_y) return constraint, delta_y
def delta_x(self, other): delta_x = self.solver.declare_const(self.name+'-'+other.name+'_delta_x', sorts.BitVec(self.fabric.cols)) constraint = Or(self.x == other.x << delta_x, other.x == self.x << delta_x) return constraint, delta_x