period_check.period_check_arc Architecture Reference

Check the period of signal. More...

Inheritance diagram for period_check.period_check_arc:

Inheritance graph
[legend]
Collaboration diagram for period_check.period_check_arc:

Collaboration graph
[legend]

List of all members.


Processes

onescnt  ( CLK , res_n )
 count ones
zeroscnt  ( CLK , res_n )
 count zeros

Signals

res_n  std_logic := ' 1 '
ok  std_logic := ' 0 '
per_cnt_0  std_logic_vector ( 3 downto 0 ) := ( others = > ' 0 ' )
per_cnt_1  std_logic_vector ( 3 downto 0 ) := ( others = > ' 0 ' )


Detailed Description

Check the period of signal.

This architecture checks an incoming signal for a period specified with PERIOD. At least three consecutive periods must be correct.

Todo:
add check for non-even periods

Definition at line 55 of file period_check.vhd.


Member Function Documentation

[Process]
onescnt ( CLK ,
res_n )

count ones

Definition at line 68 of file period_check.vhd.

00068   onescnt : process (CLK, res_n)
00069     variable cnt : integer range 0 to 255 := 0;
00070   begin  -- process onescnt
00071     if res_n = '0' then                 -- asynchronous reset (active low)
00072       cnt       := 0;
00073       per_cnt_1 <= (others => '0');
00074     elsif CLK'event and CLK = '1' then  -- rising clock edge
00075       if EN = '1' and ok = '0' then
00076         if A = '1' then
00077           cnt := cnt + 1;
00078         else
00079           if cnt = PERIOD/2 then
00080             per_cnt_1 <= per_cnt_1 + '1';
00081           elsif cnt /= 0 then
00082             per_cnt_1 <= (others => '0');
00083           else
00084             per_cnt_1 <= per_cnt_1;
00085           end if;
00086           cnt := 0;
00087         end if;
00088       else
00089         cnt       := cnt;
00090         per_cnt_1 <= per_cnt_1;
00091       end if;
00092     end if;
00093   end process onescnt;

[Process]
zeroscnt ( CLK ,
res_n )

count zeros

Definition at line 96 of file period_check.vhd.

00096   zeroscnt : process (CLK, res_n)
00097     variable cnt : integer range 0 to 255 := 0;
00098   begin  -- process onescnt
00099     if res_n = '0' then                 -- asynchronous reset (active low)
00100       cnt       := 0;
00101       per_cnt_0 <= (others => '0');
00102     elsif CLK'event and CLK = '1' then  -- rising clock edge
00103       if EN = '1' and ok = '0' then
00104         if A = '0' then
00105           cnt := cnt + 1;
00106         else
00107           if cnt = PERIOD/2 then
00108             per_cnt_0 <= per_cnt_0 + '1';
00109           elsif cnt /= 0 then
00110             per_cnt_0 <= (others => '0');
00111           else
00112             per_cnt_0 <= per_cnt_0;
00113           end if;
00114           cnt := 0;
00115         end if;
00116       else
00117         cnt       := cnt;
00118         per_cnt_0 <= per_cnt_0;
00119       end if;
00120     end if;
00121   end process zeroscnt;


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

Author: M.Niegl
Generated on Tue Nov 4 00:58:13 2008 for BCM-AAA by doxygen 1.5.7.1-20081012