How does an X-bit computer with 2-bit numbers work?

This is not the first time that a question has arisen, but today I played the old SNES game, when I thought about it again and wanted to find an answer from people who know more about it than I do.

Take Super Nintendo, for example. This is a 16-bit system. With 16 bits, you can count to 65536 or 2 ^ 16. So, how does the machine handle me, for example, with a result greater than 65536?

+6
source share
2 answers

This is actually a bit more complicated, but a simple explanation is that a 16-bit processor can perform operations with 16-bit numbers in one operation and deal with the large numbers that you need to split them. For example, to add two 32-bit numbers, you would add the least significant words in one operation, then add the most significant words, and then add any carry bits.

Obviously, this is much slower (3 teams instead of one), but if necessary, almost any operation can be performed. This is the reason that processors with larger words may be faster; they can perform larger operations with a single command instead of several instructions. From the point of view of programmers, the compiler will usually take care of this; you will never do it manually unless you write the assembly.

In reality, however, many processors have dedicated hardware for performing mathematical operations, so calling a 32-bit or 64-bit processor has more to do with memory addressing and register size.

+4
source

The real limitation of a processor with fewer bits is that it cannot address so much memory that 32 bits can only address 4 GB. As for mathematical operations, both 16-bit and 32-bit processors are equivalent to A FTTM (machine for processing the final tape) and, thus, have the same computing power. For example, java BigInteger may be as large as you want

0
source

Source: https://habr.com/ru/post/945850/


All Articles