Class: Circuits::Component::SrNand

Inherits:
Object
  • Object
show all
Includes:
Circuits::Component
Defined in:
lib/circuits/component/sr_nand.rb

Overview

SR NAND Latch

Instance Attribute Summary

Attributes included from Circuits::Component

#inputs, #outputs

Instance Method Summary collapse

Methods included from Circuits::Component

#[], #[]=, #initialize, #tock

Instance Method Details

#tickObject

Computes the outputs based on the inputs and previous state



10
11
12
13
14
15
16
17
# File 'lib/circuits/component/sr_nand.rb', line 10

def tick
  2.times.each do
    sub_components.each(&:tick)
    sub_components.each(&:tock)
  end
  self[:q].set nand_1[:out].get
  self[:not_q].set nand_2[:out].get
end