Question

Can a 16-bit machine perform operations on 64-bit data types?

I know that it can perform 32-bit multiplication using two registers, but do not have any idea about how it can handle 64-bit data?

Was it helpful?

Solution

At the register/machine-code level there is invariably a carry flag that indicates when an arithmetic carry (or borrow) has occurred. This can be used to perform arithmetic operations on an arbitrary number of machine words. It does not necessarily require additional registers since RAM may be used for intermediate storage.

The wider the data type in relation to the machine word, the more instructions are required to perform any particular operation. Performance may also be hit by the need to use RAM rather than registers, so architectures with small or non-orthogonal register sets may perform such operations even slower and require more instructions.

A high level language may provide direct support for such operations. The C language data type long long is typically 64 bit, though you would need to check whether your compiler supports it and what size it is in that implementation. If your compiler provides the C99 stdint.h header and that in turn includes the int64_t data type (and its variants), then the compiler is implicitly capable of generation code for 64 bit operations. Code size, memory usage, and execution time are likley increase of course.

In most C implementations the double data types is 64 bit, even on targets with no FPU.

OTHER TIPS

What exactly do you mean by "handle"?

Any Turing-complete machine can handle anything, so theoretically the answer to your question is yes. However, the question is how convenient or practical that is.

It seems unlikely that any 16-bit machine has any hardware support for 64-bit operations.

  • If the machine has no support for 64-bit types, it's possible to implement it (in assembly language, C, or whatever other language you use), e.g. using 4 16-bit hardware registers
  • The machine may have no support, but maybe someone has already written libraries that implement it (this was is the case with the old x86 systems, which had good libraries for 64-bit floating-point type double)
  • The machine may have some 64-bit capabilities: the 32-bit ARM has a command SMLALxy that multiplies 16-bit numbers and adds the sum to a 64-bit number
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top