Physical size of the registers for x86

by No Name QA   Last Updated August 01, 2020 11:25 AM - source

We have an 8-bit register called CL on x86 CPU architecture.

Does it mean that physically it contain 32 bits, but we have access only to lower 8 bits? Or does this register physically have only 8 bits?

So in general my question is: Are all the registers physically have the same size (say 32 bits) or not?



Answers 2


Not really greatly researched, a quick search on x86 registers led me here, but yes:

The L in CL is for Lower, its the lower byte of the 16-bit counter register CX, which itself is the lower half of the 32-bit ECX register.

This logic applies to most registers in IA32 (not all).

Are all the registers physically have the same size (say 32 bits)

no.

Marcus Müller
Marcus Müller
May 13, 2020 08:59 AM

I'm a digital IC designer, but I have no knowledge on x86 CPUs.

I think CL/CX/ECX are just software terms which are used to refer to different portion of a hardware entity (let's name it 'REG'). The 'REG' with certain bit width is the real memory device (probably flip-flops) inside the CPU circuit which is addressible. Why is CL for narrower 'REG' introduced? Perhaps shorter instruction is generated, hence optimized assembly code can be achieved. Or there're other reasons, I don't know. Different assembly code for CL/CX/ECX can lead to assertion of different control signals after the decode block of CPU decodes it. Those control signals plus the address of the entire 'REG' allows you to access specific portion of 'REG'.

Jimmy Zhu
Jimmy Zhu
August 01, 2020 10:42 AM

Related Questions



Implementing divisor register for a ripple counter?

Updated November 19, 2018 21:25 PM

Confusion about ADR in ARM (assembly code)

Updated February 12, 2017 14:10 PM