diff options
| author | Louis Burda <quent.burda@gmail.com> | 2023-12-25 01:56:01 +0100 |
|---|---|---|
| committer | Louis Burda <quent.burda@gmail.com> | 2023-12-25 01:56:01 +0100 |
| commit | f2ada47e6be185cc31c475c996c4ccf6735f7bb0 (patch) | |
| tree | f39aa55ab0585c376d608dad922efe71f9d640a2 /tpu.c | |
| parent | 5ff5bb25cc864e7fa06aa8fed0c4ec92e99f103a (diff) | |
| download | tis100-f2ada47e6be185cc31c475c996c4ccf6735f7bb0.tar.gz tis100-f2ada47e6be185cc31c475c996c4ccf6735f7bb0.zip | |
fixup! Make mode/state behaviour compatible with game
Diffstat (limited to 'tpu.c')
| -rw-r--r-- | tpu.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -386,6 +386,8 @@ tpu_port_write(struct tpu *tpu, enum tpu_port_dir dir, int lit) port->writing = true; port->out = lit; + /* port writing never succeeds right away, only after + * value was read in tpu_update is tpu->idle/mode fixed up */ return true; } @@ -477,10 +479,12 @@ tpu_exec(struct tpu *tpu, struct tpu_inst *inst) return MODE_READ; } } - /* tpu->idle/mode fixed up via tpu->reset_in if value is read */ - if (!tpu_exec_put(tpu, &inst->ops[1], lit)) + if (!tpu_exec_put(tpu, &inst->ops[1], lit)) { tpu->idle = true; - return MODE_WRITE; + return MODE_WRITE; + } + tpu->pc += 1; + return MODE_RUN; case INST_SWP: lit = tpu->acc; tpu->acc = tpu->bak; @@ -751,7 +755,7 @@ tis_gen_stats(struct tis *tis) int i; stats.steps = tis->steps; - stats.blocks = 0; + stats.nodes = 0; stats.insts = 0; stats.idle = 0; @@ -763,7 +767,7 @@ tis_gen_stats(struct tis *tis) stats.insts += link->tpu->inst_cnt; idle_steps += link->tpu->idle_steps; all_steps += link->tpu->steps; - stats.blocks += (link->tpu->inst_cnt > 0); + stats.nodes += (link->tpu->inst_cnt > 0); } } |
