Line 1... |
Line 1... |
--|------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
--| UNSL - Modular Oscilloscope
|
--| Modular Oscilloscope
|
|
--| UNSL - Argentine
|
--|
|
--|
|
--| File: eppwbn_wbn_side.vhd
|
--| File: eppwbn_wbn_side.vhd
|
--| Version: 0.20
|
--| Version: 0.21
|
--| Targeted device: Actel A3PE1500
|
--| Tested in: Actel APA300
|
--|-----------------------------------------------------------------------------
|
--|-------------------------------------------------------------------------------------------------
|
--| 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.20 | dic-2008 | Customs signals without tri-state
|
--| 0.20 | dic-2008 | Custom signals without tri-state
|
--| 0.21 | jan-2009 | Sinc reset
|
--| 0.21 | jan-2009 | Sinc reset
|
--------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------
|
--| Copyright ® 2008, Facundo Aguilera.
|
--| Copyright ® 2008, Facundo Aguilera.
|
--|
|
--|
|
--| This VHDL design file is an open design; you can redistribute it and/or
|
--| This VHDL design file is an open design; you can redistribute it and/or
|
--| modify it and/or implement it after contacting the author.
|
--| modify it and/or implement it after contacting the author.
|
|
----------------------------------------------------------------------------------------------------
|
|
|
|
|
library IEEE;
|
library IEEE;
|
use IEEE.STD_LOGIC_1164.ALL;
|
use IEEE.STD_LOGIC_1164.ALL;
|
|
|
entity eppwbn_ctrl is
|
entity eppwbn_ctrl is
|
Line 72... |
Line 75... |
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); -- (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 = '0') then
|
ext_req_val <= Data;
|
ext_req_val <= Data;
|
end if;
|
end if;
|
end process P_data_store;
|
end process P_data_store;
|
|
|
----------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------
|
-- estado siguiente
|
-- 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 <= '0';
|
|
nFault <= '1';
|
|
Sel <= '1';
|
|
nAck <= '1';
|
|
|
|
epp_mode <= "00";
|
|
|
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 =>
|
Line 119... |
Line 129... |
Sel <= '1';
|
Sel <= '1';
|
nAck <= '0';
|
nAck <= '0';
|
|
|
epp_mode <= "00";
|
epp_mode <= "00";
|
|
|
-- Reconocimiento del host
|
-- Respuesta según modo solicitado
|
if (nStrobe = '1' and
|
if (nStrobe = '1' and
|
nAutoFd = '1') then
|
nAutoFd = '1') then
|
|
|
-- 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
|
|
|
Line 144... |
Line 152... |
nFault <= '1';
|
nFault <= '1';
|
nAck <= '1';
|
nAck <= '1';
|
|
|
epp_mode <= "01";
|
epp_mode <= "01";
|
|
|
-- Finalizaci?n del modo EPP
|
|
|
-- Finalizacón del modo EPP o cambio a EPP idle
|
if nInit = '0' then
|
if nInit = '0' then
|
next_state <= st_compatibility_idle;
|
next_state <= st_compatibility_idle;
|
-- 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;
|
Line 162... |
Line 170... |
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
|
|
if nInit = '0' then
|
|
next_state <= st_compatibility_idle;
|
|
else
|
next_state <= st_epp_mode;
|
next_state <= st_epp_mode;
|
|
end if;
|
-- 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;
|
|
|
|
|
|
|
----------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------
|
-- estado actual
|
-- estado actual
|
P_state_clocked: process(CLK_I, nInit, nSelectIn) begin
|
P_state_clocked: process(CLK_I, nInit, nSelectIn,RST_I) begin
|
|
-- if (nInit = '0' and nSelectIn = '0') or RST_I = '1' then
|
|
-- present_state <= st_compatibility_idle;
|
|
-- elsif present_state = st_epp_mode and nInit = '0' then
|
|
-- present_state <= st_compatibility_idle;
|
|
-- elsif (CLK_I'event and CLK_I='1') then
|
|
-- present_state <= next_state;
|
|
-- end if;
|
|
|
|
|
if (nInit = '0' and nSelectIn = '0') or RST_I = '1' then
|
if (nInit = '0' and nSelectIn = '0') or RST_I = '1' then
|
present_state <= st_compatibility_idle;
|
present_state <= st_compatibility_idle;
|
elsif present_state = st_epp_mode and nInit = '0' then
|
|
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;
|
|
|