1 |
2 |
tarookumic |
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
----------------------------------------------------------------------------
|
6 |
|
|
-- This file is a part of the LEON VHDL model
|
7 |
|
|
-- Copyright (C) 1999 European Space Agency (ESA)
|
8 |
|
|
--
|
9 |
|
|
-- This library is free software; you can redistribute it and/or
|
10 |
|
|
-- modify it under the terms of the GNU Lesser General Public
|
11 |
|
|
-- License as published by the Free Software Foundation; either
|
12 |
|
|
-- version 2 of the License, or (at your option) any later version.
|
13 |
|
|
--
|
14 |
|
|
-- See the file COPYING.LGPL for the full details of the license.
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
-----------------------------------------------------------------------------
|
18 |
|
|
-- Entity: config
|
19 |
|
|
-- File: config.vhd
|
20 |
|
|
-- Author: Jiri Gaisler - ESA/ESTEC
|
21 |
|
|
-- Description: LEON configuration package. Do NOT edit, all constants are
|
22 |
|
|
-- set from the target/device packages.
|
23 |
|
|
------------------------------------------------------------------------------
|
24 |
|
|
|
25 |
|
|
library IEEE;
|
26 |
|
|
use IEEE.std_logic_1164.all;
|
27 |
|
|
use IEEE.std_logic_arith.all;
|
28 |
|
|
use work.leon_target.all;
|
29 |
|
|
use work.leon_device.all;
|
30 |
|
|
--pragma translate_off
|
31 |
|
|
use std.textio.all;
|
32 |
|
|
--pragma translate_on
|
33 |
|
|
|
34 |
|
|
package leon_config is
|
35 |
|
|
|
36 |
|
|
----------------------------------------------------------------------------
|
37 |
|
|
-- log2 tables
|
38 |
|
|
----------------------------------------------------------------------------
|
39 |
|
|
|
40 |
|
|
type log2arr is array(1 to 64) of integer;
|
41 |
|
|
constant log2 : log2arr := (0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
|
42 |
|
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,others => 6);
|
43 |
|
|
constant log2x : log2arr := (1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,
|
44 |
|
|
5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,others => 6);
|
45 |
|
|
|
46 |
|
|
----------------------------------------------------------------------------
|
47 |
|
|
-- IU, FPU and CP implementation and version numbers
|
48 |
|
|
----------------------------------------------------------------------------
|
49 |
|
|
|
50 |
|
|
constant IMPL : unsigned(3 downto 0) := conv_unsigned(iu_config.impl,4);
|
51 |
|
|
constant VER : unsigned(3 downto 0) := conv_unsigned(iu_config.version,4);
|
52 |
|
|
constant FPUVER : unsigned(2 downto 0) := conv_unsigned(fpu_config.version,3);
|
53 |
|
|
constant CPVER : unsigned(2 downto 0) := (others => '0');--conv_unsigned(conf.cp.version,3);
|
54 |
|
|
--pragma translate_off
|
55 |
|
|
constant LEON_VERSION : string := "1.0.21-xst";
|
56 |
|
|
--pragma translate_on
|
57 |
|
|
|
58 |
|
|
----------------------------------------------------------------------------
|
59 |
|
|
-- debugging
|
60 |
|
|
----------------------------------------------------------------------------
|
61 |
|
|
|
62 |
|
|
constant DEBUGPORT : boolean := debug_config.enable; -- enable iu debug port
|
63 |
|
|
constant DEBUGUART : boolean := debug_config.uart; -- enable UART output to console
|
64 |
|
|
constant DEBUGIURF : boolean := debug_config.iureg; -- write IU results to console
|
65 |
|
|
constant DEBUGFPU : boolean := debug_config.fpureg; -- write FPU results to console
|
66 |
|
|
constant DEBUG_UNIT: boolean := debug_config.dsuenable;
|
67 |
|
|
constant TBUFABITS : integer := log2(debug_config.tracelines/64) + 6; -- buffer address bits
|
68 |
|
|
constant DSUTRACE : boolean := debug_config.dsutrace;
|
69 |
|
|
constant DSUMIXED : boolean := debug_config.dsumixed;
|
70 |
|
|
constant DSUDPRAM : boolean := debug_config.dsudpram;
|
71 |
|
|
constant NOHALT : boolean := debug_config.nohalt; -- dont halt on error
|
72 |
|
|
constant PCLOW : integer := debug_config.pclow;
|
73 |
|
|
|
74 |
|
|
constant XTARGET_TECH: targettechs := syn_config.targettech;
|
75 |
|
|
constant TARGET_TECH: targettechs := XTARGET_TECH;
|
76 |
|
|
constant TARGET_CLK : targettechs := syn_config.targetclk;
|
77 |
|
|
constant PLL_CLK_MUL: integer := syn_config.clk_mul;
|
78 |
|
|
constant PLL_CLK_DIV: integer := syn_config.clk_div;
|
79 |
|
|
constant INFER_RAM : boolean := syn_config.infer_ram;
|
80 |
|
|
constant INFER_REGF : boolean := syn_config.infer_regf;
|
81 |
|
|
constant INFER_ROM : boolean := syn_config.infer_rom;
|
82 |
|
|
constant INFER_PADS : boolean := syn_config.infer_pads;
|
83 |
|
|
constant INFER_PCI_PADS : boolean := syn_config.infer_pci;
|
84 |
|
|
constant INFER_MULT : boolean := syn_config.infer_mult;
|
85 |
|
|
constant RFIMPTYPE : integer := syn_config.rftype;
|
86 |
|
|
constant XNWINDOWS : integer range 2 to 32 := iu_config.nwindows;
|
87 |
|
|
constant NWINDOWS : integer range 2 to 32 := XNWINDOWS;
|
88 |
|
|
constant NWINLOG2 : integer range 1 to 5 := log2(NWINDOWS);
|
89 |
|
|
constant RABITS : integer := log2(NWINDOWS+1) + 4; -- # regfile address bits
|
90 |
|
|
|
91 |
|
|
constant RDBITS : integer := 32; -- data width
|
92 |
|
|
|
93 |
|
|
constant MULTIPLIER : multypes := iu_config.multiplier;
|
94 |
|
|
constant MULPIPE : boolean := iu_config.mulpipe and (MULTIPLIER = m16x16) and not INFER_MULT;
|
95 |
|
|
constant DIVIDER : divtypes := iu_config.divider;
|
96 |
|
|
constant MACEN : boolean := iu_config.mac and (MULTIPLIER = m16x16) and not MULPIPE;
|
97 |
|
|
|
98 |
|
|
constant FPEN : boolean := (fpu_config.interface /= none);
|
99 |
|
|
constant FPCORE : fpucoretype := fpu_config.core;
|
100 |
|
|
constant FPIFTYPE : fpuiftype := fpu_config.interface;
|
101 |
|
|
constant FPREG : integer := fpu_config.fregs;
|
102 |
|
|
constant CPEN : boolean := iu_config.cpen;
|
103 |
|
|
constant CWPOPT : boolean := (NWINDOWS = (2**NWINLOG2));
|
104 |
|
|
constant IREGNUM : integer := NWINDOWS * 16 + FPREG + 8;-- number of registers in regfile
|
105 |
|
|
|
106 |
|
|
type cache_replalgbits_type is array (cache_replace_type range lru to rnd) of integer;
|
107 |
|
|
type lru_bits_type is array(1 to 4) of integer;
|
108 |
|
|
constant lru_table : lru_bits_type := (1,1,3,5);
|
109 |
|
|
constant CREPLALG_TBL : cache_replalgbits_type := (lru => 0, lrr => 1, rnd => 0); -- # of extra bits in
|
110 |
|
|
|
111 |
|
|
--constant ISETS : integer range 1 to 4 := cache_config.isets; -- # of icache sets
|
112 |
|
|
constant XISETS : integer range 1 to 4 := cache_config.isets; -- # of icache sets
|
113 |
|
|
constant ISETS : integer range 1 to 4 := XISETS; -- # of icache sets
|
114 |
|
|
constant XILINE_SIZE : integer range 2 to 8 := cache_config.ilinesize;
|
115 |
|
|
constant ILINE_SIZE : integer range 2 to 8 := XILINE_SIZE;
|
116 |
|
|
constant ILINE_BITS : integer := log2(ILINE_SIZE);
|
117 |
|
|
constant XISET_SIZE : integer range 1 to 64 := cache_config.isetsize;
|
118 |
|
|
constant ISET_SIZE : integer range 1 to 64 := XISET_SIZE;
|
119 |
|
|
constant IOFFSET_BITS : integer := 8 +log2(ISET_SIZE) - ILINE_BITS;
|
120 |
|
|
constant ITAG_HIGH : integer := 31;
|
121 |
|
|
constant ITAG_BITS : integer := ITAG_HIGH - IOFFSET_BITS - ILINE_BITS - 2 +
|
122 |
|
|
ILINE_SIZE + 1;
|
123 |
|
|
constant ICREPLACE : cache_replace_type := cache_config.ireplace; -- replacement algorithm
|
124 |
|
|
constant ILRUBITS : integer := lru_table(ISETS);
|
125 |
|
|
constant ILRR_BIT : integer := CREPLALG_TBL(ICREPLACE);
|
126 |
|
|
constant ICTAG_LRRPOS : integer := 9;
|
127 |
|
|
constant ICTAG_LOCKPOS : integer := 8;
|
128 |
|
|
constant ICLOCK_BIT : integer := cache_config.ilock;
|
129 |
|
|
|
130 |
|
|
--constant DSETS : integer range 1 to 4 := cache_config.dsets; -- # of dcache sets
|
131 |
|
|
constant XDSETS : integer range 1 to 4 := cache_config.dsets; -- # of dcache sets
|
132 |
|
|
constant DSETS : integer range 1 to 4 := XDSETS; -- synopsys bug !!!
|
133 |
|
|
constant XDLINE_SIZE : integer range 2 to 8 := cache_config.dlinesize;
|
134 |
|
|
constant DLINE_SIZE : integer range 2 to 8 := XDLINE_SIZE;
|
135 |
|
|
constant DLINE_BITS : integer := log2(DLINE_SIZE);
|
136 |
|
|
constant XDSET_SIZE : integer range 1 to 64 := cache_config.dsetsize;
|
137 |
|
|
constant DSET_SIZE : integer range 1 to 64 := XDSET_SIZE;
|
138 |
|
|
constant DOFFSET_BITS : integer := 8 +log2(DSET_SIZE) - DLINE_BITS;
|
139 |
|
|
constant DTAG_HIGH : integer := 31;
|
140 |
|
|
constant DTAG_BITS : integer := DTAG_HIGH - DOFFSET_BITS - DLINE_BITS - 2 +
|
141 |
|
|
DLINE_SIZE + 1;
|
142 |
|
|
constant LOCAL_RAM : boolean := cache_config.dlram;
|
143 |
|
|
constant LOCAL_RAM_BITS : integer := log2(cache_config.dlramsize) + 8;
|
144 |
|
|
constant LOCAL_RAM_START : std_logic_vector(31 downto 24) :=
|
145 |
|
|
std_logic_vector(conv_unsigned(cache_config.dlramaddr, 8));
|
146 |
|
|
constant DCREPLACE : cache_replace_type := cache_config.dreplace; -- replacement algorithm
|
147 |
|
|
constant DLRUBITS : integer := lru_table(DSETS);
|
148 |
|
|
constant DLRR_BIT : integer := CREPLALG_TBL(DCREPLACE);
|
149 |
|
|
constant DCTAG_LRRPOS : integer := 9;
|
150 |
|
|
constant DCTAG_LOCKPOS : integer := 8;
|
151 |
|
|
constant DCLOCK_BIT : integer := cache_config.dlock;
|
152 |
|
|
constant DSNOOP : boolean := cache_config.dsnoop /= none;
|
153 |
|
|
constant DSNOOP_FAST : boolean := cache_config.dsnoop = fast;
|
154 |
|
|
constant DREAD_FAST : boolean := cache_config.drfast;
|
155 |
|
|
constant DWRITE_FAST : boolean := cache_config.dwfast;
|
156 |
|
|
--constant PROC_CACHETABLE : proc_cache_config_vector(0 to PROC_CACHE_MAX-1) := cachetbl_std;-- conf.cache.cachetable(0 to PROC_CACHE_MAX-1);
|
157 |
|
|
|
158 |
|
|
constant BUS8EN : boolean := mctrl_config.bus8en;
|
159 |
|
|
constant BUS16EN : boolean := mctrl_config.bus16en;
|
160 |
|
|
constant WENDFB : boolean := mctrl_config.wendfb;
|
161 |
|
|
constant RAMSEL5 : boolean := mctrl_config.ramsel5;
|
162 |
|
|
constant SDRAMEN : boolean := mctrl_config.sdramen;
|
163 |
|
|
constant SDINVCLK : boolean := mctrl_config.sdinvclk;
|
164 |
|
|
|
165 |
|
|
constant BOOTOPT : boottype := boot_config.boot;
|
166 |
|
|
constant ITPRESC : integer := boot_config.sysclk/1000000 -1;
|
167 |
|
|
constant TPRESC : unsigned(15 downto 0) := conv_unsigned(ITPRESC, 16);
|
168 |
|
|
constant IUPRESC : integer := ((boot_config.sysclk*10)/(boot_config.baud*8)-5)/10;
|
169 |
|
|
constant UPRESC : unsigned(15 downto 0) := conv_unsigned(IUPRESC, 16);
|
170 |
|
|
constant BRAMRWS : unsigned(3 downto 0) := conv_unsigned(boot_config.ramrws, 4);
|
171 |
|
|
constant BRAMWWS : unsigned(3 downto 0) := conv_unsigned(boot_config.ramwws, 4);
|
172 |
|
|
constant EXTBAUD : boolean := boot_config.extbaud;
|
173 |
|
|
constant PABITS : integer := boot_config.pabits;
|
174 |
|
|
|
175 |
|
|
constant PCIEN : boolean := (pci_config.pcicore /= none);
|
176 |
|
|
constant PCICORE : pcitype := pci_config.pcicore;
|
177 |
|
|
constant PCIPMEEN : boolean := pci_config.pmepads;
|
178 |
|
|
constant PCI66PADEN : boolean := pci_config.p66pad;
|
179 |
|
|
constant PCIRSTALL : boolean := pci_config.pcirstall;
|
180 |
|
|
constant PCIMASTERS : integer := pci_config.ahbmasters;
|
181 |
|
|
constant PCI_CLKDLL : boolean := syn_config.pci_dll and PCIEN;
|
182 |
|
|
constant PCI_SYSCLK : boolean := syn_config.pci_sysclk and PCIEN;
|
183 |
|
|
|
184 |
|
|
constant ETHEN : boolean := peri_config.ethen;
|
185 |
|
|
constant WPROTEN : boolean := peri_config.wprot;
|
186 |
|
|
constant AHBSTATEN : boolean := peri_config.ahbstat;
|
187 |
|
|
constant AHBRAMEN : boolean := peri_config.ahbram;
|
188 |
|
|
constant AHBRAM_BITS : integer := peri_config.ahbrambits;
|
189 |
|
|
constant CFGREG : boolean := peri_config.cfgreg;
|
190 |
|
|
constant WDOGEN : boolean := peri_config.wdog;
|
191 |
|
|
constant IRQ2EN : boolean := peri_config.irq2en;
|
192 |
|
|
constant IRQ2CHAN : integer range 1 to 32 := 1;--rq2cfg.channels;
|
193 |
|
|
constant IRQ2TBL : irq_filter_vec := irq2none.filter;--conf.peri_config.irq2cfg.filter;
|
194 |
|
|
|
195 |
|
|
constant FASTJUMP : boolean := iu_config.fastjump;
|
196 |
|
|
constant ICC_HOLD : boolean := iu_config.icchold;
|
197 |
|
|
constant LDDELAY : integer range 1 to 2 := iu_config.lddelay;
|
198 |
|
|
constant FASTDECODE : boolean := iu_config.fastdecode;
|
199 |
|
|
constant RF_LOWPOW : boolean := iu_config.rflowpow;
|
200 |
|
|
constant XWATCHPOINTS : integer range 0 to 4 := iu_config.watchpoints;
|
201 |
|
|
constant WATCHPOINTS : integer range 0 to 4 := XWATCHPOINTS;
|
202 |
|
|
|
203 |
|
|
type ahbslv_split_type is array (0 to AHB_SLV_MAX-1) of integer range 0 to 1;
|
204 |
|
|
|
205 |
|
|
constant AHBSLVADDR : ahbslv_addr_type := ahbrange_config;
|
206 |
|
|
constant AHBSLVSPLIT : ahbslv_split_type := (0,0,0,0,0,0,0);
|
207 |
|
|
constant XAHB_MASTERS : integer := ahb_config.masters;
|
208 |
|
|
constant AHB_MASTERS : integer := XAHB_MASTERS;
|
209 |
|
|
constant AHB_SPLIT : boolean := ahb_config.split;
|
210 |
|
|
constant AHB_DEFMST : integer := ahb_config.defmst;
|
211 |
|
|
constant AHBTST : boolean := ahb_config.testmod;
|
212 |
|
|
|
213 |
|
|
constant PCIARBEN : boolean := pci_config.arbiter;
|
214 |
|
|
constant XNB_AGENTS : natural range 3 to 32 := pci_config.pcimasters;
|
215 |
|
|
constant NB_AGENTS : natural range 3 to 32 := XNB_AGENTS;
|
216 |
|
|
constant ARB_LEVELS : positive range 1 to 4 := pci_config.prilevels;
|
217 |
|
|
constant APB_PRIOS : boolean := pci_config.fixpri;
|
218 |
|
|
constant ARB_SIZE : natural range 2 to 5 := log2(NB_AGENTS);
|
219 |
|
|
|
220 |
|
|
constant PCI_DEVICE_ID : integer := pci_config.deviceid;
|
221 |
|
|
constant PCI_VENDOR_ID : integer := pci_config.vendorid;
|
222 |
|
|
constant PCI_SUBSYS_ID : integer := pci_config.subsysid;
|
223 |
|
|
constant PCI_REVISION_ID : integer := pci_config.revisionid;
|
224 |
|
|
constant PCI_CLASS_CODE : integer := pci_config.classcode;
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
|
228 |
|
|
end;
|