Scaled 14-bit word for 8-bit word

I am working on a project where I tried a signal from an ADC that represents values ​​as 14-bit words. I need to scale the values ​​to 8 bit words. What a good way to do this in general. By the way, I am using FPGA, so I would like to do it in "hardware" and not in software solution. Also, if you're curious, the event chain would be: analog signal sample, represent an approximate value with a 14-bit word, scale a 14-bit word to an 8-bit word, send an 8-bit word from UART to PC COM1.

I've never done this before. I assumed you were using quantization levels, but I'm not sure how efficient the circuit would be for this operation. Any help would be greatly appreciated.



source to share

3 answers

You just need to add and shift:

val_8 = (val_14 + 32) >> 6;


( + 32

you need to get the correct rounding - you can omit it, but if you do this you get more truncation noise).



I think you just drop six bits at the lowest resolution and call it okay, right? But I might not fully understand the statement of the problem.



Paul's algorithm is correct, but you will need some bounds checks.

assign val_8 = (&val_14[13:5]) ?  //Make sure your sum won't overflow
                         8'hFF :  //Assign all 1 if it will
                         val_14[13:6] + val_14[5];




All Articles