Motion FPGA
Motion FPGA for the MachX02-7000HE Breakout Board
sim Architecture Reference

Architecture sim of entity sim_edge_count. More...

Processes

pr_count  ( clk_in , rst_in )
 Counting process.

Signals

prev_signal  std_logic
 Previous signal.
prev_ok  std_logic
 Previous signal ok flag.
rise  integer
 Count of rising edges.
fall  integer
 Count of falling edges.

Detailed Description

Architecture sim of entity sim_edge_count.

Definition at line 27 of file sim_edge_count.vhd.

Member Function Documentation

§ pr_count()

pr_count (   clk_in ,
  rst_in  
)
Process

Counting process.

This process counts the rising and falling edges

Definition at line 39 of file sim_edge_count.vhd.

pr_count : PROCESS (clk_in, rst_in) IS
39  BEGIN
40 
41  IF (rst_in = '1') THEN
42  -- Reset counts
43  prev_signal <= '0';
44  prev_ok <= '0';
45  rise <= 0;
46  fall <= 0;
47  ELSIF (rising_edge(clk_in)) THEN
48  -- Detect edges
49  IF (prev_ok = '1') THEN
50  -- Count rising edges
51  IF (prev_signal = '0' AND signal_in = '1') THEN
52  rise <= rise + 1;
53  END IF;
54 
55  -- Count falling edges
56  IF (prev_signal = '1' AND signal_in = '0') THEN
57  fall <= fall + 1;
58  END IF;
59  END IF;
60 
61  -- Update previous signal
63  prev_ok <= '1';
64  END IF;
65 
66  END PROCESS pr_count;
67 
in clk_instd_logic
Clock.
in rst_instd_logic
Asynchronous reset.
integer fall
Count of falling edges.
std_logic prev_signal
Previous signal.
in signal_instd_logic
Signal input.
std_logic prev_ok
Previous signal ok flag.
integer rise
Count of rising edges.

The documentation for this class was generated from the following file: