INSTRUCTIONS

The next most important part of a computer, after memory, is the processor. A processor changes the values in memory as instructed by instructions stored in memory. An instruction is a group of bits (loop values) in memory that tell the processor to do something. A group of instructions that instruct the processor to do some task is called a program.

The simple kind of processor described in this book has only one type of instruction, but that instruction is sufficient to do anything, as will be seen. The instruction is 'copy' (and 'go to'). Each instruction simply copies some bits of data from somewhere in one latch in memory to somewhere else in another latch in memory. The instruction indicates:

1. which latch to copy data (data is bit (loop) values) from
2. which latch to copy data to
3. which bits to change in the copied-to latch
4. how much to rotate the 'from' data before copying some of its bits to the 'to' data latch
5. which latches to get the next instruction from.

In the computer considered here, the number of address bits is the same as the number of data bits.


The explanation of the following example will not be clear at first, but just read through it. Then reread it. It will be clear later.

Consider a four-address-bit, four-data-bit memory with the values (in loops) below:

Example Program

             latch  bit
           address  values
              0000 0100 address of instruction
              0001 0001 value of a
              0010 0001 not 0 = 1
              0011 0000 not 1 = 0
instruction_1 0100 0001 from address 
              0101 1000 to address
              0110 0001 'to' bits to change
              0111 1000 instr.addr.and rot.amount
instruction_2 1000 0010 from address
              1001 0001 to address
              1010 0001 'to' bits to change
              1011 1100 instr.addr.and rot.amount
instruction_3 1100 0000 from address
              1101 0000 to address
              1110 0000 'to' bits to change
              1111 1100  instr.addr.and rot.amount

Only the 1's and 0's are part of the program. The rest is just comments for a person. The latch addresses are just where the program is stored. The bit values are the program.

'Instr.addr.and rot.amount' is short for 'next instruction's address and rotate amount.'

Latch 0000 holds the value 0100 so that the first instruction is in latches 0100, 0101, 0110, and 0111, and is labeled 'instruction_1' in the program. Latch 0000 is special and always holds the address of the next instruction to be executed.

The first word of instruction_1 is in latch 0100 and is 0001. That means that data (bit values) is copied from latch 0001 in memory.

The second word of instuction_1 is in latch 0101 and is 1000 and indicates that the data will be copied to latch 1000.

The third word of instruction_1 is in latch 0110 and is 0001 and indicates that only the rightmost bit, and not the three leftmost bits, of latch 1000 will be changed because only the rightmost bit of 0001 is 1.

The rightmost two bits of latch 0111 are 00 and indicate that the data in latch 0001 will not be rotated at all when data is copied to latch 1000.

The leftmost two bits of latch 0111 are 10 and indicate that the next instruction will be in latches 1000, 1001, 1010, and 1011. That is, instruction_2 will be executed next.


After instruction_1 is executed, the memory has the following bit values.

             latch  bit
           address  values
              0000 1000 <-----| address of instruction
              0001 0001 ---|  | value of a
              0010 0001    |  | not 0 = 1
              0011 0000    |  | not 1 = 0
instruction_1 0100 0001    |  | from address
              0101 1000    |  | to address
              0110 0001    |  | 'to' bits to change
              0111 1000 ---+--| instr.addr.and rot.amount
instruction_2 1000 0011 <--|    from address
              1001 0001         to address
              1010 0001         'to' bits to change
              1011 1100         instr.addr.and rot.amount
instruction_3 1100 0000         from address
              1101 0000         to address
              1110 0000         'to' bits to change
              1111 1100         instr.addr.and rot.amount

The underlined loop values (bits) were copied to when instruction_1 was executed. The italics show from where data was copied. The arrows show how data was copied. The rightmost bit of latch 0001 has been copied to the rightmost bit of latch 1000. Also, all bits of latch 0111 (that is, 1000) have been copied to latch 0000 indicating that the next instruction will be in latches 1000, 1001, 1010, and 1011 (instruction_2). That is, after the first instruction, instruction_1, is executed, latch 0000 has value 1000.

The leftmost two bits of latch 0000 are 10, so the instruction executed next is instruction_2, in latches 1000, 1001, 1010, and 1011.

1. Latch 1000 holds 0011, so data is copied from latch 0011.
2. Latch 1001 holds 0001, so data is copied to latch 0001.
3. Latch 1010 holds 0001, so only the rightmost bit of the 'to latch,' latch 0001, is copied to.
4. Latch 1011 holds 1100. The rightmost two bits of 1100 are 00 so the data copied from is not rotated at all. The leftmost two bits of 1100 are 11, so the next instruction to be executed will be in latches 1100, 1101, 1110, and 1111 (instruction_3).


Page 12

Page 11 . . . Page 1 . . . Page 13