Today, I was reading about the Thumb Instruction Set of ARM family. I landed into this line which made me quite curious – “All Thumb instructions are encoded into a 16-bit half-word format”.
We know of bits and bytes, even words. If we have half-words, there must be some history to it. First of all, word is (put loosely) just a fixed-sized piece of data handled as one unit by the processor. In 1970s, DEC came up with VAX which used 16-bits for these chunks. So, 16 bits became a word. They referred to 32 bits as longword. The x86 family offered three different word lengths (16, 32 and 64). They continued to designate word to 16 bits. The earlier documentation written prior to 1970s did not agree with a 16 bit word though. Microsoft’s Windows API refers 16 bits as WORD regardless of whether you use a 32 bit or a 64 bit processor where the word size changes accordingly. They call 32 bits as Double Word or DWORD and 64 bits as QWORD (quad word). By now, backword compatibility has become a huge issue. So, we stick with this terminology.
Well, ARM like me is quite different! For ARM, we have a 16-bit half-word!! Next time, if you get confused with WORD, at least know that it is not your fault.
Unfortuantely, a little bit of knowledge of our hardware and the associated computer organization is required for us to become good programmers. Yet, at universities, we jump into coding a little too early!
Beautiful computer science.