Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
How do u do so?The best way to solve that problem is probably to modify the sine ROM so it swings from -511 to +511 instead of from -512 to +511
But how? Wat about the coding, what should i write within my HDL code?It may be easier for you to generate a variable-frequency DDS, so you can change the frequency from your HDL.
How does it add to the distortion? After changing, it seems to be alrite. I ran it with 1-2us more, nothing happens.By changing those MIF values from 1000000000 to 1000000001, you are slightly lowering its amplitude (and unfortunately adding more distortion).
I'm not quite sure how to do this part... rewriting as u mean editing? After editing the MIF file, when CoreGen generates the file will be overwritten.You could rewrite the entire MIF file with a clean sinewave at whatever amplitude you need.
Do u mean adding a new multiplier component into the Test bench and fraction the DDS output by 0.99 b4 going into the filter? Then how will it affect the quantization error? Will it affect my output of sine wave, or giving a better sine wave without spikes?Or you could multiply the DDS output by a fraction such as 0.99, but that would consume a multiplier and increase quantization error.
Is it possible you can gif mi an example? since u haf my programs already, it might be easier for u to do it? cos i'm doing all the programs all base on VHDL onli.You could write a small program that tabulates one sinewave cycle, converts it to ASCII ones and zeros, and writes it to the MIF file.
#include <stdio.h>
#include <math.h>
#define N 1024 // sinewave points
#define amplitude 511 // sinewave peak amplitude
#define bits 10 // quantization bits
int main(void)
{
int n, s, b;
for (n=0; n<1024; n++)
{
s = floor(amplitude * sin(2 * M_PI / N * n) + 0.5);
for (b=bits-1; b>=0; b--)
putchar((s >> b) & 1 ? '1' : '0');
putchar('\n');
}
return 0;
}