Example #1
0
 def operate(self):
     if not hasattr(self, 'a'): return
     try:
         value = sample_pins(self.a)
         self.o.out_value = logic.buffn(self.i[value].in_value)
     except LookupError:
         self.o.out_value = 'X'
Example #2
0
 def operate(self):
     if not hasattr(self,'o'):return
     try:
         value = sample_pins(self.a)
         for n in range(len(self.o)): self.o[n].out_value = logic.buffn(self.i.in_value) if n == value else '0'
     except (AttributeError,LookupError):
         for n in range(len(self.o)): self.o[n].out_value = 'X'
Example #3
0
 def operate(self):
     if not hasattr(self, 'clk'): return
     clk = sample(self.clk)
     if self.old_clk == '0' and clk == '1':
         for bit in range(min(len(self.m), len(self.o))):
             self.m[bit] = logic.buffn(self.i[bit].in_value)
     self.old_clk = clk
     for bit in range(min(len(self.m), len(self.o))):
         self.o[bit].out_value = self.m[bit]
Example #4
0
 def operate(self):
     if not hasattr(self, 'clk'): return
     clk = sample(self.clk)
     if self.old_clk == '0' and clk == '1':
         for bit in range(len(self.m)):
             self.m[bit] = logic.buffn(self.i[bit].in_value)
             ch = 0
             for n in range(len(self.m)):
                 if self.m[n] in "1H":
                     ch |= 1 << n
         self.canvas.itemconfig(self.label, font=('tkfixed', 72))
         self.rename(chr(ch))
     self.old_clk = clk
     for bit in range(len(self.m)):
         self.o[bit].out_value = self.m[bit]
Example #5
0
 def operate(self):
     if not hasattr(self,'clk'): return
     clk = sample(self.clk)
     r = sample(self.r)
     try: addr = sample_pins(self.a)
     except LookupError: addr=0
     if self.old_clk == '0' and clk == '1':
         for bit in range(len(self.d)):
             self.m[addr][bit] = logic.buffn(self.d[bit].in_value)
     self.old_clk = clk
     if (r=='1'):
         for bit in range(len(self.d)):
             self.d[bit].out_value = self.m[addr][bit]
     else:
         for bit in range(len(self.d)):
             self.d[bit].out_value = 'Z'
Example #6
0
def sample(pin):
    return logic.buffn(
        pin.in_value
    )  # if not pin.bubble.inverted else logic.notfn(pin.in_value)