Instruction_1 of the following program rotates the bits (0010) of latch 0001 two spaces to the left (for 1000) and copies all four rotated bits to latch 0010. Notice that, because latch 0110 of instruction_1 holds 1111, all four bits are copied to. Also notice that, because latch 0111 has 10 in the rightmost two bits, the from data is rotated two bits to the left.
Before Rotate 0010 Two Bits Left for 1000
latch bit address values 0000 0100 address of instruction 0001 0010 from data 0010 0000 to data 0011 0000 instruction_1 0100 0001 from address 0101 0010 to address 0110 1111 'to' bits to copy to 0111 1010 instr.addr.and rot.amount instruction_2 1000 0000 1001 0000 1010 0000 1011 1000 1100 0000 1101 0000 1110 0000 1111 0000After instruction_1 is executed, the memory has the following values. Again, the right two bits in latch 0000 do not affect what instruction is executed next. The left two bits of 1010 (in latch 0000) are 10, so the next instruction to be executed will be instruction_2, in latches 1000, 1001, 1010, and 1011
After Rotate 0010 Two Bits Left for 1000
latch bit address values 0000 1010 <------| address of instruction 0001 0010 ---| | from data 0010 1000 <--| | to data 0011 0000 | instruction_1 0100 0001 | from address 0101 0010 | to address 0110 1111 | 'to' bits to copy to 0111 1010 -------| instr.addr.and rot.amount instruction_2 1000 0000 1001 0000 1010 0000 1011 1000 1100 0000 1101 0000 1110 0000 1111 0000
Instruction_1 of the following program rotates the bits (0010) of latch 0001 three spaces to the left (for 0001) and copies all four rotated bits to latch 0010. Notice that, because latch 0110 of instruction_1 holds 1111, all four bits are copied to. Also notice that, because latch 0111 has 11 in the rightmost two bits, the from data is rotated three bits to the left. Notice also that rotating three bits to the left is the same as rotating one bit to the right.
Before Rotate 0010 Three Bits Left for 0001
latch bit address values 0000 0100 address of instruction 0001 0010 from data 0010 0000 to data 0011 0000 instruction_1 0100 0001 from address 0101 0010 to address 0110 1111 'to' bits to copy to 0111 1011 instr.addr.and rot.amount instruction_2 1000 0000 1001 0000 1010 0000 1011 1000 1100 0000 1101 0000 1110 0000 1111 0000After instruction_1 is executed, the memory has the following values.
After Rotate 0010 Three Bits Left for 0001
latch bit address values 0000 1011 <------| address of instruction 0001 0010 ---| | from data 0010 0001 <--| | to data 0011 0000 | instruction_1 0100 0001 | from address 0101 0010 | to address 0110 1111 | 'to' bits to copy to 0111 1011 -------| instr.addr.and rot.amount instruction_2 1000 0000 1001 0000 1010 0000 1011 1000 1100 0000 1101 0000 1110 0000 1111 0000
The right two bits of the last word (four bits here) of an instruction indicate how many bits to rotate to the left according to the following table:
rotate bit left values amount 00 0 01 1 10 2 11 3If the rightmost bit value is 1, then there is 1 bit of rotation left. If the left bit value is 1, then there is an additional two bits of rotation left. The following table shows how rotation works with the four bits of a word labeled 'A,' 'B,' 'C,' and 'D.'
rotate rotate rotate bit four left right values bits amount amount 00 ABCD 0 0 01 BCDA 1 3 10 CDAB 2 2 11 DABC 3 1Notice again that rotating 3 bits left is the same as rotating 1 bit right. Similarly, 1 bit left is 3 bits right and 2 bits left is 2 bits right.
Page 16
Page 15 . . . Page 1 . . . Page 17