Fetch decode execute cycle game...

362 views
Skip to first unread message

Stuart Monks

unread,
May 1, 2014, 7:42:10 PM5/1/14
to cs-unplugg...@googlegroups.com
Hi,
 I just joined CS-unplugged so let me know if I am at all off base with my contributions.  I live in the USA and was disappointed to see that the computer science courses in our local high schools just jump into Java without much explanation and hence understanding of the underlying machine.  Not only does that cause problems later on but i think it misses out on the beauty and simplicity down at the lowest levels.  So last year I took a group of 13/14 year olds through the fetch decode execute cycle by developing a game where they got to experience the cycle and some of the possible optimizations.  No machines (other than an smartphone camera) are needed and only a little pre description to the students of the roles is required.  Below is a brief description.  If people are interested I can post more details including the example instruction set and step by step directions and possible extensions.

The game works for a group of 4 students.  Each takes a role within the machine and their task is to decode a set of instructions in order to make  food.  The food itself is irrelevant but it needs to be simple and involve at least one repetitive action such as mixing, chopping etc.  In the cases I have tried we made pancake batter or  pb&J sandwiches.  The roles are

1. Program counter.  responsible for advancing the instruction pointer, normally by +1 but when the loop is encountered this person must work out the instruction to return to.
2. The decoder.  This person has a cheat sheet with the instruction set on it and has to decode the instruction brought to them by the memory/instruction fetcher.
3. The memory/instruction fetcher.  This person is armed with a smartphone with a camera and is sent to the memory or instruction location by either the program counter or the decoder. The memory and instructions are posted at separate locations some distance from the rest of the group.  The fetcher must go to the right location, take a photo of the posted instruction and return to the rest of the group.
4. The ALU.  This is the person that executes the instruction.  They have some fundamental capabilities such as, mixing, pouring, cracking eggs, spreading jelly etc. They take their instructions from the decoder.  The ALU person also has local to them some storage registers (a bowl or two, or a jam jar etc) that are labelled with numbers.  these are at hand and quick to access for the ALU.

By devising a simple instruction for the task at hand such as get, add mix, test, jump to etc, you can quickly write a simple program to make sandwiches or batter.  By typing up the program and then cutting out each line of the program and pasting it on a board where each position has a memory address, and placing the board a short distance from the team, the action of fetching instructions from a location can be achieved using the smartphone camera.

The results I have seen are that the progress at first is slow.  The first two or three instructions take a bit of time to be processed but then the team "gets" the mechanism and starts to crank through the program.  When they reach the loop things are fine until they realize they are going round the same instructions again and again and the fetcher is running back and forth for the same instructions.  I found that if I ask the team then what would improve things they always ask if the fetcher could just grab all the instructions for the loop and bring them at once and so we have a discussion on caching.  If you were then to repeat the game but with multiple groups but ensure there is a bottle-neck to the instruction board where only one person at a time is allowed the students get to experience contention and congestion.

I have also taken the sandwich making scenario and used it to look at pipelining. (who do you make sandwiches for 100 people, then how do you make sandwiches and some hotdogs etc).

The instruction set does not have to be fancy and doesn't even have to be in binary.  Children have a natural affinity to decoding things.

Only after this game have I spent any time going through the details of the cycle for a real machine. I have animations posted on youtube for this.

So. if anyone is interested in more detail (including instruction set and sample program) please let me know.  If anyone has done something similar or different to attack the same knowledge area I'd love to hear that too.

Stuart


Mark

unread,
May 23, 2014, 9:45:41 PM5/23/14
to cs-unplugg...@googlegroups.com
Stuart,
   This sounds awesome. It would like to learn more.

You might be interested in CARDIAC, the cardboard computer:
It was made Bell, where students manually manipulate cardboard to simulate the functioning of a computer.

There is a google groups for it, here:
Reply all
Reply to author
Forward
0 new messages