I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register?
I've heard the terminologies: register, hardware register, program register,register file.
What's the difference between all these? And in assebmly, what is the type of the EAX register? Program register?
a register is a small bit of memory that sits inside the CPU. and is used by assembly language to perform various tasks.
could it be that by program register you mean program counter?
A register is a storage area inside the CPU. Here are some definitions:
Well, you have general purpose registers, then you have registers which have special usage (for example, the program counter registers), and you have various others (memory/segment registers, SSE).
EAX, EBX, etc. are the standard general purpose registers. You can use them for whatever you want. Usually, the return value is supposed to be put into EAX, but that's it basically. Then you have the stack pointer EBP, which points to the beginning of your stack. Finally, you have to program counter, which points to the current instruction, EIP. On x86, there are some special cases, where two registers get fused when doing 64-bit integer computations. More special cases exist for the string instructions. If you are about to learn assembly, the easiest would be to start with a PowerPC, which has more registers, and you're free to use all of them without restrictions.
All of these registers are of course hardware registers, that is, their physically built into your CPU ;) The place where they are is called a register file.
The other type of registers you can see is if you have a virtual machine which uses registers (Parrot), you get "virtual registers", which are later assigned to real registers. This is similar to what you can do when writing a compiler yourself, you basically assume an unlimited amount of registers (that is, you generate a new one on each usage), and do the transformation to real registers in a different phase (register allocation).
A "hardware register" might also refer to a location inside some hardware device. For example, a UART (COM port) looks like a D-shaped connector with 9 or 25 pins from outside the cabinet, but to the device driver it looks like several configuration registers, a status register, and data registers holding the next character to send and the last character received. (I've left out a lot of detail there.)
In the x86 architecture those registers are usually located in a special physical address space that is accessed with I/O instructions. In other platforms, it is common for hardware registers to be mapped to some corner of the normal memory space. In either case, one of the important roles of an operating system and its device drivers is to prevent application code from needing to know the details of where the hardware registers are located and what they mean.
In some kinds of hardware devices, the distinction between memory and hardware registers is less clear. For instance, your video adapter contains a block of memory known as the frame buffer that holds the color and brightness values for each individual pixel. Is that memory a large hardware register or is it just a buffer that has an interesting side effect?
A register is the most basic data storage device. Now these are the main differences.
A register file is generally a large collection of registers organised in such a way so that they are used for computations. In a modern processor, all computations are performed between values stored in several registers in a register file.
A hardware register generally refers to registers that store configuration and status information. This could be for the processor or some external hardware I/O device.
A programme register may refer to the programme counter, a special register that stores the memory location of the current instruction being executed by the processor.