Esempio n. 1
0
 def vands(self, *others):
     res = self.new(n=self.n)
     for other in others:
         assert (self.n == other.n)
     fanin = len(others) + 1
     inst.ands(fanin, self.n, res, self, *others)
     return res
Esempio n. 2
0
 def __and__(self, other):
     if util.is_zero(other):
         return 0
     elif util.is_all_ones(other, self.n):
         return self
     assert (self.n == other.n)
     res = self.new(n=self.n)
     inst.ands(self.n, res, self, other)
     return res
Esempio n. 3
0
 def __and__(self, other):
     if util.is_zero(other):
         return 0
     elif util.is_all_ones(other, self.n):
         return self
     assert(self.n == other.n)
     res = self.new(n=self.n)
     inst.ands(self.n, res, self, other)
     return res
Esempio n. 4
0
 def _and(self, other):
     res = self.new(n=self.n)
     if not isinstance(other, sbits):
         other = cbits.get_type(self.n).conv(other)
         inst.andm(self.n, res, self, other)
         return res
     other = self.conv(other)
     assert(self.n == other.n)
     inst.ands(self.n, res, self, other)
     return res
Esempio n. 5
0
 def __and__(self, other):
     if util.is_zero(other):
         return 0
     elif util.is_all_ones(other, self.n):
         return self
     res = self.new(n=self.n)
     if not isinstance(other, sbits):
         other = cbits.get_type(self.n).conv(other)
         inst.andm(self.n, res, self, other)
         return res
     other = self.conv(other)
     assert(self.n == other.n)
     inst.ands(self.n, res, self, other)
     return res