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?
Not really greatly researched, a quick search on x86 registers led me here, but yes:
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
This logic applies to most registers in IA32 (not all).
Are all the registers physically have the same size (say 32 bits)
I'm a digital IC designer, but I have no knowledge on x86 CPUs.
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
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'.