Forum Discussion
Altera_Forum
Honored Contributor
12 years ago --- Quote Start --- i dont konw why the designer do this: avSigCReg(0) <= sigCReg(13) & sigCReg(13) & sigCReg(13) & sigCReg(13) & sigCReg; avSigCReg is is array (0 to 9) of signed(17 downto 0), I think this code is calculate the average value of 10 signal . --- Quote End --- The common arithmetic average of N samples is calculated by summing the samples and then dividing by N. Since division by a number which is not power of 2 is resource consuming, you can avoid it by discarding the N factor which is actually not relevant since it's simply a constant multiplier. The multiple & sigCReg(13) simply serves for the purpose of sign extending the 14 bit ADC sample to the 18 bit wide sum.