GUIDE, Apr 2018, Version 2018.1
15
www.cobham.com/gaisler
LEON/GRLIB Guide
4.2.4 Buses in Different Clock Domains
In order to work around timing issues, or to reduce power consumption, it can make sense to partition
the design also into several clock domains. The AHB/AHB bridges (AHB2AHB, AHBBRIDGE and
GRIOMMU) allows connecting buses with differing operating frequencies together.
The bus clocks on each side of the bridge need to have a frequency ratio relationship and fixed phase
relation. This avoids the need to resynchronize signals on chip which would cause a performance pen-
alty.
If you want to run everything except the processor at half speed, a more efficient solution than using
bridges is to use the LEON double clocking support explained in section 4.3.
4.2.5 Single AHB Bus Example
A typical LEON/GRLIB design is shown in the figure below. The design is centered around one
AMBA AHB bus and also has a AMBA APB bus that connects some of the peripheral cores via an
AHB/APB bridge.
Processor
AMBA AHB
Timers
IrqCtrl
AMBA APB
8/32-bits memory bus
USB
LEON3
Serial
Dbg Link
AHB
Controller
Memory
Controller
AHB/APB
Bridge
I/O port
UART
16-bit I/O
JTAG
Dbg Link
RS232
JTAG
RS232
Spacewire
Link
LVDS
WDOG
Ethernet
MAC
PHY
PS/2
VGA
Video
PS/2 IF
DAC
CAN 2.0
Link
CAN
SDRAM
PROM
I/O
USB PHY
port
Building the system around one AHB bus has advantages in that it simplifies system design.
4.2.6 Multi-Bus System Example
Processor
AMBA AHB
Timers
IrqCtrl
AMBA APB
LEON3
Serial
Dbg Link
AHB
Controller
Memory
Controller
AHB/APB
Bridge
I/O port
UART
JTAG
Dbg Link
RS232
JTAG
Spacewire
Link
LVDS
Ethernet
MAC
PHY
PS/2
SVGA
CAN 2.0
Link
CAN
AHB2AHB
Bridge
Memory
Controller
AHB
Controller
(SVGA) AMBA AHB
GUIDE, Apr 2018, Version 2018.1
16
www.cobham.com/gaisler
LEON/GRLIB Guide
One example (shown above) of when a multi-bus system resolves bus contention is when a SVGA
controller (SVGACTRL core) is used. The SVGA controller continuously reads a frame buffer
located in external memory. This constant data fetching can consume a significant amount of the
available bus bandwidth, particularly in systems with relatively low system frequencies. The impact
of the SVGA controller bus traffic can be removed by placing the SVGA controller and a dedicated
memory controller on a separate bus. The processor can still access the frame buffer through and uni-
directional bridge.
4.3
LEON3 Double-Clocking
4.3.1 Overview
To avoid critical timing paths in large AHB systems, it is possible to clock the LEON3 processor core
at an inter multiple of the AHB clock. This will allow the processor to reach higher performance
while executing out of the caches. The performance will be higher while executing out of the caches
since the processor core will be running at a higher frequency. On a cache miss the processor will
need to make a bus access and timing of this bus access will be made according to the lower bus fre-
quency. This chapter will describe how to implement a LEON3 double-clocked system using the
LEON3-CLK2X template design as an example.
The LEON3 CPU core be clocked at a multiple of the clock speed of the AMBA AHB bus. When
clocked at double AHB clock frequency, all CPU core parts including integer unit and caches will
operate at double AHB clock frequency while the AHB bus access is performed at the slower AHB
clock frequency. The two clocks have to be synchronous and multicycle paths between the two clock
domains have to be defined at synthesis tool level. Separate components (leon3s2x, leon3x,
leon3ft2x) are provided for the double clocked core. Double clocked versions of DSU (dsu3_2x) and
MP interrupt controller (irqmp2x) are used in a double clocked LEON3 system. An AHB clock quali-
fier signal (clken input) is used to identify end of AHB cycle. The AHB qualifier signal is generated in
CPU clock domain and is high during the last CPU clock cycle under AHB clock low-phase.
4.3.2 LEON3-CLK2X Template Design
The LEON3-CLK2X design is a multi frequency design based on double-clocked LEON3 CPU core.
The LEON3 CPU core and DSU run at multiple AHB frequency internally, while the AHB bus and
other AHB components are clocked by the slower AHB clock. Double clocked version of the inter-
rupt controller is used, synchronizing interrupt level signals between the CPU and the interrupt con-
troller.
The design can be configured to support different ratios between CPU and AHB clock such as 2x, 3x
or 4x. If dynamic clock switching is enabled, an glitch-free clock multiplexer selecting between the
fast CPU clock and the slower AHB clock is used to dynamically change frequency of the CPU core
(by writing to an APB register).
4.3.3 Clocking
The design uses two synchronous clocks, AHB clock and CPU clock. For Xilinx and Altera technolo-
gies the clocks are provided by the clkgen module, for ASIC technologies a custom clock generation
circuit providing two synchronous clocks with low skew has to be provided.
An AHB clock qualifier signal, identifying end of an AHB clock cycle is necessary for correct opera-
tion of the double-clocked cores. The AHB clock qualifier signal (HCLKEN), indicating end of an
AHB clock cycle, is provided by the qmod module. The signal is generated in CPU clock domain and
is active during the last CPU clock cycle during low-phase of the AHB clock. Figure 1 shows timing
for CPU and AHB clock signals (CPUCLK, HCLK) and AHB clock qualifier signal (HCLKEN) for
clock ratios 2x and 3x.