[sdiy] How does the MIDIVerb's adder work?
Gordonjcp
gordonjcp at gjcp.net
Sat Jul 27 19:49:39 CEST 2024
On Sat, Jul 27, 2024 at 08:33:26AM -0700, Eric Brombaugh via Synth-diy wrote:
> [Context: I did the reverse-engineering on the MIDIVerb DSP that Paul
> Schreiber presented in the videos mentioned.]
>
> Yes - the carry in of the adder is wired to the sign bit of the input value,
> and yes that seems like it might have something to do with two's-complement.
> You'll notice that the inverting store instruction doesn't do a full
> two's-complement inversion, but just bitwise "one's-complement" inversion.
> That will always result in an off-by-one error in the data stored in DRAM,
> but when reading back from DRAM to the accumulator the sign/carry connection
> completes the two's-complement. But, only for negative values, and of course
> it isn't required for data that was stored with the non-inverting
> instruction.
Aha. When I tried my emulator with "faithful" not-really-two's-complement versus using just normal subtraction and inversion, I found I could detect a slight difference by subtracting one sample from the other, and boosting the gain by like 50dB.
So, basically no difference, not that I can hear with 50-year-old 12-bit 32kHz ears.
What you're saying then is that if it gets stored "inverted" the next read will probably correct it? I figured it would be easier to feed the carry off the "invert gate" so that two's complement worked properly, but then I see there's no way to store the negated-not-inverted accumulator to RAM.
Either way implementing it with normal arithmetic saves about half a dozen cycles per opcode and is perceptually the same :-)
Thanks,
--
Gordonjcp
More information about the Synth-diy
mailing list