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

Function NewStepper

components/stepper.go:22–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20}
21
22func NewStepper() *Stepper {
23 s := new(Stepper)
24
25 for i, _ := range s.bits {
26 s.bits[i] = *NewBit()
27 }
28
29 s.resetNotGate = *circuit.NewNOTGate()
30 s.clockInNotGate = *circuit.NewNOTGate()
31 for i, _ := range s.inputOrGates {
32 s.inputOrGates[i] = *circuit.NewORGate()
33 }
34
35 for i, _ := range s.outputAndGates {
36 s.outputAndGates[i] = *circuit.NewANDGate()
37 }
38 s.outputOrGate = *circuit.NewORGate()
39
40 for i, _ := range s.outputNotGates {
41 s.outputNotGates[i] = *circuit.NewNOTGate()
42 }
43
44 return s
45}
46
47func (s *Stepper) GetOutputWire(index int) bool {
48 return s.outputs[index].Get()

Callers 2

NewCPUFunction · 0.92
testStepperStateAfterFunction · 0.85

Calls 4

NewNOTGateFunction · 0.92
NewORGateFunction · 0.92
NewANDGateFunction · 0.92
NewBitFunction · 0.85

Tested by 1

testStepperStateAfterFunction · 0.68