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

Method Update

components/adder.go:43–59  ·  view source on GitHub ↗
(carryIn bool)

Source from the content-addressed store, hash-verified

41}
42
43func (a *Adder) Update(carryIn bool) {
44 a.carryIn.Update(carryIn)
45
46 awire := 31
47 bwire := 15
48 for i := len(a.adds) - 1; i >= 0; i-- {
49 aval := a.inputs[awire].Get()
50 bval := a.inputs[bwire].Get()
51
52 a.adds[i].Update(aval, bval, a.carryIn.Get())
53 a.outputs[i].Update(a.adds[i].Sum())
54 a.carryOut.Update(a.adds[i].Carry())
55 a.carryIn.Update(a.adds[i].Carry())
56 awire--
57 bwire--
58 }
59}
60
61type Add2 struct {
62 inputA circuit.Wire

Callers 1

Calls 4

SumMethod · 0.80
UpdateMethod · 0.65
GetMethod · 0.45
CarryMethod · 0.45

Tested by 1