Пример #1
0
 def update(self):
     element.update(self)
     if bool(self.inputs['a'].value) and bool(self.inputs['b'].value):
         list(self.outputs.values())[0].set(0)
         #print('nand gate set low')
     else:
         list(self.outputs.values())[0].set(1)
Пример #2
0
 def update(self):
     element.update(self)
     if bool(self.inputs['a'].value) or bool(self.inputs['b'].value):
         list(self.outputs.values())[0].set(1)
         #print('or gate set high')
     else:
         list(self.outputs.values())[0].set(0)
Пример #3
0
 def update(self):
     element.update(self)
     if (bool(self.inputs['a'].value)
             or bool(self.inputs['b'].value)) and not (bool(
                 self.inputs['a'].value) and bool(self.inputs['b'].value)):
         list(self.outputs.values())[0].set(0)
         #print('xnor gate set low')
     else:
         list(self.outputs.values())[0].set(1)
Пример #4
0
 def update(self):
     element.update(self)
     match = []
     for i in range(
             len(self.inputs
                 )):  #Get value of each pin and append it to the match dict
         match.append(list(self.inputs.values())[i].value)
     match = tuple(match)
     result = self.table[
         match]  #Get match as tuple so that it can be used as a dict index
     for o in range(len(result)):
         list(self.outputs.values())[o].set(result[o])