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

Subversion Repositories pci32tlite_oc

[/] [pci32tlite_oc/] [trunk/] [rtl/] [pcidec.vhd] - Blame information for rev 10

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 10 peio
--+-------------------------------------------------------------------------------------------------+
2
--|                                                                                                                                                                                                     |
3
--|  File:                      pcidec.vhd                                                                              |
4
--|                                                                                                                                                                                                     |
5
--|  Project:           pci32tLite                                                                                                                                              |
6
--|                                                                                                                                                                                                     |
7
--|  Description:       PCI decoder and PCI signals loader.                                                                                             |
8
--|                                     * LoaD signals: "ad" -> adr, cbe -> cmd.                                                |
9
--|                                     * Decode memory and configuration space.                                                                                |
10
--|                                                                                                                                                                                                     |
11
--+-------------------------------------------------------------------------------------------------+
12
 
13
--+-----------------------------------------------------------------+
14
--|                                                                                                                             |
15
--|  Copyright (C) 2005-2008 Peio Azkarate, peio.azkarate@gmail.com     | 
16
--|                                                                                                                             |
17
--|  This source file may be used and distributed without               |
18
--|  restriction provided that this copyright statement is not          |
19
--|  removed from the file and that any derivative work contains        |
20
--|  the original copyright notice and the associated disclaimer.       |
21
--|                                                                     |
22
--|  This source file is free software; you can redistribute it     |
23
--|  and/or modify it under the terms of the GNU Lesser General     |
24
--|  Public License as published by the Free Software Foundation;   |
25
--|  either version 2.1 of the License, or (at your option) any     |
26
--|  later version.                                                 |
27
--|                                                                                                                             |
28
--|  This source is distributed in the hope that it will be         |
29
--|  useful, but WITHOUT ANY WARRANTY; without even the implied     |
30
--|  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR        |
31
--|  PURPOSE.  See the GNU Lesser General Public License for more   |
32
--|  details.                                                       |
33
--|                                                                                                                             |
34
--|  You should have received a copy of the GNU Lesser General      |
35
--|  Public License along with this source; if not, download it     |
36
--|  from http://www.opencores.org/lgpl.shtml                       |
37
--|                                                                                                                             |
38
--+-----------------------------------------------------------------+ 
39
 
40
--+-----------------------------------------------------------------------------+
41
--|                                                                     LIBRARIES                                                                       |
42
--+-----------------------------------------------------------------------------+
43
 
44
library ieee;
45
use ieee.std_logic_1164.all;
46
 
47
 
48
--+-----------------------------------------------------------------------------+
49
--|                                                                     ENTITY                                                                          |
50
--+-----------------------------------------------------------------------------+
51
 
52
entity pcidec is
53
generic (
54
        BARS             : string := "1BARMEM"
55
);
56
port (
57
 
58
        -- General 
59
    clk_i               : in std_logic;
60
        rst_i           : in std_logic;
61
        -- pci 
62
        ad_i                    : in std_logic_vector(31 downto 0);
63
        cbe_i                   : in std_logic_vector(3 downto 0);
64
        idsel_i                 : in std_logic;
65
        -- control
66
        bar0_i                  : in std_logic_vector(31 downto 9);
67
        memEN_i                 : in std_logic;
68
        ioEN_i                  : in std_logic;
69
        pciadrLD_i              : in std_logic;
70
        adrcfg_o                : out std_logic;
71
        adrmem_o                : out std_logic;
72
        adr_o                   : out std_logic_vector(24 downto 0);
73
        cmd_o                   : out std_logic_vector(3 downto 0)
74
 
75
);
76
end pcidec;
77
 
78
 
79
architecture rtl of pcidec is
80
 
81
 
82
--+-----------------------------------------------------------------------------+
83
--|                                                                     COMPONENTS                                                                      |
84
--+-----------------------------------------------------------------------------+
85
--+-----------------------------------------------------------------------------+
86
--|                                                                     CONSTANTS                                                                       |
87
--+-----------------------------------------------------------------------------+
88
--+-----------------------------------------------------------------------------+
89
--|                                                                     SIGNALS                                                                         |
90
--+-----------------------------------------------------------------------------+
91
 
92
        signal adr                      : std_logic_vector(31 downto 0);
93
        signal cmd                      : std_logic_vector(3 downto 0);
94
        signal idsel_s          : std_logic;
95
        signal a1                       : std_logic;
96
        signal a0                       : std_logic;
97
 
98
begin
99
 
100
    --+-------------------------------------------------------------------------+
101
        --|  Load PCI Signals                                                                                                           |
102
    --+-------------------------------------------------------------------------+
103
 
104
        PCILD: process( rst_i, clk_i, ad_i, cbe_i, idsel_i )
105
        begin
106
 
107
                if( rst_i = '1' ) then
108
                        adr <= ( others => '1' );
109
                        cmd <= ( others => '1' );
110
                        idsel_s <= '0';
111
                elsif( rising_edge(clk_i) ) then
112
 
113
                        if ( pciadrLD_i = '1' ) then
114
 
115
                                adr <= ad_i;
116
                                cmd <= cbe_i;
117
                                idsel_s <= idsel_i;
118
 
119
                        end if;
120
                end if;
121
 
122
        end process PCILD;
123
 
124
 
125
 
126
 
127
    --+-------------------------------------------------------------------------+
128
    --|  Decoder                                                                                                                                |
129
    --+-------------------------------------------------------------------------+
130
 
131
        barmem_g: if (BARS="1BARMEM") generate
132
        adrmem_o <= '1' when (  ( memEN_i = '1' )
133
                                                and ( adr(31 downto 25) = bar0_i(31 downto 25) )
134
                                            and ( adr(1 downto 0) = "00" )
135
                                            and ( cmd(3 downto 1) = "011" )  )
136
                                        else '0';
137
        end generate;
138
 
139
        bario_g: if (BARS="1BARIO") generate
140
        adrmem_o <= '1' when (  ( ioEN_i = '1' )
141
                                                and ( adr(31 downto 16) = "0000000000000000")
142
                                                and ( adr(15 downto 9) = bar0_i(15 downto 9) )
143
                                            and ( cmd(3 downto 1) = "001" )  )
144
                                        else '0';
145
        end generate;
146
 
147
        adrcfg_o <= '1' when (  ( idsel_s = '1' )
148
                                            and ( adr(1 downto 0) = "00" )
149
                                            and ( cmd(3 downto 1) = "101" )  )
150
                                        else '0';
151
 
152
 
153
    --+-------------------------------------------------------------------------+
154
    --|  Adresses WB A(1)/A(0)                                                                                                  |
155
    --+-------------------------------------------------------------------------+
156
        barmema1a0_g: if (BARS="1BARMEM") generate
157
        a1 <= cbe_i(1) and cbe_i(0);
158
        a0 <= cbe_i(2) and cbe_i(0);
159
        end generate;
160
 
161
        barioa1a0_g: if (BARS="1BARIO") generate
162
        a1 <= adr(1);
163
        a0 <= adr(0);
164
        end generate;
165
 
166
 
167
    --+-------------------------------------------------------------------------+
168
        --|  Other outs                                                                                                                         |
169
    --+-------------------------------------------------------------------------+
170
 
171
        adr_o <= adr(24 downto 2) & a1 & a0;
172
        cmd_o <= cmd;
173
 
174
 
175
end rtl;

powered by: WebSVN 2.1.0

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