Part Number: MSP430FR5949
Hi,
I had the following customer question:
How is a 20-bit value stored in FRAM memory... Does it require 3 bytes or 4 bytes of memory to hold a single 20-bit value? Can you pack 20-bit values end to end or are they padded somehow with 1’s or 0’s?
And how is that memory affected by an instruction for example like an increment or decrement when the value is a 20-bit value, such as decx.A? What happens to the bits that are on either side of the 20-bit value. Or for that matter, if you copy a 20-bit value into an address location, will it overwrite data that is already there, but outside of the 20-bit range?
I dove into the reference manual and saw that we only have hardware addressing for 8 and 16 bit data, so no 'bit packing' like you can do on some ARM's.
However I got stumped on the 20 bit data and how it is handled. In the instruction set, I see several instructions have provisions for bits 19:16. So I thought I would ask rather than shoot from the hip on how adding and subtracting would be handled on the 430 core. Can the ALU handle a 20 bit result and how is the result stored?
When working with 20 bit values, it is advantageous to do math on 3 8 bit values and take the speed hit, or 2 16 bit values and waste the memory? Or is it an "it depends" question based on speed/size tradeoffs?
By the way, the customer codes in Assembly so he cares about the nuances of how the bytes are stored and added.
Thanks! Blake