I'm stuck on a simple issue but can't get out of it: I would like to generate severals waveform signals for my future testbench but the frequency of my signals are not correct.
Below is the code I want to simulate:
library ieee;use ieee.std_logic_1164 .all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;use ieee.math_real.all;
entity triangle_generator is
generic(AMP: real; OFFSET: real; FREQ: real; PHASE :real); port(wave1: out real); end triangle_generator;
architecture archi of triangle_generator is
signal tmp1 : real := 0.0;
P1:process constant delta : real := 1000.0e-12; constant fin : time := 1000 ps; variable angle : real := 0.0; variable t : real := 0.0; variable PHASE_RAD : real := 0.0; begin PHASE_RAD := (math_2_pi * PHASE)/360.0;
loop angle := math_2_pi * FREQ * t; t := t + delta; tmp1 <= OFFSET+(AMP/2.0)*(2.0/math_pi)*arcsin(sin(angle));
wait for fin; end loop; wait; end process P1; wave1 <= tmp1; end archi;
When I simule this code with FREQ=100 000 000 Hz I get the waveform in attachment, not really what I wanted. So I was thinking, if I write delta = 1000.0e-15 maybe it will be right, but absolutly not. When I change the value of delta, the frequency of the waveform is wrong.
So can you help me to get through this please?