神刀安全网

Paper processor

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 .

Regards

Saito Yutaka

email : melody.pea at gmail dot com

How to use

Download CPU(Paper_processor.pdf) and print .

Paper processor 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) .

Paper processor

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 .

Paper processor

Paper processor

Start the program . Put Address/Data bus on RAM like this . Start at Address 00(2) .

Paper processor

Fetch the instruction . Read data on address 00(2) .

Data is 00(2). This means increment register by one . So you add one register .

Paper processor

Next , increment program counter .

Paper processor

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 . 

Paper processor

Increment program counter .

Paper processor

Read data on address 10(2) . The data value is 00(2) .

CPU know a address to jump .

Paper processor

Up date program counter to 00(2) .

Paper processor

Put the address/data bus on address 00(2) . And fetch the data.

Paper processor

Execute increment register value .

Paper processor

Increment program counter . And fetch the data .

Status register is 0 . So Increment program counter again .

Paper processor

Fetch the data . The value is 00(2) . Update program counter to 00(2) .

Paper processor

Execute jump .

Paper processor

Fetch the data . And execute increment register .

Paper processor

Fetch the next data . Status register is still 0 .

Paper processor

Program counter will 00(2) again .

Paper processor

Increment register . But register value is 11(2) . CPU can’t store 100(2) because register can only store

2 bit value .

Paper processor

Update register value 0 . But actually right value is 100(2) . You found the over flow .

Set 1 to status register .

Paper processor

Fetch the next data . You don’t need jump because status register is 0 .

Paper processor

So you don’t need fetch the next address data . Update program counter to 11(2) .

Paper processor

Fetch the data . The data is 10(2)  . It means halt . Stop the CPU .

Paper processor

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Paper processor

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址