Class: Circuits::Component::SrNand

Inherits:
Base
  • Object
show all
Defined in:
lib/circuits/component/sr_nand.rb

Overview

SR NAND Latch

Instance Attribute Summary

Attributes inherited from Base

#inputs, #outputs

Instance Method Summary collapse

Methods inherited from Base

#[], #tick, #tock

Constructor Details

#initializeSrNand

Returns a new instance of SrNand.



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

def initialize
  nand_s = Nand.new
  nand_r = Nand.new
  super(inputs: [:not_s, :not_r],
        outputs: [:q, :not_q],
        sub_components: [nand_s, nand_r],
        ticks: 2)
  link nand_s, nand_r
  reset
end