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?

  • these are basic question regarding CPU building and not related to 64 bit (the same questions could be asked for 8 bit architecture). in a nutshell, op codes and addresses are in different 64bit pieces, all addresses go to multiples of 64 bit (not 7 bit); and each ALU has a carryover bit that gets handled in the next op code hopefully. There are book written about all this, so no way to explain it quickly. – Aganju Dec 22 '15 at 2:48
  • 3
    Your questions are not really 64-bit specific; you could have the same questions with a 32 or even 16-bit processor. Your questions are essentially basic computer design, but you've dressed them up with 64-bit pseudo-complexity. – sawdust Dec 22 '15 at 2:49
  • Related: superuser.com/questions/698312/… – Mokubai Dec 22 '15 at 7:38
  • Are these homework questions? You mention opcodes, but seem oblivious to the different types of instructions that would access memory. You're aware of the existence of the ALU, yet you don't know about the carry and overflow flags. – sawdust Dec 22 '15 at 9:00
  • this is slightly related cs.stackexchange.com/questions/48425/… – barlop Dec 22 '15 at 11:42
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.

| improve this answer | |

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.