GUIDE, Apr 2018, Version 2018.1
9
www.cobham.com/gaisler
LEON/GRLIB Guide
3
LEON design information
3.1
Introduction
The sections below contain recommendations on how to configure the LEON processors depending
on system requirements.
3.2
General Recommendations
3.2.1 Data Cache Snooping
To keep the data cache synchronized with external memory, cache snooping can be enabled. When
enabled, the data cache monitors write accesses on the AHB bus to cacheable locations. If another
AHB master writes to a cacheable location that is currently cached in the date cache, the correspond-
ing cache line is marked as invalid.
Data cache snooping is of high importance for SMP systems and, in general, both simplifies and
increases performance in systems with multiple masters. Note that the processor(s) snoop on the bus
to which they are directly connected. In a system with multiple AHB buses, snooping will only work
on the bus to which the processors are connected. Snooping will not provide cache coherency if, for
instance, there are masters connected between a Level-2 cache and memory, while the processors are
located in front of the Level-2 cache.
Snooping is also required to prevent aliasing effects in systems that use a memory management unit
(MMU) and a data cache that is either larger than the MMU page size or has more than one way. If the
processor(s) is implemented with a MMU, then separate snoop/physical tags must be enabled. A
multi-way cache allows virtual addresses mapped to the same physical address to be cached in each
cache-way. A write operation will only update the copy in one of the cache-ways, leading to data
coherency issues. If snooping with separate physical tags is enabled then the aliased addresses will be
invalidated by the processor write operation.
In case the data cache way size is larger than the MMU page size then multiple MMU pages may be
cached in the same cache-way, again leading to the cache containing multiple virtual locations that
map to the same physical address. In this case the LEON snooping implementation will not resolve
the situation and the processor needs to be implemented with a MMU page sizes that matches the
cache way size. Note that operating system support for MMU page sizes larger than 4 KiB is limited,
consult the documentation for the operating system.
3.2.2 V7 and FPU
When the LEON is implemented with an FPU it should also include hardware support for multiply
and divide (SPARC V8 MUL/DIV selected with the LEON VHDL generic v8). Otherwise a SPARC
V7 processor with FPU will be obtained and this configuration may not be supported by prebuilt
packages and toolchains.
3.2.3 MMU and Supervisor Tag bit
When the LEON is implemented with an MMU it is recommended to include the supervisor access
bit in the L1 cache tag. Otherwise there is a risk of information leaking to user mode from kernel
mode due to kernel data being present and accessible from user space in the L1 cache. The extra tag
information is included by setting the mmuen VHDL generic to 2. The extra tag bit does not provide
any extra functionality for systems that only use supervisor mode and use the MMU as an extra safety
net, in these cases the bit can be disabled to reduce the width of L1 tag RAMs with one bit.
3.3
LEON Example Configurations
3.3.1 Overview
The subsections below show three different example configurations for LEON processors; a minimal
configuration used to target low area and high frequency, a typical configuration with all features
enabled, and a high-performance configuration where the requirements on processing performance
outweigh area and power considerations.
Each section contains a table with recommended values for some of the LEON processor VHDL
generics. If you are using the xconfig GUI to configure the processor then please note that the VHDL
GUIDE, Apr 2018, Version 2018.1
10
www.cobham.com/gaisler
LEON/GRLIB Guide
generic names do not directly correspond to the configuration options in the GUI. The descriptions of
the configuration settings should provide enough information to do appropriate configuration selec-
tion also via xconfig. The xconfig tool also has support to initialize the processor configuration with
values from the three example configurations described in the sections below. See the configuration
help text in xconfig for the option Force values from example configuration in the Processor sub
menu for additional information.
Also note that all listed configuration options do not apply to all LEON processors. For instance, the
LEON3 processor has a VHDL generic called bp that controls the inclusion of branch predication,
while the LEON4 processor is always implemented with support for branch prediction.
3.3.2 Minimal LEON Configuration
This LEON configuration is aimed at resource constrained systems where the area requirements of the
processor core needs to be minimized. Note that using an area minimized configuration may not nec-
essarily reduce the system’s performance since it may be possible to achieve a higher operating fre-
quency by reducing the amount of logic in the processor core.
Table 6 below shows recommended values for some of the LEON processor VHDL generics to attain
a minimal configuration in terms of area.
TABLE 6. Minimal LEON processor configuration
VHDL
generic
Recommended
value
Description
dsu
0
Some area can be saved by removing the Debug Support Unit
(DSU). However, this unit can prove to be invaluable at least
during the software development phase.
fpu
0
Disable floating-point unit
v8
0
Do not include support for SPARC V8 MUL/DIV instructions
mac
0
Do not include support for SPARC V8e SMAC/UMAC
nwp
0
Disable hardware watchpoints
icen / dcen
1
Include processor caches
isets / dsets
1
Direct mapped instruction and data cache
irepl / drepl
2
Random replacement policy for both instruction and data cache
(setting is unused for direct-mapped cache)
isetsize /
dsetsize
-
The size of the caches does not significantly affect the required
logic. Choose cache size according to application requirements and
amount of RAM available on target device.
dnsoop
0
Disable data cache snooping (see section 3.2.1)
mmuen
0
Disable memory management unit (MMU). Note: May be required
depending on software applications.
lddel
1
1-cycle load delay
tbuf
0
Disable instruction trace buffer (NOTE: Including the instruction
trace buffer may be of high value
during software development
and debug).
pwd
1
Power-down implementation. Choose 2 if frequency target is not
met.
smp
0
Disable SMP support. If the processor core should be used in an
SMP configuration then see the GRIP documentation on how to set
the SMP generic. If SMP is enabled then the dsnoop VHDL
generic should also be set accordingly.
bp
0
Disable branch prediction