MCPcopy Create free account
hub / github.com/djhworld/simple-computer / Update

Method Update

components/adder.go:92–108  ·  view source on GitHub ↗
(inputA, inputB, carryIn bool)

Source from the content-addressed store, hash-verified

90}
91
92func (g *Add2) Update(inputA, inputB, carryIn bool) {
93 g.inputA.Update(inputA)
94 g.inputB.Update(inputB)
95 g.carryIn.Update(carryIn)
96
97 g.xor1.Update(g.inputA.Get(), g.inputB.Get())
98 g.xor2.Update(g.xor1.Output(), g.carryIn.Get())
99
100 g.sumOut.Update(g.xor2.Output())
101
102 g.and1.Update(g.carryIn.Get(), g.xor1.Output())
103 g.and2.Update(g.inputA.Get(), g.inputB.Get())
104
105 g.or1.Update(g.and1.Output(), g.and2.Output())
106
107 g.carryOut.Update(g.or1.Output())
108}
109
110func (g *Add2) Sum() bool {
111 return g.sumOut.Get()

Callers 1

TestAdd2Function · 0.95

Calls 3

UpdateMethod · 0.65
GetMethod · 0.45
OutputMethod · 0.45

Tested by 1

TestAdd2Function · 0.76