F
FPGA
I have written a process to generate sine wave. I am getting a
distorted wave and not a pure sine wave. I am not sure if this has
anything to do with the simulator.
two : process
variable phase_temp,result : real;
constant scale : real := 2.0*real(bw);
begin
phase_temp := phase_sin; --phase_sin;
l1 : for i in 1 to samples_sin loop --number_of_samples loop
result := scale*(amp_sin*(sin(frq_sin + phase_temp)));
sine_real <= (amp_sin*(sin(frq_sin + phase_temp)));
sinWave <= toSigned(result,bw);
phase_temp := phase_temp+incr_sin;
wait for 5 ns;
end loop l1;
end process two;
generic value : phase_sin : real := 0.0; samples_sin : integer :=
1000; incr_sin : real := 1.0;
frq_sin : real := 1000.0;
I dont see the frequency of the wave change if the frq_sin is changed.
Same happens when samples_sin is changed. I am not sure what is going
wrong. Please help
distorted wave and not a pure sine wave. I am not sure if this has
anything to do with the simulator.
two : process
variable phase_temp,result : real;
constant scale : real := 2.0*real(bw);
begin
phase_temp := phase_sin; --phase_sin;
l1 : for i in 1 to samples_sin loop --number_of_samples loop
result := scale*(amp_sin*(sin(frq_sin + phase_temp)));
sine_real <= (amp_sin*(sin(frq_sin + phase_temp)));
sinWave <= toSigned(result,bw);
phase_temp := phase_temp+incr_sin;
wait for 5 ns;
end loop l1;
end process two;
generic value : phase_sin : real := 0.0; samples_sin : integer :=
1000; incr_sin : real := 1.0;
frq_sin : real := 1000.0;
I dont see the frequency of the wave change if the frq_sin is changed.
Same happens when samples_sin is changed. I am not sure what is going
wrong. Please help