EmbDev.net

Forum: FPGA, VHDL & Verilog outputs is unutilized


von had (Guest)


Rate this post
useful
not useful
the buttonOut, flipflops and temporal is un-utilized after the frequency 
divider process is added into the codes..
I couldn't figure out the problem as I'm new to vhdl..
my codes is as below..

1
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.std_logic_unsigned.all;
4
5
entity debounce is
6
  --counter size (19 bits gives 10.5ms with 50MHz clock)
7
  generic ( counter_size  :  INTEGER := 4); 
8
  port( clk       : in  std_logic;  --input clock
9
        buttonIn  : in  std_logic;  --input signal to be debounced
10
        buttonOut : out std_logic); --debounced signal
11
end debounce;
12
13
architecture debounce of debounce is
14
  
15
  signal flipflops   : std_logic_vector(1 downto 0); --input flip flops
16
  signal counter_set : std_logic ;                    --sync reset to zero
17
  
18
  signal temporal: std_logic;
19
  signal counter : integer range 0 to 124999 := 0; --counter size(200Hz)
20
      
21
  begin
22
23
  counter_set <= flipflops(0) xor flipflops(1);--check when to start/reset counter 
24
  
25
  --freqeuncy divider process
26
  process (clk) begin
27
    if rising_edge(clk) then
28
      if (counter = 124999) then --Condition met
29
        temporal <= not(temporal);
30
        counter <= 0;
31
      else                       --Condition not met
32
        counter <= counter + 1;
33
      end if;
34
    end if;
35
  end process;
36
  
37
  --debounce process
38
  process(temporal)
39
  begin
40
    if(rising_edge(temporal)) then
41
      flipflops(0) <= buttonIn;
42
      flipflops(1) <= flipflops(0);
43
      buttonOut <= flipflops(1);
44
    end if;
45
  end process; 
46
  
47
end debounce;

: Edited by Moderator
von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
had wrote:
> temporal <= not(temporal);
This is NOT a way to generate a clock inside a FPGA. Check out how to 
generate and use a "clock enable".

von Lothar M. (Company: Titel) (lkmiller) (Moderator)


Rate this post
useful
not useful
had wrote:
> the buttonOut, flipflops and temporal is un-utilized after the frequency
> divider process is added into the codes..
How do you see this? What target and what toolchain is used? What is the 
exact error message or warning?

von VHDL hotline (Guest)


Rate this post
useful
not useful
Initialize/reset temporal. If you simulate it: not(U) is U and there is 
never a rising edge of temporal, so fliflops and buttonout are never 
assigned.

As Lothar said, use a clock enable or if the complete functionality are 
only these two processes, just add the fliflops/buttonout assignment 
directly to your first process and discard the second one, so the 
counter value itself is your clock enable.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.