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

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [epp/] [eppwbn_ctrl.vhd] - Diff between revs 9 and 10

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 9 Rev 10
--|------------------------------------------------------------------------------
--|------------------------------------------------------------------------------
--| UNSL - Modular Oscilloscope
--| UNSL - Modular Oscilloscope
--|
--|
--| File: eppwbn_wbn_side.vhd
--| File: eppwbn_wbn_side.vhd
--| Version: 0.10
--| Version: 0.10
--| Targeted device: Actel A3PE1500 
--| Targeted device: Actel A3PE1500 
--|-----------------------------------------------------------------------------
--|-----------------------------------------------------------------------------
--| Description:
--| Description:
--|     EPP - Wishbone bridge. 
--|     EPP - Wishbone bridge. 
--|       This module controls the negotiation (IEEE Std. 1284-2000).
--|       This module controls the negotiation (IEEE Std. 1284-2000).
--|   This can be easily modified to control other modes besides the EPP.
--|   This can be easily modified to control other modes besides the EPP.
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
--| File history:
--| File history:
--|     0.01    | nov-2008 | First testing release
--|     0.01    | nov-2008 | First testing release
--|   0.10  | dic-2008 | Customs signals without tri-state
--|   0.10  | dic-2008 | Customs signals without tri-state
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--| Copyright Facundo Aguilera 2008
--| Copyright Facundo Aguilera 2008
--| GPL
--| GPL
 
 
library IEEE;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_1164.ALL;
 
 
entity eppwbn_ctrl is
entity eppwbn_ctrl is
port(
port(
 
 
        -- salida al puerto epp
        -- salida al puerto epp
  nStrobe: in std_logic;                  -- Nomenclatura IEEE Std. 1284-2000, 
  nStrobe: in std_logic;                  -- Nomenclatura IEEE Std. 1284-2000, 
                                          -- Negotiation/ECP/EPP (Compatibiliy) 
                                          -- Negotiation/ECP/EPP (Compatibiliy) 
                                                                                                                  -- HostClk/nWrite 
                                                                                                                  -- HostClk/nWrite 
        Data: in std_logic_vector (7 downto 0); -- AD8..1/AD8..1 (Data1..Data8)
        Data: in std_logic_vector (7 downto 0); -- AD8..1/AD8..1 (Data1..Data8)
        nAck: out std_logic;                    -- PtrClk/PeriphClk/Intr
        nAck: out std_logic;                    -- PtrClk/PeriphClk/Intr
        -- Busy: out std_logic;                 -- PtrBusy/PeriphAck/nWait
        -- Busy: out std_logic;                 -- PtrBusy/PeriphAck/nWait
        PError: out std_logic;                  -- AckData/nAckReverse
        PError: out std_logic;                  -- AckData/nAckReverse
        Sel: out std_logic;                     -- XFlag (Select). Select no puede usarse
        Sel: out std_logic;                     -- XFlag (Select). Select no puede usarse
        nAutoFd: in std_logic;                  -- HostBusy/HostAck/nDStrb
        nAutoFd: in std_logic;                  -- HostBusy/HostAck/nDStrb
        PeriphLogicH: out std_logic;            -- (Periph Logic High)
        PeriphLogicH: out std_logic;            -- (Periph Logic High)
        nInit: in std_logic;                    -- nReverseRequest
        nInit: in std_logic;                    -- nReverseRequest
        nFault: out std_logic;                  -- nDataAvail/nPeriphRequest
        nFault: out std_logic;                  -- nDataAvail/nPeriphRequest
        nSelectIn: in std_logic;                -- 1284 Active/nAStrb
        nSelectIn: in std_logic;                -- 1284 Active/nAStrb
        -- HostLogicH: in std_logic;            -- (Host Logic High)
        -- HostLogicH: in std_logic;            -- (Host Logic High)
        -- i indica misma señal de salida al puerto, aunque interna en el core y controlada por el bloque de control
        -- i indica misma señal de salida al puerto, aunque interna en el core y controlada por el bloque de control
 
 
        -- salida a la interface wishbone
        -- salida a la interface wishbone
        RST_I: in std_logic;
        RST_I: in std_logic;
        CLK_I: in std_logic;
        CLK_I: in std_logic;
 
 
        -- señales internas
        -- señales internas
  rst_pp: out std_logic;  -- generador de reset desde la interfaz del puerto paralelo
  rst_pp: out std_logic;  -- generador de reset desde la interfaz del puerto paralelo
        epp_mode: out std_logic_vector (1 downto 0) -- indicador de modo de comunicaci?n epp
        epp_mode: out std_logic_vector (1 downto 0) -- indicador de modo de comunicaci?n epp
      -- "00" deshabilitado
      -- "00" deshabilitado
      -- "01" inicial (se?ales de usuario e interrupciones deshabilitadas)
      -- "01" inicial (se?ales de usuario e interrupciones deshabilitadas)
      -- "10" sin definir
      -- "10" sin definir
      -- "11" modo EPP normal
      -- "11" modo EPP normal
);
);
end entity eppwbn_ctrl;
end entity eppwbn_ctrl;
 
 
architecture
 
architecture state_machines of eppwbn_ctrl is
architecture state_machines of eppwbn_ctrl is
        type StateType is (
        type StateType is (
          st_compatibility_idle,  -- Los estados corresponden a los especificados
          st_compatibility_idle,  -- Los estados corresponden a los especificados
          st_negotiation2,        --  por el est?ndar.
          st_negotiation2,        --  por el est?ndar.
                                  -- Los n?meros de los estados negotiation corresponden 
                                  -- Los n?meros de los estados negotiation corresponden 
                                  --  a las fases del est?ndar.
                                  --  a las fases del est?ndar.
          st_initial_epp,
          st_initial_epp,
          st_epp_mode
          st_epp_mode
                                        -- otros modos
                                        -- otros modos
          );
          );
        signal next_state, present_state: StateType;
        signal next_state, present_state: StateType;
        signal ext_req_val: std_logic_vector (7 downto 0);
        signal ext_req_val: std_logic_vector (7 downto 0);
begin
begin
 
 
  ----------------------------------------------------------------------------------------
  ----------------------------------------------------------------------------------------
  -- generación de señal de reset para otros módulos y señal de encendido hacia el host
  -- generación de señal de reset para otros módulos y señal de encendido hacia el host
  rst_pp <= not(nInit) and not(nSelectIn); -- (nInit = '0') and (nSelectIn = '0');
  rst_pp <= not(nInit) and not(nSelectIn); -- (nInit = '0') and (nSelectIn = '0');
 
 
  PeriphLogicH <= '1';
  PeriphLogicH <= '1';
 
 
  ----------------------------------------------------------------------------------------
  ----------------------------------------------------------------------------------------
  -- almacenamiento de Extensibility Request Value (asíncrono)
  -- almacenamiento de Extensibility Request Value (asíncrono)
  P_data_store: process(nStrobe, present_state, Data, RST_I, nInit, nSelectIn)
  P_data_store: process(nStrobe, present_state, Data, RST_I, nInit, nSelectIn)
  begin
  begin
    if (RST_I = '1' or (nInit = '0' and nSelectIn = '0')) then
    if (RST_I = '1' or (nInit = '0' and nSelectIn = '0')) then
      ext_req_val <= (others => '0');
      ext_req_val <= (others => '0');
    elsif (present_state = st_negotiation2 and nStrobe'event and nStrobe = '0') then
    elsif (present_state = st_negotiation2 and nStrobe'event and nStrobe = '0') then
      ext_req_val <= Data;
      ext_req_val <= Data;
    end if;
    end if;
  end process P_data_store;
  end process P_data_store;
 
 
  ----------------------------------------------------------------------------------------
  ----------------------------------------------------------------------------------------
  -- selección de estado siguiente
  -- selección de estado siguiente
  P_state_comb: process(present_state, next_state, RST_I, nSelectIn, nAutoFd, ext_req_val, nInit, nStrobe) begin
  P_state_comb: process(present_state, next_state, RST_I, nSelectIn, nAutoFd, ext_req_val, nInit, nStrobe) begin
 
 
    if RST_I = '1' then
    if RST_I = '1' then
      PError <= '-';
      PError <= '-';
      nFault <= '-';
      nFault <= '-';
      Sel <= '-';
      Sel <= '-';
      nAck <= '-';
      nAck <= '-';
 
 
      epp_mode <= "--";
      epp_mode <= "--";
 
 
      next_state <= st_compatibility_idle;
      next_state <= st_compatibility_idle;
    else
    else
      case present_state is
      case present_state is
 
 
        when st_compatibility_idle =>
        when st_compatibility_idle =>
          PError <= '0';
          PError <= '0';
          nFault <= '1';
          nFault <= '1';
          Sel <= '1';
          Sel <= '1';
          nAck <= '1';
          nAck <= '1';
 
 
          epp_mode <= "00";
          epp_mode <= "00";
 
 
          -- verificación de compatibilidad con 1284
          -- verificación de compatibilidad con 1284
          if (nAutoFd = '0' and  nSelectIn = '1') then
          if (nAutoFd = '0' and  nSelectIn = '1') then
            next_state <= st_negotiation2;
            next_state <= st_negotiation2;
          else
          else
            next_state <= st_compatibility_idle;
            next_state <= st_compatibility_idle;
          end if;
          end if;
 
 
        when st_negotiation2 =>
        when st_negotiation2 =>
          PError <= '1';
          PError <= '1';
          nFault <= '1';
          nFault <= '1';
          Sel <= '1';
          Sel <= '1';
          nAck <= '0';
          nAck <= '0';
 
 
          epp_mode <= "00";
          epp_mode <= "00";
 
 
          -- Reconocimiento del host 
          -- Reconocimiento del host 
          if (nStrobe = '1' and
          if (nStrobe = '1' and
              nAutoFd = '1') then
              nAutoFd = '1') then
 
 
            -- Pedido de modo EPP
            -- Pedido de modo EPP
            if (ext_req_val = "01000000") then
            if (ext_req_val = "01000000") then
              next_state <= st_initial_epp;
              next_state <= st_initial_epp;
 
 
            -- Otros modos
            -- Otros modos
 
 
            else
            else
              next_state <= st_compatibility_idle;
              next_state <= st_compatibility_idle;
            end if;
            end if;
          else
          else
            next_state <= st_negotiation2;
            next_state <= st_negotiation2;
          end if;
          end if;
 
 
        when st_initial_epp =>
        when st_initial_epp =>
          Sel <= '1';
          Sel <= '1';
          PError <= '1';
          PError <= '1';
          nFault <= '1';
          nFault <= '1';
          nAck <= '1';
          nAck <= '1';
 
 
          epp_mode <= "01";
          epp_mode <= "01";
 
 
          -- Finalizaci?n del modo EPP
          -- Finalizaci?n del modo EPP
          if nInit = '0' then
          if nInit = '0' then
            next_state <= st_compatibility_idle;
            next_state <= st_compatibility_idle;
          -- Comienzo del primer ciclo EPP
          -- Comienzo del primer ciclo EPP
          elsif (nSelectIn = '0' or nAutoFd = '0') then
          elsif (nSelectIn = '0' or nAutoFd = '0') then
            next_state <= st_epp_mode;
            next_state <= st_epp_mode;
          else
          else
            next_state <= st_initial_epp;
            next_state <= st_initial_epp;
          end if;
          end if;
 
 
        when st_epp_mode =>
        when st_epp_mode =>
          Sel <= '0';     -- El bus debe asegurar que se puedan usar
          Sel <= '0';     -- El bus debe asegurar que se puedan usar
          PError <= '0';  --  las señales definidas por el usuario en el módulo 
          PError <= '0';  --  las señales definidas por el usuario en el módulo 
          nFault <= '0';  --  EPP.
          nFault <= '0';  --  EPP.
          nAck <= '0';
          nAck <= '0';
 
 
          epp_mode <= "11";
          epp_mode <= "11";
 
 
          -- Finalizaci?n del modo EPP
          -- Finalizaci?n del modo EPP
 
 
          next_state <= st_epp_mode;
          next_state <= st_epp_mode;
                  -- Se sale de este estado en forma asíncrona ya que esta acción
                  -- Se sale de este estado en forma asíncrona ya que esta acción
      end case;   --  no tiene handshake.
      end case;   --  no tiene handshake.
    end if;
    end if;
  end process P_state_comb;
  end process P_state_comb;
 
 
 
 
 
 
  ----------------------------------------------------------------------------------------
  ----------------------------------------------------------------------------------------
  -- establecimiento de estado actual
  -- establecimiento de estado actual
  P_state_clocked: process(CLK_I, nInit, nSelectIn) begin
  P_state_clocked: process(CLK_I, nInit, nSelectIn) begin
    if (nInit = '0' and nSelectIn = '0') then
    if (nInit = '0' and nSelectIn = '0') then
      present_state <= st_compatibility_idle;
      present_state <= st_compatibility_idle;
    elsif present_state = st_epp_mode and nInit = '0' then
    elsif present_state = st_epp_mode and nInit = '0' then
      present_state <= st_compatibility_idle;
      present_state <= st_compatibility_idle;
    elsif (CLK_I'event and CLK_I='1') then
    elsif (CLK_I'event and CLK_I='1') then
      present_state <= next_state;
      present_state <= next_state;
    end if;
    end if;
  end process P_state_clocked;
  end process P_state_clocked;
 
 
 
 

powered by: WebSVN 2.1.0

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