1 |
2 |
tarookumic |
--============================================================================--
|
2 |
|
|
-- Design unit : AMBA (Package declaration)
|
3 |
|
|
--
|
4 |
|
|
-- File name : amba.vhd
|
5 |
|
|
--
|
6 |
|
|
-- Purpose : This package declares types to be used with the
|
7 |
|
|
-- Advanced Microcontroller Bus Architecture (AMBA).
|
8 |
|
|
--
|
9 |
|
|
-- Reference : AMBA(TM) Specification (Rev 2.0), ARM IHI 0011A,
|
10 |
|
|
-- 13th May 1999, issue A, first release, ARM Limited
|
11 |
|
|
--
|
12 |
|
|
-- The document can be retrieved from http://www.arm.com
|
13 |
|
|
--
|
14 |
|
|
-- AMBA is a trademark of ARM Limited.
|
15 |
|
|
-- ARM is a registered trademark of ARM Limited.
|
16 |
|
|
--
|
17 |
|
|
-- Note : Naming convention according to AMBA(TM) Specification:
|
18 |
|
|
-- Signal names are in upper case, except for the following:
|
19 |
|
|
-- A lower case 'n' in the name indicates that the signal
|
20 |
|
|
-- is active low.
|
21 |
|
|
-- Constant names are in upper case.
|
22 |
|
|
--
|
23 |
|
|
-- The least significant bit of an array is located to the right,
|
24 |
|
|
-- carrying the index number zero.
|
25 |
|
|
--
|
26 |
|
|
-- Library : AMBA_Lib {recommended}
|
27 |
|
|
--
|
28 |
|
|
-- Author : European Space Agency (ESA)
|
29 |
|
|
-- P.O. Box 299
|
30 |
|
|
-- NL-2200 AG Noordwijk ZH
|
31 |
|
|
-- The Netherlands
|
32 |
|
|
--
|
33 |
|
|
-- Contact : mailto:microelectronics@estec.esa.int
|
34 |
|
|
-- http://www.estec.esa.int/microelectronics
|
35 |
|
|
--
|
36 |
|
|
-- Copyright (C): European Space Agency (ESA) 2000.
|
37 |
|
|
-- This source code is free software; you can redistribute it
|
38 |
|
|
-- and/or modify it under the terms of the GNU Lesser General
|
39 |
|
|
-- Public License as published by the Free Software Foundation;
|
40 |
|
|
-- either version 2 of the License, or (at your option) any
|
41 |
|
|
-- later version. For full details of the license see file
|
42 |
|
|
-- http://www.estec.esa.int/microelectronics/core/copying.lgpl
|
43 |
|
|
--
|
44 |
|
|
-- It is recommended that any use of this VHDL source code is
|
45 |
|
|
-- reported to the European Space Agency. It is also recommended
|
46 |
|
|
-- that any use of the VHDL source code properly acknowledges the
|
47 |
|
|
-- European Space Agency as originator.
|
48 |
|
|
--
|
49 |
|
|
-- Disclaimer : All information is provided "as is", there is no warranty that
|
50 |
|
|
-- the information is correct or suitable for any purpose,
|
51 |
|
|
-- neither implicit nor explicit. This information does not
|
52 |
|
|
-- necessarily reflect the policy of the European Space Agency.
|
53 |
|
|
--------------------------------------------------------------------------------
|
54 |
|
|
-- Version Author Date Changes
|
55 |
|
|
--
|
56 |
|
|
-- 0.2 ESA 5 Jul 2000 Package created
|
57 |
|
|
-- 0.3 ESA 10 Jul 2000 Additional HREADY slave input,
|
58 |
|
|
-- Std_ULogic usage for non-array signals,
|
59 |
|
|
-- Additional comments on casing and addressing
|
60 |
|
|
-- 0.4 ESA 14 Jul 2000 HRESETn removed from AHB Slave input record
|
61 |
|
|
-- Additional comments on clocking and reset
|
62 |
|
|
-- Additional comments on AHB endianness
|
63 |
|
|
-- Additional comments on APB addressing
|
64 |
|
|
-- 0.5 ESA 30 Aug 2000 Vector types for AHB arbiter/decoder and
|
65 |
|
|
-- APB bridge refined and corresponding
|
66 |
|
|
-- record types removed
|
67 |
|
|
-- Name suffix 'x' removed
|
68 |
|
|
-- ESA 04 Feb 2002 Changed copyright text
|
69 |
|
|
--------------------------------------------------------------------------------
|
70 |
|
|
|
71 |
|
|
library IEEE;
|
72 |
|
|
use IEEE.Std_Logic_1164.all;
|
73 |
|
|
|
74 |
|
|
package AMBA is
|
75 |
|
|
-----------------------------------------------------------------------------
|
76 |
|
|
-- Definitions for AMBA(TM) Advanced High-performance Bus (AHB)
|
77 |
|
|
-----------------------------------------------------------------------------
|
78 |
|
|
-- Records are defined for the input and output of an AHB Master, as well as
|
79 |
|
|
-- for an AHB Slave. These records are grouped in arrays, for scalability,
|
80 |
|
|
-- and new records using these arrays are defined for the input and output of
|
81 |
|
|
-- an AHB Arbiter/Decoder.
|
82 |
|
|
--
|
83 |
|
|
-- The routing of the clock and reset signals defined in the AMBA(TM)
|
84 |
|
|
-- Specification is not covered in this package, since being dependent on
|
85 |
|
|
-- the clock and reset conventions defined at system level.
|
86 |
|
|
--
|
87 |
|
|
-- The HCLK and HRESETn signals are routed separately:
|
88 |
|
|
-- HCLK: Std_ULogic; -- rising edge
|
89 |
|
|
-- HRESETn: Std_ULogic; -- active low reset
|
90 |
|
|
--
|
91 |
|
|
-- The address bus HADDR contains byte addresses. The relation between the
|
92 |
|
|
-- byte address and the n-byte data bus HDATA can either be little-endian or
|
93 |
|
|
-- big-endian according to the AMBA(TM) Specification.
|
94 |
|
|
--
|
95 |
|
|
-- It is recommended that only big-endian modules are implemented using
|
96 |
|
|
-- this package.
|
97 |
|
|
--
|
98 |
|
|
-----------------------------------------------------------------------------
|
99 |
|
|
-- Constant definitions for AMBA(TM) AHB
|
100 |
|
|
-----------------------------------------------------------------------------
|
101 |
|
|
constant HDMAX: Positive range 32 to 1024 := 32; -- data width
|
102 |
|
|
constant HAMAX: Positive range 32 to 32 := 32; -- address width
|
103 |
|
|
|
104 |
|
|
-----------------------------------------------------------------------------
|
105 |
|
|
-- Definitions for AMBA(TM) AHB Masters
|
106 |
|
|
-----------------------------------------------------------------------------
|
107 |
|
|
-- AHB master inputs (HCLK and HRESETn routed separately)
|
108 |
|
|
type AHB_Mst_In_Type is
|
109 |
|
|
record
|
110 |
|
|
HGRANT: Std_ULogic; -- bus grant
|
111 |
|
|
HREADY: Std_ULogic; -- transfer done
|
112 |
|
|
HRESP: Std_Logic_Vector(1 downto 0); -- response type
|
113 |
|
|
HRDATA: Std_Logic_Vector(HDMAX-1 downto 0); -- read data bus
|
114 |
|
|
end record;
|
115 |
|
|
|
116 |
|
|
-- AHB master outputs
|
117 |
|
|
type AHB_Mst_Out_Type is
|
118 |
|
|
record
|
119 |
|
|
HBUSREQ: Std_ULogic; -- bus request
|
120 |
|
|
HLOCK: Std_ULogic; -- lock request
|
121 |
|
|
HTRANS: Std_Logic_Vector(1 downto 0); -- transfer type
|
122 |
|
|
HADDR: Std_Logic_Vector(HAMAX-1 downto 0); -- address bus (byte)
|
123 |
|
|
HWRITE: Std_ULogic; -- read/write
|
124 |
|
|
HSIZE: Std_Logic_Vector(2 downto 0); -- transfer size
|
125 |
|
|
HBURST: Std_Logic_Vector(2 downto 0); -- burst type
|
126 |
|
|
HPROT: Std_Logic_Vector(3 downto 0); -- protection control
|
127 |
|
|
HWDATA: Std_Logic_Vector(HDMAX-1 downto 0); -- write data bus
|
128 |
|
|
end record;
|
129 |
|
|
|
130 |
|
|
-----------------------------------------------------------------------------
|
131 |
|
|
-- Definitions for AMBA(TM) AHB Slaves
|
132 |
|
|
-----------------------------------------------------------------------------
|
133 |
|
|
-- AHB slave inputs (HCLK and HRESETn routed separately)
|
134 |
|
|
type AHB_Slv_In_Type is
|
135 |
|
|
record
|
136 |
|
|
HSEL: Std_ULogic; -- slave select
|
137 |
|
|
HADDR: Std_Logic_Vector(HAMAX-1 downto 0); -- address bus (byte)
|
138 |
|
|
HWRITE: Std_ULogic; -- read/write
|
139 |
|
|
HTRANS: Std_Logic_Vector(1 downto 0); -- transfer type
|
140 |
|
|
HSIZE: Std_Logic_Vector(2 downto 0); -- transfer size
|
141 |
|
|
HBURST: Std_Logic_Vector(2 downto 0); -- burst type
|
142 |
|
|
HWDATA: Std_Logic_Vector(HDMAX-1 downto 0); -- write data bus
|
143 |
|
|
HPROT: Std_Logic_Vector(3 downto 0); -- protection control
|
144 |
|
|
HREADY: Std_ULogic; -- transfer done
|
145 |
|
|
HMASTER: Std_Logic_Vector(3 downto 0); -- current master
|
146 |
|
|
HMASTLOCK: Std_ULogic; -- locked access
|
147 |
|
|
end record;
|
148 |
|
|
|
149 |
|
|
-- AHB slave outputs
|
150 |
|
|
type AHB_Slv_Out_Type is
|
151 |
|
|
record
|
152 |
|
|
HREADY: Std_ULogic; -- transfer done
|
153 |
|
|
HRESP: Std_Logic_Vector(1 downto 0); -- response type
|
154 |
|
|
HRDATA: Std_Logic_Vector(HDMAX-1 downto 0); -- read data bus
|
155 |
|
|
HSPLIT: Std_Logic_Vector(15 downto 0); -- split completion
|
156 |
|
|
end record;
|
157 |
|
|
|
158 |
|
|
-----------------------------------------------------------------------------
|
159 |
|
|
-- Definitions for AMBA(TM) AHB Arbiter/Decoder
|
160 |
|
|
-----------------------------------------------------------------------------
|
161 |
|
|
-- supporting array types
|
162 |
|
|
type AHB_Mst_In_Vector is array (Natural range <> ) of AHB_Mst_In_Type;
|
163 |
|
|
type AHB_Mst_Out_Vector is array (Natural range <> ) of AHB_Mst_Out_Type;
|
164 |
|
|
type AHB_Slv_In_Vector is array (Natural range <> ) of AHB_Slv_In_Type;
|
165 |
|
|
type AHB_Slv_Out_Vector is array (Natural range <> ) of AHB_Slv_Out_Type;
|
166 |
|
|
|
167 |
|
|
-----------------------------------------------------------------------------
|
168 |
|
|
-- Auxiliary constant definitions for AMBA(TM) AHB
|
169 |
|
|
-----------------------------------------------------------------------------
|
170 |
|
|
-- constants for HTRANS (transition type, slave output)
|
171 |
|
|
constant HTRANS_IDLE: Std_Logic_Vector(1 downto 0) := "00";
|
172 |
|
|
constant HTRANS_BUSY: Std_Logic_Vector(1 downto 0) := "01";
|
173 |
|
|
constant HTRANS_NONSEQ: Std_Logic_Vector(1 downto 0) := "10";
|
174 |
|
|
constant HTRANS_SEQ: Std_Logic_Vector(1 downto 0) := "11";
|
175 |
|
|
|
176 |
|
|
-- constants for HBURST (burst type, master output)
|
177 |
|
|
constant HBURST_SINGLE: Std_Logic_Vector(2 downto 0) := "000";
|
178 |
|
|
constant HBURST_INCR: Std_Logic_Vector(2 downto 0) := "001";
|
179 |
|
|
constant HBURST_WRAP4: Std_Logic_Vector(2 downto 0) := "010";
|
180 |
|
|
constant HBURST_INCR4: Std_Logic_Vector(2 downto 0) := "011";
|
181 |
|
|
constant HBURST_WRAP8: Std_Logic_Vector(2 downto 0) := "100";
|
182 |
|
|
constant HBURST_INCR8: Std_Logic_Vector(2 downto 0) := "101";
|
183 |
|
|
constant HBURST_WRAP16: Std_Logic_Vector(2 downto 0) := "110";
|
184 |
|
|
constant HBURST_INCR16: Std_Logic_Vector(2 downto 0) := "111";
|
185 |
|
|
|
186 |
|
|
-- constants for HSIZE (transfer size, master output)
|
187 |
|
|
constant HSIZE_BYTE: Std_Logic_Vector(2 downto 0) := "000";
|
188 |
|
|
constant HSIZE_HWORD: Std_Logic_Vector(2 downto 0) := "001";
|
189 |
|
|
constant HSIZE_WORD: Std_Logic_Vector(2 downto 0) := "010";
|
190 |
|
|
constant HSIZE_DWORD: Std_Logic_Vector(2 downto 0) := "011";
|
191 |
|
|
constant HSIZE_4WORD: Std_Logic_Vector(2 downto 0) := "100";
|
192 |
|
|
constant HSIZE_8WORD: Std_Logic_Vector(2 downto 0) := "101";
|
193 |
|
|
constant HSIZE_16WORD: Std_Logic_Vector(2 downto 0) := "110";
|
194 |
|
|
constant HSIZE_32WORD: Std_Logic_Vector(2 downto 0) := "111";
|
195 |
|
|
|
196 |
|
|
-- constants for HRESP (response, slave output)
|
197 |
|
|
constant HRESP_OKAY: Std_Logic_Vector(1 downto 0) := "00";
|
198 |
|
|
constant HRESP_ERROR: Std_Logic_Vector(1 downto 0) := "01";
|
199 |
|
|
constant HRESP_RETRY: Std_Logic_Vector(1 downto 0) := "10";
|
200 |
|
|
constant HRESP_SPLIT: Std_Logic_Vector(1 downto 0) := "11";
|
201 |
|
|
|
202 |
|
|
-----------------------------------------------------------------------------
|
203 |
|
|
-- Definitions for AMBA(TM) Advanced Peripheral Bus (APB)
|
204 |
|
|
-----------------------------------------------------------------------------
|
205 |
|
|
-- Records are defined for the input and output of an APB Slave. These
|
206 |
|
|
-- records are grouped in arrays, for scalability, and new records using
|
207 |
|
|
-- these arrays are defined for the input and output of an APB Bridge.
|
208 |
|
|
--
|
209 |
|
|
-- The routing of the clock and reset signals defined in the AMBA(TM)
|
210 |
|
|
-- Specification is not covered in this package, since being dependent on
|
211 |
|
|
-- the clock and reset conventions defined at system level.
|
212 |
|
|
--
|
213 |
|
|
-- The PCLK and PRESETn signals are routed separately:
|
214 |
|
|
-- PCLK: Std_ULogic; -- rising edge
|
215 |
|
|
-- PRESETn: Std_ULogic; -- active low reset
|
216 |
|
|
--
|
217 |
|
|
-- The characteristics of the address bus PADDR are undefined in the
|
218 |
|
|
-- AMBA(TM) Specification.
|
219 |
|
|
--
|
220 |
|
|
-- When implementing modules with this package, it is recommended that the
|
221 |
|
|
-- information on the address bus PADDR is interpreted as byte addresses, but
|
222 |
|
|
-- it should only be used for 32-bit word addressing, i.e. the value of
|
223 |
|
|
-- address bits 0 and 1 should always be logical 0. For modules not
|
224 |
|
|
-- supporting full 32-bit words on the data bus PDATA, e.g. only supporting
|
225 |
|
|
-- 16-bit halfwords or 8-bit bytes, the addressing will still be word based.
|
226 |
|
|
-- Consequently, one halfword or byte will be accessed for each word address.
|
227 |
|
|
-- Modules only supporting byte sized data should exchange data on bit 7 to 0
|
228 |
|
|
-- on the PDATA data bus. Modules only supporting halfword sized data should
|
229 |
|
|
-- exchange data on bit 15 to 0 on the PDATA data bus. Modules supporting
|
230 |
|
|
-- word sized data should exchange data on bit 31 to 0 on the PDATA data bus.
|
231 |
|
|
--
|
232 |
|
|
-----------------------------------------------------------------------------
|
233 |
|
|
-- Constant definitions for AMBA(TM) APB
|
234 |
|
|
-----------------------------------------------------------------------------
|
235 |
|
|
constant PDMAX: Positive range 8 to 32 := 32; -- data width
|
236 |
|
|
constant PAMAX: Positive range 8 to 32 := 32; -- address width
|
237 |
|
|
|
238 |
|
|
-----------------------------------------------------------------------------
|
239 |
|
|
-- Definitions for AMBA(TM) APB Slaves
|
240 |
|
|
-----------------------------------------------------------------------------
|
241 |
|
|
-- APB slave inputs (PCLK and PRESETn routed separately)
|
242 |
|
|
type APB_Slv_In_Type is
|
243 |
|
|
record
|
244 |
|
|
PSEL: Std_ULogic; -- slave select
|
245 |
|
|
PENABLE: Std_ULogic; -- strobe
|
246 |
|
|
PADDR: Std_Logic_Vector(PAMAX-1 downto 0); -- address bus (byte)
|
247 |
|
|
PWRITE: Std_ULogic; -- write
|
248 |
|
|
PWDATA: Std_Logic_Vector(PDMAX-1 downto 0); -- write data bus
|
249 |
|
|
end record;
|
250 |
|
|
|
251 |
|
|
-- APB slave outputs
|
252 |
|
|
type APB_Slv_Out_Type is
|
253 |
|
|
record
|
254 |
|
|
PRDATA: Std_Logic_Vector(PDMAX-1 downto 0); -- read data bus
|
255 |
|
|
end record;
|
256 |
|
|
|
257 |
|
|
-----------------------------------------------------------------------------
|
258 |
|
|
-- Definitions for AMBA(TM) APB Bridge
|
259 |
|
|
-----------------------------------------------------------------------------
|
260 |
|
|
-- supporting array types
|
261 |
|
|
type APB_Slv_In_Vector is array (Natural range <> ) of APB_Slv_In_Type;
|
262 |
|
|
type APB_Slv_Out_Vector is array (Natural range <> ) of APB_Slv_Out_Type;
|
263 |
|
|
|
264 |
|
|
end AMBA; --==================================================================--
|