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.2
|
--| Targeted device: Actel A3PE1500
|
--| Tested in: Actel APA300
|
--|------------------------------------------------------------------------------
|
--|-------------------------------------------------------------------------------------------------
|
--| Description:
|
--| Description:
|
--| EPP - Wishbone bridge.
|
--| EPP - Wishbone bridge.
|
--| This module is in the wishbone side (IEEE Std. 1284-2000).
|
--| This module is in the wishbone side (IEEE Std. 1284-2000).
|
-------------------------------------------------------------------------------
|
--|-------------------------------------------------------------------------------------------------
|
--| File history:
|
--| File history:
|
--| 0.01 | nov-2008 | First release
|
--| 0.01 | nov-2008 | First release
|
--| 0.1 | jan-2009 | Sinc reset
|
--| 0.1 | jan-2009 | Sinc reset
|
--------------------------------------------------------------------------------
|
--| 0.2 | feb-2009 | Some improvements
|
|
----------------------------------------------------------------------------------------------------
|
--| 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;
|
Line 27... |
Line 30... |
|
|
entity eppwbn_wbn_side is
|
entity eppwbn_wbn_side is
|
port(
|
port(
|
|
|
-- al puerto epp
|
-- al puerto epp
|
inStrobe: in std_logic; -- Nomenclatura IEEE Std. 1284, Negotiation/ECP/EPP (Compatibiliy)
|
-- Nomenclatura IEEE Std. 1284-2000
|
-- HostClk/nWrite
|
-- Negotiation/ECP/EPP (Compatibiliy)
|
|
inStrobe: in std_logic; -- HostClk/nWrite
|
iData: inout std_logic_vector (7 downto 0); -- AD8..1/AD8..1 (Data1..Data8)
|
iData: inout std_logic_vector (7 downto 0); -- AD8..1/AD8..1 (Data1..Data8)
|
-- inAck: out std_logic; -- PtrClk/PeriphClk/Intr
|
-- inAck: out std_logic; -- PtrClk/PeriphClk/Intr
|
iBusy: out std_logic; -- PtrBusy/PeriphAck/nWait
|
iBusy: out std_logic; -- PtrBusy/PeriphAck/nWait
|
-- iPError: out std_logic; -- AckData/nAckReverse
|
-- iPError: out std_logic; -- AckData/nAckReverse
|
-- iSel: out std_logic; -- XFlag (Select)
|
-- iSel: out std_logic; -- XFlag (Select)
|
Line 55... |
Line 59... |
ACK_I: in std_logic ;
|
ACK_I: in std_logic ;
|
WE_O: out std_logic;
|
WE_O: out std_logic;
|
|
|
|
|
rst_pp: in std_logic -- reset desde la interfaz del puerto paralelo
|
rst_pp: in std_logic -- reset desde la interfaz del puerto paralelo
|
|
|
|
|
);
|
);
|
|
|
end eppwbn_wbn_side;
|
end eppwbn_wbn_side;
|
|
|
architecture con_registro of eppwbn_wbn_side is -- El dato es registrado en el core.
|
architecture con_registro of eppwbn_wbn_side is
|
|
|
|
|
signal adr_ack,data_ack: std_logic;
|
signal adr_ack,data_ack: std_logic;
|
signal adr_reg,data_reg: std_logic_vector (7 downto 0); -- deben crearse dos registros de lectrura/escritura
|
signal adr_reg,data_reg: std_logic_vector (7 downto 0); -- registros internos temporales
|
signal pre_STB_O: std_logic; -- señal previa a STB_O
|
signal pre_STB_O: std_logic; -- registro que maneja a STB_O
|
|
|
begin
|
begin
|
|
|
iBusy <= adr_ack or data_ack; -- nWait. Se utiliza para confirmación de lectuira/escritura de datos/direcciones
|
iBusy <= adr_ack or data_ack; -- nWait. Se utiliza para confirmación de lectura/escritura de datos/direcciones
|
WE_O <= not(inStrobe); -- Ambas señales tienen la misma utilidad, habilitan escritura
|
WE_O <= not(inStrobe); -- Ambas señales tienen la misma utilidad, habilitan escritura
|
|
STB_O <= pre_STB_O ;
|
|
CYC_O <= pre_STB_O;
|
|
DAT_O <= data_reg; -- se utiliza el mismo registro para salida de datos
|
|
-- a wishbone, lectura y escritura de datos desde epp
|
|
|
-- Data R/W
|
-- Data R/W
|
data_strobing: process (inAutoFd, ACK_I, CLK_I, pre_STB_O, RST_I, rst_pp)
|
data_strobing: process (inAutoFd, ACK_I, CLK_I, pre_STB_O, RST_I, rst_pp, data_ack,inStrobe,iData)
|
begin
|
begin
|
|
|
if (rst_pp = '1' or RST_I = '1') then -- Reset de interfaz EPP
|
if (rst_pp = '1') then -- Reset de desde interfaz EPP asíncrono
|
data_reg <= (others => '0');
|
data_reg <= (others => '0');
|
pre_STB_O <= '0';
|
pre_STB_O <= '0';
|
data_ack <= '0';
|
data_ack <= '0';
|
|
|
|
elsif inAutoFd = '0' and data_ack = '0' and pre_STB_O = '0' then -- Data strobe
|
|
if (inStrobe = '0') then -- Escritura EPP
|
|
data_reg <= iData;
|
|
end if;
|
|
pre_STB_O <= '1';
|
|
elsif inAutoFd = '1' and data_ack = '1' then -- iBusy solo se pondrá a cero
|
|
data_ack <= '0';
|
|
-- Se indica el la comprobación de data_ack = '1' para forzar a la herramienta
|
|
-- de síntesis a crear un registro.
|
|
|
elsif (CLK_I'event and CLK_I = '1') then
|
elsif (CLK_I'event and CLK_I = '1') then
|
if RST_I = '1' then
|
if RST_I = '1' then
|
data_reg <= (others => '0');
|
data_reg <= (others => '0');
|
pre_STB_O <= '0';
|
pre_STB_O <= '0';
|
data_ack <= '0';
|
data_ack <= '0';
|
else
|
else
|
if (inAutoFd = '0' and data_ack = '0') then -- Data strobe
|
|
pre_STB_O <= '1';
|
|
if (inStrobe = '0') then -- Escritura EPP
|
|
data_reg <= iData;
|
|
end if;
|
|
end if;
|
|
if (ACK_I = '1' and pre_STB_O = '1') then -- Dato escrito o leído
|
if (ACK_I = '1' and pre_STB_O = '1') then -- Dato escrito o leído
|
pre_STB_O <= '0';
|
pre_STB_O <= '0';
|
data_ack <= '1';
|
data_ack <= '1';
|
if (inStrobe = '1') then -- Lectura EPP
|
if (inStrobe = '1') then -- Lectura EPP
|
data_reg <= DAT_I;
|
data_reg <= DAT_I;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
end if;
|
if (inAutoFd = '1' and data_ack = '1') then -- iBusy solo se pondrá a cero
|
|
data_ack <= '0'; -- una vez que haya respuesta desde la PC
|
|
end if;
|
|
|
|
end process;
|
end process;
|
STB_O <= pre_STB_O;
|
|
CYC_O <= pre_STB_O;
|
|
DAT_O <= data_reg; -- se utiliza el mismo registro para salida de datos
|
|
-- a wishbone, lectura y escritura de datos desde epp
|
|
|
|
|
|
-- Adr R/W
|
-- Adr R/W
|
adr_ack <= not(inSelectIn); -- Autoconfirmación de estado.
|
adr_ack <= not(inSelectIn); -- Autoconfirmación de estado.
|
adr_strobing: process (inSelectIn, RST_I, rst_pp)
|
adr_strobing: process (inSelectIn, RST_I, rst_pp,inStrobe,iData)
|
begin
|
begin
|
if (RST_I = '1' or rst_pp = '1') then
|
if (RST_I = '1' or rst_pp = '1') then
|
adr_reg <= (others => '0');
|
adr_reg <= (others => '0');
|
elsif (inSelectIn'event and inSelectIn = '1') then -- Adr strobe
|
elsif (inSelectIn'event and inSelectIn = '1') then -- Adr strobe
|
if inStrobe = '0' then
|
if inStrobe = '0' then
|