central-arch/pkg/cpu/exec.go
2024-11-01 11:54:59 +01:00

34 lines
620 B
Go

package cpu
import (
"sync"
"git.elyanpoujol.fr/elyan/central-arch/pkg/events"
"git.elyanpoujol.fr/elyan/central-arch/pkg/simstep"
)
func (cpu *Cpu) Run(wg *sync.WaitGroup) {
wg.Add(1)
defer wg.Done()
// TODO Implement CPU
var err error
for err == nil {
event := &events.DebugEvent{Msg: "Will step"}
cpu.eventLogger.Log(event)
err = cpu.stepper.RequestStep(event)
if err != nil {
if err != simstep.SimQuitRequest {
panic(err)
}
cpu.eventLogger.Log(&events.DebugEvent{Msg: "Scheduler quit requested"})
} else {
cpu.eventLogger.Log(&events.DebugEvent{Msg: "After step"})
}
}
}