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

Subversion Repositories modular_oscilloscope

[/] [modular_oscilloscope/] [trunk/] [hdl/] [epp/] [eppwbn_wbn_side.vhd] - Blame information for rev 9

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

Line No. Rev Author Line
1 8 budinero
--------------------------------------------------------------------------------
2 9 budinero
-- UNSL - Modular Oscilloscope
3 8 budinero
--
4
-- File: eppwbn_wbn_side.vhd
5 9 budinero
-- Version: 0.20
6
-- Targeted device: Actel A3PE1500 
7
--------------------------------------------------------------------------------
8
-- Description:
9
--      EPP - Wishbone bridge. 
10
--      This module is in the wishbone side (IEEE Std. 1284-2000).
11
-------------------------------------------------------------------------------
12 8 budinero
-- File history:
13 9 budinero
--      0.01    | nov-2008 | First release
14
--------------------------------------------------------------------------------
15
-- Copyright Facundo Aguilera 2008
16 8 budinero
-- GPL
17
 
18
 
19 9 budinero
 
20 8 budinero
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22 9 budinero
--use IEEE.STD_LOGIC_ARITH.ALL;
23 8 budinero
 
24
 
25
entity eppwbn_wbn_side is
26
port(
27
 
28 9 budinero
        -- al puerto epp
29
        inStrobe: in std_logic;                                                                                 -- Nomenclatura IEEE Std. 1284, Negotiation/ECP/EPP (Compatibiliy)
30
                                                                                                                                                                                        -- HostClk/nWrite 
31 8 budinero
        iData: inout std_logic_vector (7 downto 0); -- AD8..1/AD8..1 (Data1..Data8)
32 9 budinero
        -- inAck: out std_logic;                                                                                -- PtrClk/PeriphClk/Intr
33
        iBusy: out std_logic;                                                                                   -- PtrBusy/PeriphAck/nWait
34
        -- iPError: out std_logic;                                                                      -- AckData/nAckReverse
35
        -- iSel: out std_logic;                                                                                 -- XFlag (Select)
36
        inAutoFd: in std_logic;                                                                                 -- HostBusy/HostAck/nDStrb
37
        -- iPeriphLogicH: out std_logic;                                                -- (Periph Logic High)
38
        -- inInit: in std_logic;                                                                                -- nReverseRequest
39
        -- inFault: out std_logic;                                                                      -- nDataAvail/nPeriphRequest
40
        inSelectIn: in std_logic;                                                                       -- 1284 Active/nAStrb
41
        -- iHostLogicH: in std_logic;                                                   -- (Host Logic High)
42 8 budinero
        -- i indica misma señal de salida al puerto, aunque interna en el core y controlada por el bloque de control
43
 
44 9 budinero
        --  a la interface wishbone
45 8 budinero
        RST_I: in std_logic;
46
        CLK_I: in std_logic;
47
        DAT_I: in std_logic_vector (7 downto 0);
48
        DAT_O: out std_logic_vector (7 downto 0);
49
        ADR_O: out std_logic_vector (7 downto 0);
50
        CYC_O: out std_logic;
51
        STB_O: out std_logic;
52
        ACK_I: in std_logic ;
53
        WE_O: out std_logic;
54
 
55
 
56 9 budinero
        rst_pp: in std_logic  -- reset desde la interfaz del puerto paralelo
57 8 budinero
 
58 9 budinero
 
59 8 budinero
);
60
 
61
end eppwbn_wbn_side;
62
 
63
architecture con_registro of eppwbn_wbn_side is  -- El dato es registrado en el core.
64
 
65
 
66
        signal adr_ack,data_ack: std_logic;
67
        signal adr_reg,data_reg: std_logic_vector (7 downto 0); -- deben crearse dos registros de lectrura/escritura
68
        signal pre_STB_O: std_logic; -- señal previa a STB_O
69
 
70
begin
71
 
72
        iBusy <= adr_ack or data_ack; -- nWait. Se utiliza para confirmación de lectuira/escritura de datos/direcciones
73
        WE_O <= not(inStrobe); -- Ambas señales tienen la misma utilidad, habilitan escritura
74
 
75
 
76
        -- Data R/W
77 9 budinero
        data_strobing: process (inAutoFd, ACK_I, CLK_I, pre_STB_O, RST_I, rst_pp)
78 8 budinero
        begin
79 9 budinero
                if (rst_pp = '1') then  -- Reset de interfaz EPP
80 8 budinero
                        data_reg <= "00000000";
81
                        pre_STB_O <= '0';
82
                        data_ack <= '0';
83
                elsif (CLK_I'event and CLK_I = '1') then
84
                        if (RST_I = '1') then   -- Reset de interfaz Wishbone
85
                                data_reg <= "00000000";
86
                                pre_STB_O <= '0';
87
                                data_ack <= '0';
88
                        else
89
                                if (inAutoFd = '0') then -- Data strobe
90
                                        pre_STB_O <= '1';
91
                                        if (inStrobe = '0') then -- Escritura EPP
92
                                                data_reg <= iData;
93
                                        end if;
94
                                end if;
95
                                if (ACK_I = '1' and pre_STB_O = '1') then -- Dato escrito o leído
96
                                        pre_STB_O <= '0';
97
                                        data_ack <= '1';
98
                                        if (inStrobe = '1') then -- Lectura EPP
99
                                                data_reg <= DAT_I;
100
                                        end if;
101
                                end if;
102
                        end if;
103
                end if;
104 9 budinero
                if (inAutoFd = '1' and data_ack = '1') then -- iBusy solo se pondrá a cero 
105
                        data_ack <= '0';                                                                                                 -- una vez que haya respuesta desde la PC
106 8 budinero
                end if;
107
        end process;
108
        STB_O <= pre_STB_O;
109
        CYC_O <= pre_STB_O;
110 9 budinero
        DAT_O <= data_reg;  -- se utiliza el mismo registro para salida de datos 
111
                                                                                        -- a wishbone, lectura y escritura de datos desde epp
112 8 budinero
 
113
 
114
        -- Adr R/W
115
        adr_ack <= not(inSelectIn); -- Autoconfirmación de estado.
116 9 budinero
        adr_strobing: process (inSelectIn, RST_I, rst_pp)
117 8 budinero
        begin
118 9 budinero
                if (RST_I = '1' or rst_pp = '1') then
119 8 budinero
                        adr_reg <= "00000000";
120
                elsif (inSelectIn'event and inSelectIn = '1') then -- Adr strobe
121
                        if inStrobe = '0' then
122
                                adr_reg <= iData;
123
                        end if;
124
                end if;
125
        end process;
126
        ADR_O <= adr_reg;
127
 
128
 
129
        -- Puerto bidireccional
130
        iData <= data_reg when (inStrobe = '1' and data_ack = '1') else
131
                         adr_reg when (inStrobe = '1' and adr_ack = '1') else
132
                         "ZZZZZZZZ";
133
 
134
 
135
 
136
end con_registro;

powered by: WebSVN 2.1.0

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