central-arch/pkg/cpu/exec.go

34 lines
620 B
Go
Raw Permalink Normal View History

2024-11-01 10:54:59 +00:00
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"})
}
}
}