As a new Assembler programmer with a couple years under my belt now here at NESI, I’ve recently come across some instructions that have really made me think. In a module I was working on, I needed to use floating point, grande and lots of shift instructions to accomplish a conversion. Now, for all you experienced Assembler addicts out there, I’m sure this doesn’t sound very exciting or challenging. But for me, the combination of these instructions and the precision involved in the math was quite tricky. It was my first in-depth experience coding with floating point and I wouldn’t necessarily use the word “painful”, but it was somewhat agonizing! The instructions I ended up using were:
- PACK, CVBG, CVDG
- STD, STG, LD, LG
- MDR, DDR, SLLG, SRLG, ALG
Of course, it’s easy to read about them in the manuals and get a pretty good idea on what they do. But to know them well enough to use efficiently and correctly in a program is quite another thing. For me, it was a lot of trial and error, and looking at examples in other modules…plus, it helps to have an office in a hallway filled with the smartest Assembler programmers I know! Once I wrote up a chunk of code that I thought would at least somewhat do what I was trying to accomplish, I would run a test that put me into XDC (not a plug, I really do use and love XDC!). While in XDC, I could see exactly what each instruction was doing and what was going on in all the registers (floating point regs too) – so I could see my number crunching in action. This made it a lot easier to see when/where I was using the incorrect instruction (and once in a while, correct instructions!). Another code change and test, another step closer to coding the correct sequence of instructions I needed.
I don’t want to discourage any new programmers out there because I did come out on top and accomplish the enhancement. And now that I’ve done the dirty work to really learn those instructions, I definitely feel like a more knowledgeable developer (although it might be a case of “the more I learn, the less I know!”).
Here’s wishing all my readers a wonderful and safe holiday season and a happy new year!
Kristine