cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
topFMKU_pkg.vhdl
Go to the documentation of this file.
1 -- /*******************************************************************************
2 -- * Copyright 2016 -- 2022 IBM Corporation
3 -- *
4 -- * Licensed under the Apache License, Version 2.0 (the "License");
5 -- * you may not use this file except in compliance with the License.
6 -- * You may obtain a copy of the License at
7 -- *
8 -- * http://www.apache.org/licenses/LICENSE-2.0
9 -- *
10 -- * Unless required by applicable law or agreed to in writing, software
11 -- * distributed under the License is distributed on an "AS IS" BASIS,
12 -- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 -- * See the License for the specific language governing permissions and
14 -- * limitations under the License.
15 -- *******************************************************************************/
16 
17 -- *****************************************************************************
18 -- *
19 -- * cloudFPGA
20 -- *
21 -- *----------------------------------------------------------------------------
22 -- *
23 -- * Title : Shared package for the Flash design of the FMKU60.
24 -- *
25 -- * File : topFlash_pkg.vhdl
26 -- *
27 -- * Created : Feb. 2018
28 -- * Authors : Francois Abel <fab@zurich.ibm.com>
29 -- *
30 -- *****************************************************************************
31 
32 
33 --******************************************************************************
34 --** CONTEXT CLAUSE - FLASH_PKG
35 --******************************************************************************
36 library IEEE;
37 use IEEE.std_logic_1164.all;
38 use IEEE.numeric_std.all;
39 
40 
41 --******************************************************************************
42 --** PACKAGE DECALARATION - FLASH_PKG
43 --******************************************************************************
44 package topFMKU_pkg is
45 
46  ------------------------------------------------------------------------------
47  -- CONSTANTS & TYPES DEFINITION
48  ------------------------------------------------------------------------------
49 
50 
51  -----------------------------
52  -- FMKU60 / DDR4 Constants --
53  -----------------------------
54  constant cFMKU60_DDR4_NrOfChannels : integer := 2 ; -- The number of memory channels
55  constant cFMKU60_DDR4_ChannelSize : integer := 8*1024*1024 ; -- Size of memory channel (in bytes)
56 
57  -----------------------------
58  -- FMKU60 / MMIO Constants --
59  -----------------------------
60  constant cFMKU60_MMIO_AddrWidth : integer := 8 ; -- 8 bits
61  constant cFMKU60_MMIO_DataWidth : integer := 8 ; -- 8 bits
62 
63  ------------------------------------
64  -- FMKU60 / MMIO / EMIF Constants --
65  ------------------------------------
66  constant cFMKU60_EMIF_AddrWidth : integer := (cFMKU60_MMIO_AddrWidth-1); -- 7 bits
67  constant cFMKU60_EMIF_DataWidth : integer := cFMKU60_MMIO_DataWidth; -- 8 bits
68 
69  ------------------------------------
70  -- FMKU60 / SHELL / NTS Constants --
71  ------------------------------------
72  constant cFMKU60_SHELL_NTS_DataWidth : integer := 64;
73 
74  ------------------------------------
75  -- FMKU60 / SHELL / MEM Constants --
76  ------------------------------------
77  constant cFMKU60_SHELL_MEM_DataWidth : integer := 512;
78 
79 
80 
81  ------------------------------------
82  -- FMKU60 / TOP SubTypes --
83  ------------------------------------
84  subtype stTimeStamp is std_ulogic_vector(31 downto 0);
85  subtype stDate is std_ulogic_vector( 7 downto 0);
86 
87  ------------------------------------
88  -- FMKU60 / SHELL / MMIO SubTypes --
89  ------------------------------------
90  subtype stMmioAddr is std_ulogic_vector((cFMKU60_EMIF_AddrWidth-1) downto 0);
91  subtype stMmioData is std_ulogic_vector((cFMKU60_EMIF_DataWidth-1) downto 0);
92 
93  ------------------------------------------
94  -- FMKU60 / SHELL / MMIO /EMIF SubTypes --
95  ------------------------------------------
96  subtype stEmifAddr is std_ulogic_vector((cFMKU60_EMIF_AddrWidth-1) downto 0);
97  subtype stEmifData is std_ulogic_vector((cFMKU60_EMIF_DataWidth-1) downto 0);
98 
99 
100 
101  ----------------------------------------------------
102  -- FMKU60 / SHELL / NTS / AXI-Writre-Stream Types --
103  ----------------------------------------------------
104  type t_nts_axis is
105  record
106  tdata : std_ulogic_vector(cFMKU60_SHELL_NTS_DataWidth-1 downto 0);
107  tkeep : std_ulogic_vector((cFMKU60_SHELL_NTS_DataWidth/8)-1 downto 0);
108  tlast : std_ulogic;
109  tvalid : std_ulogic;
110  tready : std_ulogic;
111  end record;
112 
113  type t_mmio_addr is -- BPFC/MMIO Address Structure (18 bits)
114  record
115  unused : std_ulogic_vector(2 downto 0); -- ( 2: 0)
116  reg_num : std_ulogic_vector(5 downto 0); -- ( 8: 3)
117  ent_num : std_ulogic_vector(4 downto 0); -- (13: 9)
118  isl_num : std_ulogic_vector(3 downto 0); -- (17:14)
119  end record;
120 
121 
122  ----------------------------------------------------
123  -- FMKU60 / SHELL / MEM / AXI-Writre-Stream Types --
124  ----------------------------------------------------
125  type t_mem_axis is
126  record
127  tdata : std_ulogic_vector(cFMKU60_SHELL_MEM_DataWidth-1 downto 0);
128  tkeep : std_ulogic_vector((cFMKU60_SHELL_MEM_DataWidth/8)-1 downto 0);
129  tlast : std_ulogic;
130  tvalid : std_ulogic;
131  tready : std_ulogic;
132  end record;
133 
134 
135  ----------------------------------------------------------------------------
136  -- FUNCTIONS DECLARATION
137  ----------------------------------------------------------------------------
138 
139  ---------------------------------------
140  -- Logarithmic Function (with ceiling)
141  ---------------------------------------
142  function fLog2Ceil (n : integer)
143  return integer;
144 
145 
146 end topFMKU_pkg;
147 
148 
149 
150 
151 
152 --******************************************************************************
153 --** PACKAGE BODY - FLASH_PKG
154 --******************************************************************************
155 package body _topFMKU_pkg is
156 
157  -------------------------------------
158  -- Function fLog2Ceil()
159  -- Purpose: computes ceil(log2(n))
160  -------------------------------------
161  function fLog2Ceil (n : integer) return integer is
162  variable m, p : integer;
163  begin
164  m := 0;
165  p := 1;
166  for i in 0 to n loop
167  if p < n then
168  m := m + 1;
169  p := p * 2;
170  end if;
171  end loop;
172  return m;
173  end fLog2Ceil;
174 
175 end topFMKU_pkg;
176 
177 
178