2

I'm trying to apply a decay envelope to a sinusoidal waveform using Verilog. Hardware constraints prevent use of multiplication to simply multiply by the envelope. The sine values and envelope values, for which I'm simply using 1-exp(-x), are stored in ROMs to speed everything up.

Right now I'm simply calculating the output sample by subtracting the exponential value from the sine value if the sine value is larger. If the exponential value is larger than the sine value, the output sample is zero. This works pretty well, but the current exponential value to subtract needs to be modulated by the current location on the sine wave so that the full value is subtracted when the sine is maximum and zero is subtracted when the sine is zero.

I'd appreciate any advice that anyone can give and I can provide more details if required. If this isn't an appropriate place for Verilog questions is there somewhere else that's better?

Thanks!

JohnP
  • 49,507
  • 13
  • 108
  • 140
  • 2
    If you need help with the math you can check out http://math.stackexchange.com/ – JohnP Nov 28 '11 at 06:30
  • So does the corresponding exponential value "line up with" a corresponding sine value based on size of the sine wave alone? eg. y = 5sin(x) ... decay = 1-exp(-y)? When you say "the full value is subtracted", your exponent varies from negative infinity to 1. Is negative infinity the full value or is 1? If you are looking for decaying sinusoids I am reasonably sure you can create BRAM luts that will follow just about any function you are looking for. Are you are trying to map one quarter of the sine waveform (all you should need space wise) to a corresponding output size? – Paul Seeb Jan 17 '12 at 18:16
  • You can do a simple divide by two using a shift right, that will get you a reasonable linear decay in your output value. Remember to sign extend the result (there's a IEEE library routine for that) – Jay M Nov 16 '12 at 15:16

1 Answers1

1

If your FPGA doesn't have a hardwired multiplier, and if you can tolerate some delay, you may want to implement a simple multiplier using a scaling accumulator.

geschema
  • 2,464
  • 4
  • 30
  • 41