Close

Instruction sequencing

A project log for Kobold K2 - RISC TTL Computer

A 16 bit RISC computer with video display, from just a few TTL and memory chips. Online C compiler and simulator available.

roelhroelh 09/14/2019 at 20:321 Comment

[ edit: The addressing and sequencing of instructions as presented here is rather unusual. However, for the Kobold K2 this has now changed to a more usual system, so this log is now mainly for amusement.]

In the previous log I stated that the program counter uses the object model. A simple picture will make this clear:

This shows how the program counter points to a block of eight instructions (This could be a block of sixteen instructions, but for various reasons eight is used). We call these eight instruction positions 'slots'.

Every instruction is 16 bits wide.

All the instructions will be executed, and then the CPU will continue with a next block of instructions. How ?

Within every instruction, the lowest three bits contain the slot number of the following instruction that must be executed (indicated in RED). It acts as a kind of counter. In the seventh slot, the slot number of the following instruction is 0 again. But the instruction in that slot increments the PC, so  the CPU will continue with the next block of instructions. The PC-increment is just a regular CPU instruction. No extra hardware needed for that. (Note that the PC must be incremented by 2 each time, because instructions are at word addresses.)

This makes it easy to support immediate operands. The instruction that uses an immediate operand, specifies the PC as pointer and uses the slot number (here: 7)  as displacement:

Several instructions in the same block can have an immediate operand, as long as you use a different slot number for every immediate value.

Get used to all the tricks that can be done ! For instance, there is no need to put the instructions in sequence:

In this example, the first four instructions are placed in the first four slot numbers. But at instruction 3, the instruction tells us that the following instruction is in slot 7 ! 

So instruction number four is in slot 7. The following instructions are placed in preceding slots. The last one is placed in slot 4.

Actually, you can place instructions in any order that you want, as long as each instruction points to the next one. (But by convention, the first instruction is in slot 0.)

Discussions

creakingly wrote 09/22/2021 at 04:49 point

They have tried to explain this instruction sequencing in the form of the picture. It is really precise and easily understandable by the readers which companies are offering their work at https://www.bestassignmentservices.co.uk/best-essay-writing-services-uk/ site for students. I have gained complete knowledge about this sequencing through this blog.

  Are you sure? yes | no