|Re: [hatari-devel] Use correct white noise|
[ Thread Index |
| More lists.tuxfamily.org/hatari-devel Archives
On Friday 21 September 2012 15:51, Nicolas Pomarède wrote:
> patch is now applied with the 17 stage LFSR (17,14)
> > I did some research and found:
> > (1)
> > Only one reference to the pseudo-random noise in the YM2149.
> > Someone associated with MAME originally claimed the LFSR is
> > 17 bits with taps at bits 17 and 15... MAME was later changed
> > to a LFSR with taps at bits 17 and 14. I found an open source
> > VHDL project that uses taps at bits 17 and 15 (so does Hatari),
> > the VHDL code should be Corrected And Optimized. See
> > http://www.fpgaarcade.com/resources/ym2149.zip
> I read the VHDL sources of this project too some times ago. My feeling
> is that on some some precise behaviours and very rare cases (ym2149,
> shifter emulation, wd1772 timings, ...) no one really has a real
> reference from the chips' manufacturer.
> So, we often have some kind of "consensus" where major emulation
> projects (mame or fpgaarcade for example) are sharing the same methods,
> but without actually fully measuring it on real hardware.
> When digging, I found that several projects often had only common
> source, so having the same methods used everywhere didn't mean it was
> the official/real one.
> Nice you could measure the taps on a real sample.
> BTW, in Hatari the noise generator is initialized with the value "1". Is
> that OK to get a maximum length sequence
> or should we use a better seed
> ? (in the end, I don't think it will affect the perceived noise output
A seed of zero produces a stream of zeros. All other seeds start an
identical repeating sequence that starts after the given seed value.
The 131071 bits (2^17 - 1) repeat every several seconds to a
few minutes depending on the noise frequency.
Note that this LFSR patch is 32 bit capable and can be initialized
with values greater than 17 bits. Unsigned int is also necessary
to prevent right shifting a negative (twos complement) sign bit.
The seed value will come up in the repeating sequence provided
it has a value in the range 1 :: 131071. A maximum length
sequence will sequence through all values (seeds) before repeating.