Class: Circuits::Component::HalfAdder
- Defined in:
- lib/circuits/component/half_adder.rb
Overview
Half 1-bit Adder
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ HalfAdder
constructor
A new instance of HalfAdder.
Methods inherited from Base
Constructor Details
#initialize ⇒ HalfAdder
Returns a new instance of HalfAdder.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/circuits/component/half_adder.rb', line 9 def initialize and_gate = And.new xor_gate = Xor.new super(inputs: 2, outputs: [:s, :c_out], sub_components: [and_gate, xor_gate], ticks: 1) link_internals and_gate, xor_gate link_outputs and_gate, xor_gate end |