3

I have a question about the processor architecture of 32 bit and 64 bit systems.

When you work with a 64 bit system, I suppose it means you have a 64 bit wide addressbus of byte-addressable memory and 64 bit wide registers in the CPU itself.

One of the registers is an instruction register that holds the current instruction that is executed. This register is also 64 bit wide.

My questions are

How is it possible that an instruction of 64 bit wide can contain a reference to an address of 64 bit to load it into a register of the CPU? The instruction register is only 64 bit wide so there will be no place for an opcode anymore?

Also, when the memory address refers to a byte of memory (maximum integer of 2^8 - 1), how is it possible to express 64 bit integers then?

And what does a ALU do when he adds up 2 64bit integers with a result that can't be expressed in a 64 bit integer?

1 Answers1

2

How is it possible that an instruction of 64 bit wide can contain a reference to an address of 64 bit to load it into a register of the CPU?

When I did assembly programming, typically an instruction would go in separate memory (a different register) than the register that would contain other data, like a memory address.

The instruction register is only 64 bit wide so there will be no place for an opcode anymore?

Typically, a full Assembly instruction looks something like: "ADD AX,BX". (The details can vary based on which assembler is being used.) In this case, the CPU would then take the value of the AX register, add it to the value of the BX register, and then store the results. For instance, if AX stored 2, and BX stored 7, then the result may have AX store 9. (That's 16-bit: For 64-bit, you may be using RAX instead of just AX.)

Also, when the memory address refers to a byte of memory (maximum integer of 2^8 - 1), how is it possible to express 64 bit integers then?

A memory address, like a physical address where a house is at, just refers to a location of memory. A 64 bit integer will not be stored entirely in 1 byte; that would take 8 bytes.

And what does a ALU do when he adds up 2 64bit integers with a result that can't be expressed in a 64 bit integer?

It just stores the results that it can within the 64 bits that it finds available. However, it also flips the "overflow" flag. A programmer can check if the "overflow" flag was flipped, and realize that the results exceeded 64 bits, and therefore the results are not entirely stored in the register.

grawity
  • 501,077
TOOGAM
  • 16,486