2
\$\begingroup\$

I am having some problems with my code, and understandning what my warnings are trying to say to me..

These are the warnings i get

WARNING:Xst:737 - Found 4-bit latch for signal <counter_10>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 4-bit latch for signal <counter_1>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:737 - Found 1-bit latch for signal <ret>. Latches may be generated from incomplete case or if statements. We do not recommend the use of latches in FPGA/CPLD designs, as they may lead to timing problems.
WARNING:Xst:2677 - Node <Sreg_FSM_FFd1> of sequential type is unconnected in block <game>.
WARNING:Xst:2677 - Node <Sreg3_FSM_FFd1> of sequential type is unconnected in block <game>.
WARNING:Xst:2677 - Node <Sreg2_FSM_FFd1> of sequential type is unconnected in block <game>.
WARNING:Xst:2677 - Node <Sreg1_FSM_FFd1> of sequential type is unconnected in block <game>.
WARNING:PhysDesignRules:372 - Gated clock. Clock net
 segment2/counter_1_cmp_eq0000 is sourced by a combinatorial pin. This is not
 good design practice. Use the CE pin to control the loading of data into the
 flip-flop.
WARNING:PhysDesignRules:372 - Gated clock. Clock net segment2/counter_10_and0000
 is sourced by a combinatorial pin. This is not good design practice. Use the
 CE pin to control the loading of data into the flip-flop.
WARNING:Route:455 - CLK Net:segment2/ret may have excessive skew because 
WARNING:Route:455 - CLK Net:segment2/counter_1_cmp_eq0000 may have excessive skew because 
WARNING:Route:455 - CLK Net:segment2/counter_10_and0000 may have excessive skew because 
WARNING:PhysDesignRules:372 - Gated clock. Clock net
 segment2/counter_1_cmp_eq0000 is sourced by a combinatorial pin. This is not
 good design practice. Use the CE pin to control the loading of data into the
 flip-flop.
WARNING:PhysDesignRules:372 - Gated clock. Clock net segment2/counter_10_and0000
 is sourced by a combinatorial pin. This is not good design practice. Use the
 CE pin to control the loading of data into the flip-flop.

And my code looks like this https://www.dropbox.com/s/9lytyrdn9f4mh1b/randomnumber_medGame.rar

I would be very grate if someone could point out what the problem is.

A huge problem is when test changes value in one module, the other module shall react on it, but the segment doesn't show the right combination which irretates me alot.

asked May 4, 2014 at 19:48
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

One of your major problems is in test.vhd. You have no declaration at all for you entity. There are no inputs to that block, nor outputs. test.vhd is all on its own. It is bad practice to not have an entity declaration. I am surprised that it even synthesized.

What it looks like you are trying to do in test is to create a new clock. If that is what you are doing, you are going about it wrong. The best practice for splitting a clock is to use a register and a counter. When the counter reaches its max, have it change an intermediate signal, something not called clock. Maybe name it half_clock or my_clock.

signal my_clock : std_logic := 0;
signal counter, counter_next : natural := 0; --use a type where addition is easy
process(clk)
begin
if(clk'event = '1') then --clk is the board clk. My FPGA runs it a 50 MHZ
 counter <= counter_next;
 counter_next <= counter_next +1;
 if(counter = MAX) then --insert your max counter number into MAX
 counter <= '0';
 --toggle your my_clock signal here
 end if;
end if;
end process;

This sudo code should save you from your gate clock warning.

As for the gated latches, make sure you have covered every case possible. Remember that with std_logic there are 9 different possibilities. Always have an else case that covers the un-enumerated cases. The keyword 'others' is very useful in this case.

Also, what set of tools are you using and what board?

answered May 7, 2014 at 15:14
\$\endgroup\$
3
  • \$\begingroup\$ Wouldn't you need to assign to counter_next? \$\endgroup\$ Commented May 7, 2014 at 16:52
  • \$\begingroup\$ xilinx ISE and Spartan Nexys FGPA board. I am quite unsure which warning you are referring to.. \$\endgroup\$ Commented May 10, 2014 at 16:50
  • \$\begingroup\$ well.. my prescaler is exactly made like that.. So... \$\endgroup\$ Commented May 10, 2014 at 20:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.