circuits 0.11.2 → 0.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/circuits/component/full_adder.rb +14 -29
- data/lib/circuits/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTUwYzEzOTc5ZGVmNzIyZTg2ZjNjZmEwN2RjMTNjMzk1ZWIxOTRiOQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmM1YTFiM2U2OTRhY2MzNTMwM2RjMTM3NWVjYmVmOWQ4NWMyN2ZmMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTJiMzMzODdhMDZkNzAxZDU0ZmIzN2I1ZjI2OTA0ODQwZmE1YWU0ZDY3Zjc2
|
10
|
+
MTE5MjI5NGMzYTFmZmVjZjRlNWJiNzBlZmNiOTVhNzNhNWE1MmVjODcyOTcz
|
11
|
+
ZTc5NmZjZmJlYWRiMGJmMDQzNTBkODI5ZjZkMjVhMjIyY2EwYmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGUyYTFjZTUwMjNkNTNhZjAyMzI3MzI4OTAzMmRmM2NiNmQ2ZThmODMzMTE4
|
14
|
+
YWQ3Y2U3NTk3MDc0N2EyOGNmZTE4YmU4MWZiNmJjYmEzMDgwYmFkMjM3ODhh
|
15
|
+
NDc0MDRmZDYyZTBkYjI4MDFmZWI0OWEyZTJiNGRmOGJiNzI4ZGI=
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'circuits/component/base'
|
2
|
-
require 'circuits/component/
|
2
|
+
require 'circuits/component/half_adder'
|
3
3
|
require 'circuits/component/or'
|
4
|
-
require 'circuits/component/xor'
|
5
4
|
|
6
5
|
module Circuits
|
7
6
|
module Component
|
@@ -20,50 +19,36 @@ module Circuits
|
|
20
19
|
|
21
20
|
def create_sub_components
|
22
21
|
{
|
23
|
-
|
24
|
-
|
22
|
+
half_adder_in: HalfAdder.new,
|
23
|
+
half_adder_carry: HalfAdder.new,
|
25
24
|
or_gate: Or.new,
|
26
|
-
xor_in: Xor.new,
|
27
|
-
xor_out: Xor.new
|
28
25
|
}
|
29
26
|
end
|
30
27
|
|
31
28
|
def link(sub_components)
|
32
|
-
|
33
|
-
|
29
|
+
link_half_adder_in sub_components
|
30
|
+
link_half_adder_carry sub_components
|
34
31
|
link_or_gate sub_components
|
35
|
-
link_xor_in sub_components
|
36
|
-
link_xor_out sub_components
|
37
32
|
link_outputs sub_components
|
38
33
|
end
|
39
34
|
|
40
|
-
def
|
41
|
-
sub_components[:
|
42
|
-
sub_components[:
|
35
|
+
def link_half_adder_in(sub_components)
|
36
|
+
sub_components[:half_adder_in].a.set a
|
37
|
+
sub_components[:half_adder_in].b.set b
|
43
38
|
end
|
44
39
|
|
45
|
-
def
|
46
|
-
sub_components[:
|
47
|
-
sub_components[:
|
40
|
+
def link_half_adder_carry(sub_components)
|
41
|
+
sub_components[:half_adder_carry].a.set sub_components[:half_adder_in].s
|
42
|
+
sub_components[:half_adder_carry].b.set c_in
|
48
43
|
end
|
49
44
|
|
50
45
|
def link_or_gate(sub_components)
|
51
|
-
sub_components[:or_gate].a.set sub_components[:
|
52
|
-
sub_components[:or_gate].b.set sub_components[:
|
53
|
-
end
|
54
|
-
|
55
|
-
def link_xor_in(sub_components)
|
56
|
-
sub_components[:xor_in].a.set a
|
57
|
-
sub_components[:xor_in].b.set b
|
58
|
-
end
|
59
|
-
|
60
|
-
def link_xor_out(sub_components)
|
61
|
-
sub_components[:xor_out].a.set sub_components[:xor_in].out
|
62
|
-
sub_components[:xor_out].b.set c_in
|
46
|
+
sub_components[:or_gate].a.set sub_components[:half_adder_carry].c
|
47
|
+
sub_components[:or_gate].b.set sub_components[:half_adder_in].c
|
63
48
|
end
|
64
49
|
|
65
50
|
def link_outputs(sub_components)
|
66
|
-
s.set sub_components[:
|
51
|
+
s.set sub_components[:half_adder_carry].s
|
67
52
|
c_out.set sub_components[:or_gate].out
|
68
53
|
end
|
69
54
|
end
|
data/lib/circuits/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circuits
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henry Muru Paenga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|