@@ -34,7 +34,7 @@ class ProcessorAccess(
3434 val registers : MemoryBuild ,
3535 val csrs : LogicBuild ,
3636 val errorOutput : MessageBuild ,
37- val resetSwitch : SwitchBuild ,
37+ val powerSwitch : SwitchBuild ,
3838 val pauseSwitch : SwitchBuild ,
3939 val singleStepSwitch : SwitchBuild ,
4040 uartFifoModulo : Int ,
@@ -255,7 +255,7 @@ class ProcessorAccess(
255255 registers = buildVar<MemoryBuild >(build, " cell1" ) ? : return null ,
256256 csrs = buildVar<LogicBuild >(build, " processor17" ) ? : return null ,
257257 errorOutput = buildVar<MessageBuild >(build, " message1" ) ? : return null ,
258- resetSwitch = buildVar<SwitchBuild >(build, " switch1" ) ? : return null ,
258+ powerSwitch = buildVar<SwitchBuild >(build, " switch1" ) ? : return null ,
259259 pauseSwitch = buildVar<SwitchBuild >(build, " switch2" ) ? : return null ,
260260 singleStepSwitch = buildVar<SwitchBuild >(build, " switch3" ) ? : return null ,
261261 uartFifoModulo = positiveIntVar(build, " UART_FIFO_MODULO" ) ? : return null ,
@@ -352,7 +352,7 @@ data class StartRequest(
352352) : Request() {
353353 override suspend fun handle (processor : ProcessorAccess , rx : ByteReadChannel , tx : ByteWriteChannel ) = runOnMainThread {
354354 processor.singleStepSwitch.configure(singleStep)
355- processor.resetSwitch .configure(false )
355+ processor.powerSwitch .configure(true )
356356 SuccessResponse (" Processor started." )
357357 }
358358}
@@ -366,10 +366,10 @@ data class WaitRequest(
366366 override suspend fun handle (processor : ProcessorAccess , rx : ByteReadChannel , tx : ByteWriteChannel ): Response {
367367 while (true ) {
368368 delay(1000 / 60 ) // 1 tick
369- val (stopped , paused) = runOnMainThread {
370- processor.resetSwitch .enabled to processor.pauseSwitch.enabled
369+ val (running , paused) = runOnMainThread {
370+ processor.powerSwitch .enabled to processor.pauseSwitch.enabled
371371 }
372- if (this .stopped && stopped ) {
372+ if (this .stopped && ! running ) {
373373 return SuccessResponse (" Processor has stopped." )
374374 }
375375 if (this .paused && paused) {
@@ -405,7 +405,7 @@ data class SerialRequest(
405405 var overflowCount = 0
406406
407407 val fromUart = runOnMainThread {
408- if (stopOnHalt && processor.resetSwitch .enabled) {
408+ if (stopOnHalt && ! processor.powerSwitch .enabled) {
409409 throw RuntimeException (" Processor stopped!" )
410410 }
411411
@@ -443,7 +443,7 @@ data class SerialRequest(
443443@SerialName(" unpause" )
444444data object UnpauseRequest : Request () {
445445 override suspend fun handle (processor : ProcessorAccess , rx : ByteReadChannel , tx : ByteWriteChannel ) = runOnMainThread {
446- require(! processor.resetSwitch .enabled) { " Processor is not running!" }
446+ require(processor.powerSwitch .enabled) { " Processor is not running!" }
447447 processor.pauseSwitch.configure(false )
448448 SuccessResponse (" Processor unpaused." )
449449 }
@@ -453,7 +453,7 @@ data object UnpauseRequest : Request() {
453453@SerialName(" stop" )
454454data object StopRequest : Request () {
455455 override suspend fun handle (processor : ProcessorAccess , rx : ByteReadChannel , tx : ByteWriteChannel ) = runOnMainThread {
456- processor.resetSwitch .configure(true )
456+ processor.powerSwitch .configure(false )
457457 processor.pauseSwitch.configure(false )
458458 processor.singleStepSwitch.configure(false )
459459 SuccessResponse (" Processor stopped." )
@@ -465,7 +465,7 @@ data object StopRequest : Request() {
465465data object StatusRequest : Request () {
466466 override suspend fun handle (processor : ProcessorAccess , rx : ByteReadChannel , tx : ByteWriteChannel ) = runOnMainThread {
467467 StatusResponse (
468- running = ! processor.resetSwitch .enabled,
468+ running = processor.powerSwitch .enabled,
469469 paused = processor.pauseSwitch.enabled,
470470 errorOutput = processor.errorOutput.message?.toString() ? : " " ,
471471 pc = processor.build.executor.optionalVar(" pc" )?.numu(),
0 commit comments