properly deal with evaluation of magnitude of 2s complement for waveform generation