OpenCores
URL https://opencores.org/ocsvn/modular_oscilloscope/modular_oscilloscope/trunk

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [epp/] [eppwbn_ctrl.vhd] - Blame information for rev 14

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 budinero
--|------------------------------------------------------------------------------
2
--| UNSL - Modular Oscilloscope
3
--|
4
--| File: eppwbn_wbn_side.vhd
5 14 budinero
--| Version: 0.20
6 9 budinero
--| Targeted device: Actel A3PE1500 
7
--|-----------------------------------------------------------------------------
8
--| Description:
9
--|     EPP - Wishbone bridge. 
10
--|       This module controls the negotiation (IEEE Std. 1284-2000).
11
--|   This can be easily modified to control other modes besides the EPP.
12
-------------------------------------------------------------------------------
13
--| File history:
14
--|     0.01    | nov-2008 | First testing release
15 14 budinero
--|   0.20  | dic-2008 | Customs signals without tri-state
16
--|   0.21  | jan-2009 | Asinc RST_I for Wishbone compatibility
17 9 budinero
--------------------------------------------------------------------------------
18 14 budinero
--| Copyright ® 2008, Facundo Aguilera.
19
--|
20
--| This VHDL design file is an open design; you can redistribute it and/or
21
--| modify it and/or implement it after contacting the author.
22 9 budinero
 
23
library IEEE;
24
use IEEE.STD_LOGIC_1164.ALL;
25
 
26
entity eppwbn_ctrl is
27
port(
28
 
29
        -- salida al puerto epp
30
  nStrobe: in std_logic;                  -- Nomenclatura IEEE Std. 1284-2000, 
31
                                          -- Negotiation/ECP/EPP (Compatibiliy) 
32
                                                                                                                  -- HostClk/nWrite 
33
        Data: in std_logic_vector (7 downto 0); -- AD8..1/AD8..1 (Data1..Data8)
34
        nAck: out std_logic;                    -- PtrClk/PeriphClk/Intr
35
        -- Busy: out std_logic;                 -- PtrBusy/PeriphAck/nWait
36
        PError: out std_logic;                  -- AckData/nAckReverse
37
        Sel: out std_logic;                     -- XFlag (Select). Select no puede usarse
38
        nAutoFd: in std_logic;                  -- HostBusy/HostAck/nDStrb
39
        PeriphLogicH: out std_logic;            -- (Periph Logic High)
40
        nInit: in std_logic;                    -- nReverseRequest
41
        nFault: out std_logic;                  -- nDataAvail/nPeriphRequest
42
        nSelectIn: in std_logic;                -- 1284 Active/nAStrb
43
        -- HostLogicH: in std_logic;            -- (Host Logic High)
44
        -- i indica misma señal de salida al puerto, aunque interna en el core y controlada por el bloque de control
45
 
46
        -- salida a la interface wishbone
47
        RST_I: in std_logic;
48
        CLK_I: in std_logic;
49
 
50
        -- señales internas
51
  rst_pp: out std_logic;  -- generador de reset desde la interfaz del puerto paralelo
52
        epp_mode: out std_logic_vector (1 downto 0) -- indicador de modo de comunicaci?n epp
53
      -- "00" deshabilitado
54
      -- "01" inicial (se?ales de usuario e interrupciones deshabilitadas)
55
      -- "10" sin definir
56
      -- "11" modo EPP normal
57
);
58
end entity eppwbn_ctrl;
59
 
60 10 budinero
 
61 9 budinero
architecture state_machines of eppwbn_ctrl is
62
        type StateType is (
63
          st_compatibility_idle,  -- Los estados corresponden a los especificados
64
          st_negotiation2,        --  por el est?ndar.
65
                                  -- Los n?meros de los estados negotiation corresponden 
66
                                  --  a las fases del est?ndar.
67
          st_initial_epp,
68
          st_epp_mode
69
                                        -- otros modos
70
          );
71
        signal next_state, present_state: StateType;
72
        signal ext_req_val: std_logic_vector (7 downto 0);
73
begin
74
 
75
  ----------------------------------------------------------------------------------------
76
  -- generación de señal de reset para otros módulos y señal de encendido hacia el host
77
  rst_pp <= not(nInit) and not(nSelectIn); -- (nInit = '0') and (nSelectIn = '0');
78
 
79
  PeriphLogicH <= '1';
80
 
81
  ----------------------------------------------------------------------------------------
82
  -- almacenamiento de Extensibility Request Value (asíncrono)
83
  P_data_store: process(nStrobe, present_state, Data, RST_I, nInit, nSelectIn)
84
  begin
85
    if (RST_I = '1' or (nInit = '0' and nSelectIn = '0')) then
86
      ext_req_val <= (others => '0');
87
    elsif (present_state = st_negotiation2 and nStrobe'event and nStrobe = '0') then
88
      ext_req_val <= Data;
89
    end if;
90
  end process P_data_store;
91
 
92
  ----------------------------------------------------------------------------------------
93 14 budinero
  -- estado siguiente
94 9 budinero
  P_state_comb: process(present_state, next_state, RST_I, nSelectIn, nAutoFd, ext_req_val, nInit, nStrobe) begin
95
 
96 14 budinero
 
97
    case present_state is
98
 
99
      when st_compatibility_idle =>
100
        PError <= '0';
101
        nFault <= '1';
102
        Sel <= '1';
103
        nAck <= '1';
104
 
105
        epp_mode <= "00";
106 9 budinero
 
107 14 budinero
        -- verificación de compatibilidad con 1284
108
        if (nAutoFd = '0' and  nSelectIn = '1') then
109
          next_state <= st_negotiation2;
110
        else
111
          next_state <= st_compatibility_idle;
112
        end if;
113
 
114
      when st_negotiation2 =>
115
        PError <= '1';
116
        nFault <= '1';
117
        Sel <= '1';
118
        nAck <= '0';
119 9 budinero
 
120 14 budinero
        epp_mode <= "00";
121 9 budinero
 
122 14 budinero
        -- Reconocimiento del host 
123
        if (nStrobe = '1' and
124
            nAutoFd = '1') then
125 9 budinero
 
126 14 budinero
          -- Pedido de modo EPP
127
          if (ext_req_val = "01000000") then
128
            next_state <= st_initial_epp;
129 9 budinero
 
130 14 budinero
          -- Otros modos
131
 
132
          else
133 9 budinero
            next_state <= st_compatibility_idle;
134
          end if;
135 14 budinero
        else
136
          next_state <= st_negotiation2;
137
        end if;
138
 
139
      when st_initial_epp =>
140
        Sel <= '1';
141
        PError <= '1';
142
        nFault <= '1';
143
        nAck <= '1';
144
 
145
        epp_mode <= "01";
146 9 budinero
 
147 14 budinero
        -- Finalizaci?n del modo EPP
148
        if nInit = '0' then
149
          next_state <= st_compatibility_idle;
150
        -- Comienzo del primer ciclo EPP
151
        elsif (nSelectIn = '0' or nAutoFd = '0') then
152
          next_state <= st_epp_mode;
153
        else
154
          next_state <= st_initial_epp;
155
        end if;
156
 
157
      when st_epp_mode =>
158
        Sel <= '0';     -- El bus debe asegurar que se puedan usar
159
        PError <= '0';  --  las señales definidas por el usuario en el módulo 
160
        nFault <= '0';  --  EPP.
161
        nAck <= '0';
162
 
163
        epp_mode <= "11";
164 9 budinero
 
165 14 budinero
        -- Finalizaci?n del modo EPP
166
 
167
        next_state <= st_epp_mode;
168
                -- Se sale de este estado en forma asíncrona ya que esta acción
169
    end case;   --  no tiene handshake.
170
 
171 9 budinero
  end process P_state_comb;
172
 
173
 
174
 
175
  ----------------------------------------------------------------------------------------
176 14 budinero
  -- estado actual
177 9 budinero
  P_state_clocked: process(CLK_I, nInit, nSelectIn) begin
178 14 budinero
    if (nInit = '0' and nSelectIn = '0') or RST_I = '1' then
179 9 budinero
      present_state <= st_compatibility_idle;
180
    elsif present_state = st_epp_mode and nInit = '0' then
181
      present_state <= st_compatibility_idle;
182
    elsif (CLK_I'event and CLK_I='1') then
183
      present_state <= next_state;
184
    end if;
185
  end process P_state_clocked;
186
 
187
end architecture state_machines;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.