Stories
Slash Boxes
Comments

SoylentNews is people

posted by janrinok on Monday May 22, @05:31PM   Printer-friendly

https://www.devever.net/~hl/regmap

If you've ever had to write a program which interfaces directly with hardware — perhaps while writing a program for an MCU or embedded system or a kernel driver — you may have noticed a few common patterns in register map behaviour and design. I'm not sure anyone has ever really collected them together, so I decided to make a list of all the ones I can think of.


Original Submission

 
This discussion was created by janrinok (52) for logged-in users only. Log in and try again!
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 4, Informative) by sjames on Monday May 22, @11:15PM (1 child)

    by sjames (2882) on Monday May 22, @11:15PM (#1307502) Journal

    In addition, a zero register is a good way to initialize an accumulator without having an extra instruction. Writing to the zero register is a cheap to implement NOP. Add that to the inexpensive addressing flexibility and you get a lot of bang for the buck from the zero register.

    Starting Score:    1  point
    Moderation   +2  
       Insightful=1, Informative=1, Total=2
    Extra 'Informative' Modifier   0  
    Karma-Bonus Modifier   +1  

    Total Score:   4  
  • (Score: 3, Informative) by owl on Tuesday May 23, @02:17AM

    by owl (15206) Subscriber Badge on Tuesday May 23, @02:17AM (#1307527)

    Now that you mention it, I think the Alpha's "nop" instruction was actually something like

    add r0,r0,r0

    (assuming r0 was the "always zero" register), that would add zero to zero and store the answer in the register that was always zero. The result, a "NOP" instruction, without having to explicitly have an actual "NOP" instruction built into the hardware.