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 8

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

Line No. Rev Author Line
1 8 budinero
 
2
--------------------------------------------------------------------------------
3
-- UNSL
4
--
5
-- File: eppwbn_wbn_side.vhd
6
-- File history:
7
--      See cvs history in opencores
8
--
9
-- Description: 
10
--      EPP- Wishbone bridge. This module is in the wishbone side.
11
--
12
-- Targeted device: Actel A3PR1500 <Die> <Package>
13
-- Author: Facundo Aguilera
14
--
15
-- GPL
16
--------------------------------------------------------------------------------
17
 
18
-- comments in spanish
19
 
20
library IEEE;
21
use IEEE.STD_LOGIC_1164.ALL;
22
use IEEE.STD_LOGIC_ARITH.ALL;
23
 
24
 
25
entity eppwbn_wbn_side is
26
port(
27
 
28
        -- salida al puerto epp
29
        inStrobe: in std_logic;                                         -- Nomenclatura IEEE Std. 1284 ECP/EPP (Compatibiliy)
30
                                                                                                -- HostClk/nWrite 
31
        iData: inout std_logic_vector (7 downto 0); -- AD8..1/AD8..1 (Data1..Data8)
32
        -- 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
        -- i indica misma señal de salida al puerto, aunque interna en el core y controlada por el bloque de control
43
 
44
        --  salida a la interface wishbone
45
        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
        rst_epp: in std_logic  -- reser de la interfaz EPP
57
 
58
 
59
        -- selección de posición del byte
60
 
61
);
62
 
63
end eppwbn_wbn_side;
64
 
65
architecture con_registro of eppwbn_wbn_side is  -- El dato es registrado en el core.
66
 
67
 
68
        signal adr_ack,data_ack: std_logic;
69
        signal adr_reg,data_reg: std_logic_vector (7 downto 0); -- deben crearse dos registros de lectrura/escritura
70
        signal pre_STB_O: std_logic; -- señal previa a STB_O
71
 
72
begin
73
 
74
        iBusy <= adr_ack or data_ack; -- nWait. Se utiliza para confirmación de lectuira/escritura de datos/direcciones
75
        WE_O <= not(inStrobe); -- Ambas señales tienen la misma utilidad, habilitan escritura
76
 
77
 
78
        -- Data R/W
79
        data_strobing: process (inAutoFd, ACK_I, CLK_I, pre_STB_O, RST_I, rst_epp)
80
        begin
81
                if (rst_epp = '1') then  -- Reset de interfaz EPP
82
                        data_reg <= "00000000";
83
                        pre_STB_O <= '0';
84
                        data_ack <= '0';
85
                elsif (CLK_I'event and CLK_I = '1') then
86
                        if (RST_I = '1') then   -- Reset de interfaz Wishbone
87
                                data_reg <= "00000000";
88
                                pre_STB_O <= '0';
89
                                data_ack <= '0';
90
                        else
91
                                if (inAutoFd = '0') then -- Data strobe
92
                                        pre_STB_O <= '1';
93
                                        if (inStrobe = '0') then -- Escritura EPP
94
                                                data_reg <= iData;
95
                                        end if;
96
                                end if;
97
                                if (ACK_I = '1' and pre_STB_O = '1') then -- Dato escrito o leído
98
                                        pre_STB_O <= '0';
99
                                        data_ack <= '1';
100
                                        if (inStrobe = '1') then -- Lectura EPP
101
                                                data_reg <= DAT_I;
102
                                        end if;
103
                                end if;
104
                        end if;
105
                end if;
106
                if (inAutoFd = '1' and data_ack = '1') then -- iBusy solo se pondrá a cero una vez que haya respuesta desde la PC
107
                        data_ack <= '0';
108
                end if;
109
        end process;
110
        STB_O <= pre_STB_O;
111
        CYC_O <= pre_STB_O;
112
        DAT_O <= data_reg;  -- se utiliza el mismo registro para salida de datos a wishbone, lectura y escritura de datos desde epp
113
 
114
 
115
        -- Adr R/W
116
        adr_ack <= not(inSelectIn); -- Autoconfirmación de estado.
117
        adr_strobing: process (inSelectIn, RST_I, rst_epp)
118
        begin
119
                if (RST_I = '1' or rst_epp = '1') then
120
                        adr_reg <= "00000000";
121
                elsif (inSelectIn'event and inSelectIn = '1') then -- Adr strobe
122
                        if inStrobe = '0' then
123
                                adr_reg <= iData;
124
                        end if;
125
                end if;
126
        end process;
127
        ADR_O <= adr_reg;
128
 
129
 
130
        -- Puerto bidireccional
131
        iData <= data_reg when (inStrobe = '1' and data_ack = '1') else
132
                         adr_reg when (inStrobe = '1' and adr_ack = '1') else
133
                         "ZZZZZZZZ";
134
 
135
 
136
 
137
end con_registro;

powered by: WebSVN 2.1.0

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