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

Method refreshFlagStateGates

cpu/cpu.go:808–834  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

806}
807
808func (c *CPU) refreshFlagStateGates() {
809 /*
810 // C
811 c.flagStateGates[0].Update(c.ir.Bit(12), c.flagsBus.GetOutputWire(FLAGS_BUS_CARRY))
812 // A
813 c.flagStateGates[1].Update(c.ir.Bit(13), c.flagsBus.GetOutputWire(FLAGS_BUS_A_LARGER))
814 // E
815 c.flagStateGates[2].Update(c.ir.Bit(14), c.flagsBus.GetOutputWire(FLAGS_BUS_EQUAL))
816 // Z
817 c.flagStateGates[3].Update(c.ir.Bit(15), c.flagsBus.GetOutputWire(FLAGS_BUS_ZERO))
818 */
819 // C
820 c.flagStateGates[0].Update(c.ir.Bit(12), c.flagsBus.GetOutputWire(FLAGS_BUS_CARRY))
821 // A
822 c.flagStateGates[1].Update(c.ir.Bit(13), c.flagsBus.GetOutputWire(FLAGS_BUS_A_LARGER))
823 // E
824 c.flagStateGates[2].Update(c.ir.Bit(14), c.flagsBus.GetOutputWire(FLAGS_BUS_EQUAL))
825 // Z
826 c.flagStateGates[3].Update(c.ir.Bit(15), c.flagsBus.GetOutputWire(FLAGS_BUS_ZERO))
827
828 c.flagStateORGate.Update(
829 c.flagStateGates[0].Output(),
830 c.flagStateGates[1].Output(),
831 c.flagStateGates[2].Output(),
832 c.flagStateGates[3].Output(),
833 )
834}
835
836func (c *CPU) runSetOnIO(state bool) {
837 c.ioBusSetGate.Update(state, c.step4Gate3And.Output())

Callers 1

runSetMethod · 0.95

Calls 4

BitMethod · 0.80
UpdateMethod · 0.65
GetOutputWireMethod · 0.65
OutputMethod · 0.45

Tested by

no test coverage detected