def setup_function(function):
    global root
    global power
    global not_

    root = Compound(None)
    power = NOT(root)
    not_ = -power
    work(power)
    work(not_)
Пример #2
0
 def build(self):
     super(RecetablePersistentCell, self).build()
     self.reset = Transmitter(self, 'RESET')
     self.inputs.append(self.reset)
     self.reset_switch = PersistentSwitch(self, 'RESETSWITCH')
     self.reset >> self.reset_switch.on
     self.complete_indicator = NOT(self, 'COMPLETE')
     for bit in self.bits:
         self.reset_switch >> bit.off
         bit >> self.complete_indicator
     self.complete_indicator >> self.reset_switch.off
Пример #3
0
def setup_function(function):
    global root
    global power
    global not_
    global machine
    machine = Machine(Compound(None))

    root = Compound(None)
    power = NOT(root)
    not_ = -power
    work(power)
    work(not_)
Пример #4
0
 def build(self):
     self.clock = Transmitter(self, 'CLOCK')
     self.data = Transmitter(self, 'DATA')
     self.not_ = NOT(self, '!')
     self.latch1 = Latch(self, '1')
     self.latch2 = Latch(self, 'OUTPUT')
     self.outputs.append(self.latch2)
     self.clock >> self.not_
     self.clock >> self.latch1.enable
     self.data >> self.latch1.data
     self.not_ >> self.latch2.enable
     self.latch1 >> self.latch2.data
Пример #5
0
 def build(self):
     super(RecetableBinaryCounter, self).build()
     reset = PersistentSwitch(self, 'RESET')
     self.reset = reset.on
     complete_flag = NOT(self, 'RESET_COMPLETE')
     complete_flag >> reset.off
     self.inputs.append(reset.on)
     for i, bit in enumerate(self.cell.bits):
         switch = self.switches[i]
         and_ = reset & bit
         and_._name = 'R%i' % i
         and_ >> switch
         and_ >> bit.off
         bit >> complete_flag
Пример #6
0
 def build(self):
     inp = Transmitter(self, 'SNL')
     not_ = NOT(self, '!')
     inp >> not_
     prev = not_
     for i in range(self.ticks - 1):
         repeater = XOR(self, 'R%i' % i)
         prev >> repeater.first
         prev = repeater
     and_ = AND(self, 'PLS')
     prev >> and_.first
     inp >> and_.second
     self.inputs.append(inp.default_input)
     self.outputs.append(and_.default_output)
Пример #7
0
 def build(self):
     not_ = NOT(self, '!')
     latch1 = Latch(self, 'L1')
     latch2 = Latch(self, 'L2')
     clock = Transmitter(self, 'CLK')
     data = Transmitter(self, 'DTA')
     clock >> not_
     clock >> latch1.enable
     data >> latch1.data
     not_ >> latch2.enable
     latch1 >> latch2.data
     self.output = latch2.default_output
     self.clock = clock.default_input
     self.data = data.default_input
     self.inputs.extend([self.clock, self.data])
     self.outputs.append(self.output)
Пример #8
0
 def build(self):
     switches = Compound(self, 'SWITCHES')
     self.logic = Compound(self, 'LOGIC')
     self.input = Transmitter(self, 'INPUT')
     self.inputs.append(input)
     prev_switch = None
     self.switches = []
     for i, bit in enumerate(self.cell.bits):
         switch = Switch(switches, 'S%i' % i)
         self.switches.append(switch)
         switch >> bit.on
         (-switch) >> bit.off
         if prev_switch:
             not_ = NOT(self.logic, 'L%i' % i)
             prev_switch >> not_
             not_ >> switch
         else:
             self.input >> switch
         prev_switch = switch
Пример #9
0
 def build(self):
     self.xor = CellsXOR(self.cell1, self.cell2, self)
     self.NOT = NOT(self, 'EQUALS')
     for bit in self.xor.bits:
         bit >> self.NOT
     self.outputs.append(self.NOT)