Level 3Computational efficiencyWork it out
What does a loop cost?
Use the same cycle costs as before (fetch and decode 5; then LDI/IN/OUT/jumps/HALT 1, LDA/STA 2, ADD/SUB/AND/OR/XOR 3).
With input 3 the program outputs 3, 2, 1. How many cycles does the whole run take, up to and including HALT?
New to this? Silicon Studio 14: Fetch, decode, execute
How results are computed: model assumptions.
IN
loop: JZ done
OUT
SUB one
JMP loop
done: HALT
one: DB 1