示例#1
0
文件: test.py 项目: pkeshava/scoville
  def testLowLowShouldResultInHigh(self):
    circuit = Circuit.fromFile("NAND.cir")

    circuit.setSignal(SignalWithResistance("A", 0.0, 10))
    circuit.setSignal(SignalWithResistance("B", 0.0, 10))
    circuit.inspectVoltage('NAND')

    circuit.run(200)
    self.assertGreater(circuit.getVoltage('NAND'), 4.5)
示例#2
0
文件: test.py 项目: pkeshava/scoville
  def testHighHighShouldResultInLow(self):
    circuit = Circuit.fromFile("NAND.cir")

    circuit.setSignal(SignalWithResistance("A", 5.0, 10))
    circuit.setSignal(SignalWithResistance("B", 5.0, 10))
    circuit.inspectVoltage('NAND')

    circuit.run(200)
    self.assertLess(circuit.getVoltage('NAND'), 0.5)
示例#3
0
文件: test.py 项目: pkeshava/scoville
  def testShouldSwitchOnIn50ns(self):
    circuit = Circuit.fromFile("NAND.cir")

    circuit.setSignal(SignalWithResistance("A", 5.0, 10))
    circuit.setSignal(DelayedSignal("B", value=0.0, delay=100, resistance=10, startValue=5.0))
    circuit.inspectVoltage('NAND')

    circuit.run(200, 0.05)
    self.assertLess(circuit.getMaxVoltage('NAND', 0.1, 100), 0.5)
    self.assertGreater(circuit.getMinVoltage('NAND', 100.05, 200), 4.5)
示例#4
0
文件: test.py 项目: pkeshava/scoville
    def setupCircuit(self):
        circuit = Circuit.fromFile("ALU.cir")

        circuit.setSignal(SignalWithResistance("A", 0.0, 10))
        circuit.setSignal(SignalWithResistance("B", 0.0, 10))
        circuit.setSignal(SignalWithResistance("C", 0.0, 10))
        circuit.setSignal(SignalWithResistance("INV", 0.0, 10))

        circuit.inspectVoltage('XOR')
        circuit.inspectVoltage('NAND')
        circuit.inspectVoltage('NOR')
        circuit.inspectVoltage('CARRY')
        circuit.inspectVoltage('SUM')

        circuit.inspectCurrent('Vs')

        return circuit
示例#5
0
    def setupCircuit(self):
        circuit = Circuit.fromFile("ALU.cir")

        circuit.setSignal(SignalWithResistance("A", 0.0, 10))
        circuit.setSignal(SignalWithResistance("B", 0.0, 10))
        circuit.setSignal(SignalWithResistance("C", 0.0, 10))
        circuit.setSignal(SignalWithResistance("INV", 0.0, 10))

        circuit.inspectVoltage('XOR')
        circuit.inspectVoltage('NAND')
        circuit.inspectVoltage('NOR')
        circuit.inspectVoltage('CARRY')
        circuit.inspectVoltage('SUM')

        circuit.inspectCurrent('Vs')

        return circuit
示例#6
0
文件: test.py 项目: pkeshava/scoville
  def testShouldNotUseTooMuchCurrent(self):
    circuit = Circuit.fromFile("NAND.cir")

    circuit.setSignal(SignalWithResistance("A", 5.0, 10))
    circuit.setSignal(SignalWithResistance("B", 5.0, 10))
    circuit.inspectCurrent('Vs')

    circuit.run(200)
    self.assertLess(circuit.getMaxCurrent('Vs'), .001)

    circuit.setSignal(SignalWithResistance("A", 0.0, 10))
    circuit.run(200)
    self.assertLess(circuit.getMaxCurrent('Vs'), 0.001)

    circuit.setSignal(SignalWithResistance("B", 0.0, 10))
    circuit.run(200)
    self.assertLess(circuit.getMaxCurrent('Vs'), 0.001)

    circuit.setSignal(SignalWithResistance("A", 5.0, 10))
    circuit.run(200)
    self.assertLess(circuit.getMaxCurrent('Vs'), 0.001)