data transfer - What's the difference between a hardware register and a memory-mapped register?

08
2014-07
  • Questioner

    This has been puzzling, so I'll lay it all out here. Apparently, through MMIO, you can access external devices using a certain memory-mapped address, which would then be re-routed to that device itself(through a write, command packet, etc.). However, I've been hearing mixed descriptions of both hardware registers(e.g. like a CPU/GPU register, or even sound chips), and memory-mapped registers used interchangeably. Are they the same thing?

    When you say a "memory-mapped register", aren't you referring to the address from which a data byte is re-routed to a specific address inside that device(e.g. theoretical: GPU's 0x500 address is for register TEXTURE_BUFFER). However, a memory-mapped device can't map a physical register inside RAM.

    So basically, what is the difference between a memory-mapped register and just a hardware register?

  • Answers
  • barlop

    My educated guess based on something Computer science lecturer told us from a basic book but it matches what that wikipedia page on MMIO says. CPU doesn't know what device it is writing to. As far as it is concerned it may as well all be RAM-memory. Some devices use a particular RAM-memory location. I suppose that'd be what hardware mapped means. But there can be a memory location in the hardware device itself, there probably must be in fact.. to transfer the data to. The CPU doesn't have to wait it writes to the location in RAM which is mapped to a register on the devie. A register is a memory location in CPU or in a hardware device. not in ram.

    To be more specific to your question. A register is in CPU or in a hardware peripheral-device. Not in RAM/main memory. The location in RAM/main memory, is just called a location never a register. A location in CPU or a peripheral device isn't generally called a location or memory location, and is always called a register, that's its special and proper name. If a register is mapped to memory as no doubt many hardware peripheral device registers are, then i'd be pretty sure that is what is meant by a memory-mapped register.

    So, If a hardware register isn't memory mapped.. e.g. if the CPU writes to it directly then it's not memory mapped. It seems from that wikipedia article that maybe if those addresses are located in a special space and they require special pins or a special bus then the locations may be in memory, but not MMIO, not memory mapped.

    Looking at that wikipedia page.. PMIO i.e. considered to not be memory mapped. Is when CPU registers are not mapped to regular memory locationss, but to a special address space. So rather than a general purpose CPU register that can write to a device or memory, depending on what address is put on the address bus. With PMIO, (i.e. not a memory mapped register), the register is mapped to a device specific memory location which I guess they are calling a port.

  • Daniel R Hicks

    Memory-mapped I/O and memory-mapped registers are not the same thing and are not that closely related.

    Memory-mapped I/O was used, eg, in early PCs, where part of the RAM address space was mapped to the display buffer. (And in some products regular RAM was actually used for the display buffer, vs having the buffer on the display adapter card.) In other cases a hardware device such as a disk drive controller would use memory-mapped addressing for setting/reading its control registers. (And I would guess that modern graphics cards still map display memory into the graphics processor's address space, though I don't know this to be a fact.)

    "Memory-mapped registers" can mean several things. One would be the above example of the disk drive controller with memory-mapped control registers. Another, entirely different case would be a processor that actually has its registers in RAM. This was fairly common with early (50s through early 70s) processors, since it reduced parts count considerably, and it also permitted some "clever" programming practices. In a few cases the processor was available in two models, one with memory-mapped registers and the other with (faster) "hardware" registers.

    And in some cases it was ambiguous as to what was a register and what wasn't, as in the Burroughs "stack" machines, where a "stack" was used in place of standard registers (with, IIRC, several different schemes for "shadowing" the registers in RAM).

  • ultrasawblade

    Memory mapped hardware registers are accessed like RAM.

    Hardware registers do not have to be memory mapped.

    x86 provides two address spaces in which two separate groups of instructions are used to read and write - the first is RAM or memory space (all the MOV instructions), the second is I/O space (using the IN and OUT instructions). On x86, hardware registers may be mapped to this space.

    You also may need to go through a level of indirection to really reach a hardware register. A device may only expose a "port" in memory or I/O space. You then need to write a register number to the address, and then the data you want to actually write to another address. The write then occurs. The old 8563 VDC in the Commodore 128 worked like this. The CMOS RAM and some PCI registers also work like this.

    CPU hardware registers are of course not memory mapped, that is another example. Modern CPU's have "model specific registers" (MSRs) and these are read/written using their own instructions (RDMSR, WRMSR). Other CPU registers have their own instruction (LGDT, MOV xx, CR2, etc.)


  • Related Question

    cpu - What's the main difference between Intel processor generations?
  • Diogo

    What are the main differences between each processor generation of Intel processors/chipsets? Is there a performance difference?

    I've already seen processors from first to sixth generation, however I don't know/understand the exact differences.


  • Related Answers
  • A Dwarf

    The term Generation is loosely applied to Intel processors to mean new and significant developments in processor architecture or functions.

    • A second generation Core processor is the family of processors known as Sandy Bridge, which among other things introduced shared cache and placed the memory controller, graphics and CPU on the same die. The first generation was composed the Core i3, i5 and i7 processors launched early last year.

    • The term can also be seen sometimes applied to processor families. The Core family of processors can sometimes be talked about as having had 3 generations (Lyndfield, Clarkdale and Sandy Bridge). But some processors like the i7, had more or different families (the Bloomfield and Gulftown). Example.

    • It can also be used to name different factory models within a similar architecture. Again, sticking to Core processors, The Core 2 Duo, Quad and Extreme being mentioned as one generation different than the i3, i5 and i7, while the sandy Bridge being the 3rd generation of Core processors. Example

    All in all the term is not officially connoted to the media. Intel does seem to favor the term as meaning significant architecture and factory processing changes within the same family of processors. And they are ultimately the ones deciding what is named 2nd, 3rd, 4th and so on generation. They do it often. But the term has come to mean other things too, since Intel itself has never tried to enforce it. Hence being a term that can have both official and loose connotations, depending on the context.

  • KCotreau

    This question is very broad, but the often the biggest difference is that they have been able to miniaturize the transistors, allowing for less energy usage, and less heat.

    Of course, they can also change features, but this will vary with every comparison you could put forward. Here is a comparison of the i3:

    Intel introduced the 1st generation Core i3 processors in 2010 and the 2nd generation Core i3 processors in 2011. The 2nd generation Core i3 processors are built on the Intel’s Sandy Bridge architecture, which is 32nm microarchitecture, while 1st generation Core i3 processors were built on Intel’s Nehalem architecture. Additionally, 2nd generation Core i3 processors include new features for improving the graphics performance of the processors such as Intel Quick Sync Video, Intel InTru 3D / Clear Video HD and WiDi 2.0 that were not available in 1st generation Core i3 processors.

    http://rapidhow.com/2011/06/12/intel-core-i3-vs-2nd-generation-intel-core-i3-processors/

  • Michael Borgwardt

    Wikipedia has a timeline of "generations", CPU models and new features introduced in them. But note that its generation count already disagrees with yours (it goes up to 9) and doesn't correlate with any clear technical property such as bus size or CMOS process size.

    IMO the word "generation" as applied to CPUs is poorly defined and marketing driven - just a fancy way to say "this isn't just a new model, it's fundamentally better, so you must buy it!"

  • siddhant

    Suppose 2nd generation is first step of intel,then 3rd generation will be the improved (fixes all bugs,errors, graphics improvement,clock speed improvement,and the overall processing speed improvement.)

  • tim

    the progressions from generations by my thought are just the difference in architecture.. bigger the architecture, higher the battery consumption and vice a versa. this could be a factor that could influence your decision in buying a laptop/PC. as would the clock speed of the processor, size of cache and no of cores the processor has..

    My question would be whether to go for a Core i5 2nd gen or a core i3 3rd gen ignoring personal utility and factoring in cost ( a core i5 is on an avg abt 80 -100$ more than an i3)??

  • Louis

    Intel's processors have a Tick-Tock cycle.

    That is, processors released during a tock will have enough notably different design features from the previous tick to be considered a new microarchitecture. Those released during the tick are generally the same tock design but having undergone a die shrink, with some minor features added.