Paper processor . What is fetch , decode , and execute ?
Hello everyone .
I wrote 2 bits CPU on a paper . You cam work this CPU without electricity . Just use scissors , pen and your hand .
It may be interesting more than work CPU on simulator on computer .
email : melody.pea at gmail dot com
How to use
Download CPU(Paper_processor.pdf) and print .
Cut paper Address/Data bus and register data values with the scissors .
Paper processor has 3 registers . Program counter and register and status register (over flow) .
Programming assembly code and assemble and write machine code on RAM .
Paper processor has an instruction set consisting of three instructions . So it is easy to assemble .
Start the program . Put Address/Data bus on RAM like this . Start at Address 00(2) .
Fetch the instruction . Read data on address 00(2) .
Data is 00(2). This means increment register by one . So you add one register .
Next , increment program counter .
Fetch the instruction . Read data on address 01(2) .
Data is 01(2). This means jump if not over flow . Status register is 0 . So CPU should jump to somewhere .
But CPU doesn’t know which address to jump .
Increment program counter .
Read data on address 10(2) . The data value is 00(2) .
CPU know a address to jump .
Up date program counter to 00(2) .
Put the address/data bus on address 00(2) . And fetch the data.
Execute increment register value .
Increment program counter . And fetch the data .
Status register is 0 . So Increment program counter again .
Fetch the data . The value is 00(2) . Update program counter to 00(2) .
Execute jump .
Fetch the data . And execute increment register .
Fetch the next data . Status register is still 0 .
Program counter will 00(2) again .
Increment register . But register value is 11(2) . CPU can’t store 100(2) because register can only store
2 bit value .
Update register value 0 . But actually right value is 100(2) . You found the over flow .
Set 1 to status register .
Fetch the next data . You don’t need jump because status register is 0 .
So you don’t need fetch the next address data . Update program counter to 11(2) .
Fetch the data . The data is 10(2) . It means halt . Stop the CPU .