N
nfirtaps
Hello, I am using my FPGA to write 1024 bytes to another device. I am
noticing "sometimes" it writes 1025 bytes. I am wondering it this
could be a timing glitch. Here is basically the code I have
**************************************
data_en <= data_en_w;
data_out <= data_out_w;
process(clk1)
begin
if(clk1'event and clk1 = '1') then
stop <= '0';
if (senddata = '1') then
if(counter1 < 1024) then -- potentially write more than one
byte here by timing glitch???
counter1<= counter1 + 1;
data_en_w <= '1';
data_out_w <= buffer(counter1);
else
counter <= 0;
data_en_w <= '0';
stop <= '1'; -- possibly a timing glitch here?
end if;
end if;
end proceess;
trigger <= '1' when (counter2 >= 1024) else '0'; -- this is to wait
for other clock domain (clk2) to start process for clk1
process(trigger,stop)
begin
if (trigger = '1') then
senddata <= '1';
elsif(stop = '1') then
senddata <= '0';
end if;
end process
process(clk2)
begin
if (clk2'event and clk2 = '1') then
counter2 <= counter2 +1;
-- other logic
end if;
end process;
This is on a Spartan 3 with clk1 operating at 48MHz and clk2 operating
at a frequency lower than 48MHz. I feel as if counter1 could be an
issue on the check, or stop has a glitch causing me to write one byte
over.
If anyone has the patience to read this please let me know what they
think.
Since the data is sent every clock and the clock speed is low I don't
know why I would have problems with this.
Thanks,
Lloyd
noticing "sometimes" it writes 1025 bytes. I am wondering it this
could be a timing glitch. Here is basically the code I have
**************************************
data_en <= data_en_w;
data_out <= data_out_w;
process(clk1)
begin
if(clk1'event and clk1 = '1') then
stop <= '0';
if (senddata = '1') then
if(counter1 < 1024) then -- potentially write more than one
byte here by timing glitch???
counter1<= counter1 + 1;
data_en_w <= '1';
data_out_w <= buffer(counter1);
else
counter <= 0;
data_en_w <= '0';
stop <= '1'; -- possibly a timing glitch here?
end if;
end if;
end proceess;
trigger <= '1' when (counter2 >= 1024) else '0'; -- this is to wait
for other clock domain (clk2) to start process for clk1
process(trigger,stop)
begin
if (trigger = '1') then
senddata <= '1';
elsif(stop = '1') then
senddata <= '0';
end if;
end process
process(clk2)
begin
if (clk2'event and clk2 = '1') then
counter2 <= counter2 +1;
-- other logic
end if;
end process;
This is on a Spartan 3 with clk1 operating at 48MHz and clk2 operating
at a frequency lower than 48MHz. I feel as if counter1 could be an
issue on the check, or stop has a glitch causing me to write one byte
over.
If anyone has the patience to read this please let me know what they
think.
Since the data is sent every clock and the clock speed is low I don't
know why I would have problems with this.
Thanks,
Lloyd