otsdaq_prepmodernization  v2_05_02_indev
delay_counter.vhd
1 -------------------------------------------------------------------------------
2 --
3 -- Title : No Title
4 -- Design : ethernet_controller
5 -- Author : aprosser
6 -- Company : CD_CEPA_ESE
7 --
8 -------------------------------------------------------------------------------
9 --
10 -- File : c:\HDL_Designs\dig_gec\ethernet_controller\compile\delay_counter.vhd
11 -- Generated : 03/20/09 15:19:31
12 -- From : c:/HDL_Designs/dig_gec/ethernet_controller/src/delay_counter.asf
13 -- By : FSM2VHDL ver. 5.0.5.6
14 --
15 -------------------------------------------------------------------------------
16 --
17 -- Description :
18 --
19 -------------------------------------------------------------------------------
20 
21 library IEEE;
22 use IEEE.std_logic_1164.all;
23 use IEEE.std_logic_arith.all;
24 use IEEE.std_logic_unsigned.all;
25 use params_package.all;
26 
27 entity delay_counter is
28  port (
29  clear_delay_count: in STD_LOGIC;
30  clock: in STD_LOGIC;
31  reset_n: in STD_LOGIC;
32  start_delay_count: in STD_LOGIC;
33  delay_count: out STD_LOGIC);
34 end delay_counter;
35 
36 architecture delay_counter of delay_counter is
37 
38 -- diagram signals declarations
39 signal delay_val: STD_LOGIC_VECTOR (15 downto 0);
40 
41 -- SYMBOLIC ENCODED state machine: Sreg0
42 type Sreg0_type is (
43  S1, S2, S3
44 );
45 -- attribute enum_encoding of Sreg0_type: type is ... -- enum_encoding attribute is not supported for symbolic encoding
46 
47 signal Sreg0: Sreg0_type;
48 
49 begin
50 
51 
52 ----------------------------------------------------------------------
53 -- Machine: Sreg0
54 ----------------------------------------------------------------------
55 Sreg0_machine: process (clock)
56 begin
57  if clock'event and clock = '1' then
58  if reset_n = '0' then
59  Sreg0 <= S1;
60  -- Set default values for outputs, signals and variables
61  -- ...
62  delay_val <= v_16_0;
63  delay_count <= '0';
64  else
65  -- Set default values for outputs, signals and variables
66  -- ...
67  case Sreg0 is
68  when S1 =>
69  if start_delay_count = '1' then
70  Sreg0 <= S2;
71  delay_count <= '1';
72  -- Inhibit
73  elsif start_delay_count = '0' then
74  Sreg0 <= S1;
75  delay_val <= v_16_0;
76  end if;
77  when S2 =>
78  if delay_val >= delay_term then
79  Sreg0 <= S3;
80  delay_count <= '0';
81  elsif delay_val < delay_term then
82  Sreg0 <= S2;
83  delay_val <= delay_val + v_16_1;
84  end if;
85  when S3 =>
86  if clear_delay_count = '1' then
87  Sreg0 <= S1;
88  delay_val <= v_16_0;
89  elsif clear_delay_count = '0' then
90  Sreg0 <= S3;
91  end if;
92 --vhdl_cover_off
93  when others =>
94  null;
95 --vhdl_cover_on
96  end case;
97  end if;
98  end if;
99 end process;
100 
101 end delay_counter;