Glitches in Modelsim

Joined
Dec 14, 2007
Messages
1
Reaction score
0
Hi all,

I'm having trouble trying to figure out why this VHDL synthesizes to something which generates glitches when post-route simulated in Modelsim.

Regardless of what I do, I always get tons of warnings from VitalGlitch in Modelsim about glitches on slices involving "count". I am using Precision to synthesize. These tools are all part of Lattice ispLever v7.0. The clock is 1MHz. This is supposed to be a simple divide by 100 counter.

I don't actually see any glitches as written. However, if I remove the range restriction on count, I do see some glitches (this is all in sim...I have not checked for glitches in the actual HW).

Please help!

Thanks,

Sean


Here's the code:

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

entity Tester is
PORT (

CLK: IN std_logic;
RESET: IN std_logic;
CS: IN std_logic;
OUTP: OUT std_logic;
QA0_d: OUT std_logic;
QA1_d: OUT std_logic);
end;

architecture RTL of Tester is

COMPONENT clock IS --Divides 1MHz clock down to 10KHz
PORT (
--Inputs
CLK1M: IN std_logic; --1MHz clock
RESET: IN std_logic; --Active Low
--Outputs
CLK10K: OUT std_logic); --10KHz clock
END COMPONENT;
begin
div: clock PORT MAP (
CLK1M => CLK,
RESET => RESET,
CLK10K => OUTP);
QA0_d <= '0';
QA1_d <= '0';
end RTL;



Now the code for the module clock:

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_unsigned.ALL;
USE ieee.std_logic_arith.ALL;

ENTITY clock IS
PORT (
--Inputs
CLK1M: IN std_logic; --1MHz clock
RESET: IN std_logic; --Active Low
--Outputs
CLK10K: OUT std_logic); --10KHz clock
END clock;

ARCHITECTURE Behavioral OF clock IS
BEGIN
PROCESS(CLK1M, RESET)
variable count: integer range 0 to 255;
BEGIN
IF RESET='0' THEN
count := 0;
CLK10K <= '0';
ELSIF rising_edge(CLK1M) THEN
count := (count+1);
IF count = 51 then
clk10k <= '1';
elsif count = 100 then
count := 0;
clk10k <='0';
else null;
end if;
END IF;
END PROCESS;
END Behavioral;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top