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

Function NewAdd2

components/adder.go:74–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

72}
73
74func NewAdd2() *Add2 {
75 a := new(Add2)
76
77 a.inputA = *circuit.NewWire("a", false)
78 a.inputB = *circuit.NewWire("b", false)
79 a.carryIn = *circuit.NewWire("c", false)
80 a.carryOut = *circuit.NewWire("co", false)
81 a.sumOut = *circuit.NewWire("so", false)
82
83 a.xor1 = *circuit.NewXORGate()
84 a.xor2 = *circuit.NewXORGate()
85 a.and1 = *circuit.NewANDGate()
86 a.and2 = *circuit.NewANDGate()
87 a.or1 = *circuit.NewORGate()
88
89 return a
90}
91
92func (g *Add2) Update(inputA, inputB, carryIn bool) {
93 g.inputA.Update(inputA)

Callers 2

TestAdd2Function · 0.85
NewAdderFunction · 0.85

Calls 4

NewWireFunction · 0.92
NewXORGateFunction · 0.92
NewANDGateFunction · 0.92
NewORGateFunction · 0.92

Tested by 1

TestAdd2Function · 0.68