otsdaq_prepmodernization  v2_05_02_indev
dev_wr_gate_t.vhd
1 -------------------------------------------------------------------------------
2 --
3 -- Title : No Title
4 -- Design : CAPTAN
5 -- Author : aprosser
6 -- Company : CD_CEPA_ESE
7 --
8 -------------------------------------------------------------------------------
9 --
10 -- File : u:\CAPTAN\Data_Conversion_Board\CAPTAN\CAPTAN\compile\dev_wr_gate_t.vhd
11 -- Generated : 08/11/08 10:17:19
12 -- From : u:\CAPTAN\Data_Conversion_Board\CAPTAN\CAPTAN\src\dev_wr_gate_t.asf
13 -- By : FSM2VHDL ver. 5.0.0.9
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 dev_wr_gate_t is
28  port (
29  addr: in STD_LOGIC_VECTOR (63 downto 0);
30  clock: in STD_LOGIC;
31  data: in STD_LOGIC_VECTOR (31 downto 0);
32  reset_n: in STD_LOGIC;
33  we: in STD_LOGIC;
34  data_out: out STD_LOGIC_VECTOR (31 downto 0);
35  wr_out: out STD_LOGIC);
36 end dev_wr_gate_t;
37 
38 architecture dev_wr_gate_t of dev_wr_gate_t is
39 
40 constant count_inc: STD_LOGIC_VECTOR (3 downto 0) := "0001";
41 constant count_max: STD_LOGIC_VECTOR (3 downto 0) := "1000";
42 -- diagram signals declarations
43 signal pulse_count: STD_LOGIC_VECTOR (3 downto 0);
44 
45 -- SYMBOLIC ENCODED state machine: Sreg0
46 type Sreg0_type is (
47  S1, S4, S5
48 );
49 -- attribute enum_encoding of Sreg0_type: type is ... -- enum_encoding attribute is not supported for symbolic encoding
50 
51 signal Sreg0: Sreg0_type;
52 
53 begin
54 
55 
56 ----------------------------------------------------------------------
57 -- Machine: Sreg0
58 ----------------------------------------------------------------------
59 Sreg0_machine: process (clock)
60 begin
61  if clock'event and clock = '1' then
62  if reset_n = '0' then
63  Sreg0 <= S1;
64  -- Set default values for outputs, signals and variables
65  -- ...
66  wr_out <= '0';
67  data_out <= v_32_0;
68  pulse_count <= "0000";
69  else
70  -- Set default values for outputs, signals and variables
71  -- ...
72  case Sreg0 is
73  when S1 =>
74  if we = '1' and addr = dev_addr1 then
75  Sreg0 <= S4;
76  data_out <= data;
77  wr_out <= '0';
78  elsif we = '0' or addr /= dev_addr1 then
79  Sreg0 <= S1;
80  wr_out <= '0';
81  end if;
82  when S4 =>
83  if pulse_count /= count_max then
84  Sreg0 <= S4;
85  wr_out <= '1';
86  pulse_count <= pulse_count + count_inc;
87  elsif pulse_count = count_max then
88  Sreg0 <= S5;
89  pulse_count <= "0000";
90  end if;
91  when S5 =>
92  Sreg0 <= S1;
93  wr_out <= '1';
94  when others =>
95  null;
96  end case;
97  end if;
98  end if;
99 end process;
100 
101 end dev_wr_gate_t;