hitwaterfish
New Member
Hi everybody,
I am now using a CPLD(EPM7064STC440-10) and I have a problem. I want to use the CPLD to control the pulse duration. The VHDL source code is like that:
architecture art of cpld_power is
signal counter:std_logic_vector(13 downto 0);
begin
-- counter process
process(counter,CLK,IO(1),ONTIME,OFFTIME)
begin
if(IO(1) = '0') then
counter <= "00000000000000";
elsif(counter = ONTIME + OFFTIME) then
counter <= "00000000000000";
elsif(CLK'event and CLK = '1') then
counter <= counter + 1;
end if;
end process;
-- output process
process(counter,CLK,IO(1),ONTIME,OFFTIME)
begin
if(IO(1) = '0') then
DRIVER1 <= '0';
elsif(counter < ONTIME) then
DRIVER1 <= '1';
else
DRIVER1 <= '0';
end if;
end process;
DRIVER2 <= '0';
end art;
when I do the functional simulation, the output waveform is correct, see Snap1.jpg. But when I do the timing simulation, there is something wrong in the output waveform, see Snap2.jpg. I have done some real experiment on it and it was really like the waveform in Snap2.jpg.
How can I fix the problem?
Thanks,
Samuel
I am now using a CPLD(EPM7064STC440-10) and I have a problem. I want to use the CPLD to control the pulse duration. The VHDL source code is like that:
architecture art of cpld_power is
signal counter:std_logic_vector(13 downto 0);
begin
-- counter process
process(counter,CLK,IO(1),ONTIME,OFFTIME)
begin
if(IO(1) = '0') then
counter <= "00000000000000";
elsif(counter = ONTIME + OFFTIME) then
counter <= "00000000000000";
elsif(CLK'event and CLK = '1') then
counter <= counter + 1;
end if;
end process;
-- output process
process(counter,CLK,IO(1),ONTIME,OFFTIME)
begin
if(IO(1) = '0') then
DRIVER1 <= '0';
elsif(counter < ONTIME) then
DRIVER1 <= '1';
else
DRIVER1 <= '0';
end if;
end process;
DRIVER2 <= '0';
end art;
when I do the functional simulation, the output waveform is correct, see Snap1.jpg. But when I do the timing simulation, there is something wrong in the output waveform, see Snap2.jpg. I have done some real experiment on it and it was really like the waveform in Snap2.jpg.
How can I fix the problem?
Thanks,
Samuel