-2
\$\begingroup\$

I don't have electrical background, but yesterday after watching some videos on youtube about old 8 bit computer, I have some question about how they work. 8 bit computer has 8 bit bus data which contain 4 opcode and 4 data. My question is, is it possible to jump to address > 15 ? Because it limited only 4 bit data which is 1111 = 15 (max)

\$\endgroup\$
1
\$\begingroup\$

There is no requirement that instructions be limited to a single word (of whatever bus width) in any computer architecture.

Pretty much any commercial 8-bit processor has instructions that are 1, 2 or 3 bytes long (sometimes even more), depending on what operands it requires. For example, an absolute jump instruction would typically have an 8-bit opcode and a 16-bit literal destination address, for a total of 3 bytes.

The CPU logic that fetches instructions from memory knows how long each instruction is (i.e., how many more bytes to fetch, if any) after looking at the opcode in the first byte.

\$\endgroup\$
  • \$\begingroup\$ how to transfer that 8 bit opcode, 16bit destination address with only 8 bit bus ? \$\endgroup\$ – Felix Angga Feb 10 '18 at 6:31
  • 1
    \$\begingroup\$ @FelixAngga, how to get 24 bits over a 8-bit bus? Sequentially, one byte after another. Technically, the bus can be only 1-bit wide... \$\endgroup\$ – Ale..chenski Feb 10 '18 at 6:54
  • \$\begingroup\$ hmm .. so it's using buffer to queue data ? \$\endgroup\$ – Felix Angga Feb 10 '18 at 7:08
  • \$\begingroup\$ In a manner of speaking. At a minimum, there is an 8-bit temporary holding register that holds the second byte of the instruction while the third byte is being fetched, after which the PC can be updated to complete the jump. \$\endgroup\$ – Dave Tweed Feb 10 '18 at 12:16
0
\$\begingroup\$

It depends entirely on the architecture. The video you watched was probably only for educational purposes and it might not allow for jumping to addresses >15.

In a typical processor, what happens is there are multiple jump opcodes. One jump opcode may allow for jumping forward or backwards only a certain range. In your example the jump range Would be encoded into the 4 bit data field. This is relative addressing, and the destination of the jump is relative to the current program counter.

Another opcode would be used for an absolute jump address. In this case the four data bits would contain the absolute address to jump to. This would only allow for jumping to within an address range of 16 bytes.

Opcode[3:0] address[3:0]

If your address range is larger, then the Byte following the opcode/data Byte is used to encode additional absolute jump destination addresses within a 12 bit address range like so:

Opcode[3:0] address[11:8]
address[7:0]

Such a two byte encoding scheme will require two cycles to execute compared to the one cycle for the relative jump mentioned above.

A third method would be register direct addressing. In this case, the jump destination address is stored into an ALU register. The jump opcode then specifies which register contains the destination address.

Opcode[3:0] registerID[3:0]

There are other ways to extend the range of jumps, these are just the most common. Again, I think the video you watched is only for educational purposes and don't does not describe a practical microprocessor architecture as the opcode field is usually much larger than 4 bits so as to realize a more usable and diverse instruction set.

\$\endgroup\$
  • \$\begingroup\$ what is the meaning of [3:0] on your post ? \$\endgroup\$ – Felix Angga Feb 10 '18 at 6:30
  • \$\begingroup\$ Opcode[3:0] is the representation of the opcode bits 3 down to 0. \$\endgroup\$ – TimB Feb 10 '18 at 22:18
0
\$\begingroup\$

At first it seems impossible to jump to address higher than 1111 as it is the highest possible number than fits into 4 bits storage. To reach farther out you need more bits, so you might move the opcode to another byte and thus free four additional bits giving you possibility to reach to 11111111 which is 255. But this you probably know.

One way of reaching higher addresses would be to use minimized 2-complement by dividing your 4 bits into 2 pairs, one for exponent and another for mantissa. Other pairs possible are 3+1 or 1+3. But then you will not be able to address some places as the total numner or possible addresses is still 16.

Next you might consider using other ways of representing numbers than the positional system.There are many.

And the most advanced would be to create a ternary computer just as Russians did in the fifties.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.