Exemple #1
0
 def outputs():
     for point in boolfunc.iter_points(inputs):
         ab = self.restrict(point)
         cd = other.restrict(point)
         # a + c, b * d
         output = (ab | cd) & 2 | (ab & cd) & 1
         yield self.output2str(output)
Exemple #2
0
 def outputs():
     for point in boolfunc.iter_points(inputs):
         ab = self.restrict(point)
         cd = other.restrict(point)
         a, b, c, d = ab >> 1, ab & 1, cd >> 1, cd & 1
         # a * c + b * d, a * d + b * c
         output = ( ((a & c | b & d) << 1) |
                    (a & d | b & c) )
         yield self.output2str(output)
Exemple #3
0
 def iter_ones(self):
     rest, top = self.inputs[:-1], self.inputs[-1]
     for p, cf in self.iter_cofactors(top):
         if cf == 1:
             for point in boolfunc.iter_points(rest):
                 point[top] = p[top]
                 yield point
         elif cf != 0:
             for point in cf.iter_ones():
                 point[top] = p[top]
                 yield point
Exemple #4
0
 def iter_zeros(self):
     top, rest = self.inputs[0], self.inputs[1:]
     for p, cf in self.iter_cofactors(top):
         if cf == 0:
             for point in boolfunc.iter_points(rest):
                 point[top] = p[top]
                 yield point
         elif cf != 1:
             for point in cf.iter_zeros():
                 point[top] = p[top]
                 yield point
Exemple #5
0
 def satisfy_all(self):
     for point in iter_points(self.inputs):
         yield point
Exemple #6
0
 def outputs():
     for point in boolfunc.iter_points(inputs):
         yield self.restrict(point) ^ other.restrict(point)