[Libre-soc-dev] clamping/saturation semantics
cand at gmx.com
Sat Dec 12 16:33:57 GMT 2020
On Sat, 12 Dec 2020 10:53:34 +0000
Luke Kenneth Casson Leighton <lkcl at lkcl.net> wrote:
> also should op be always done at src width?
> in SV spec it states ops to be done at dest width. clearly not for
> sat ops. which has me wondering if all ops should be done at
> including FP.
All ops should be done "as if" they were done at srcwidth. This means
all results will be correct, but the hw can optimize and go faster in
Ex: u16+u16=u8 can be done at 8-bit width and the result is still
But s16-s16=s8 cannot. Consider 1-256 - if that op was done at 8-bit
width, it would become 1-0=1. When the correct result is -255 (0xfeff),
which then gets chopped preserving sign to -1 (0xff).
More information about the Libre-soc-dev