Altera Nios II C2H Compiler User Manual

Page 92

Advertising
background image

3–52

9.1

Altera Corporation

Nios II C2H Compiler User Guide

November 2009

Resource Sharing

The resource sharing technique used for memory accesses differs slightly
from all other sharable resources. Memory accesses which share the same
Avalon-MM master port use byte enables to control the width of the
access. The master port width is equal to the widest data type being
accessed. The other sharable resources do not use byte enables, so
operator inputs and result must be of equal width for the resource to be
shared. 8-bit and 16-bit operators are automatically promoted to be 32 bits
wide, so as long as both operands are either signed or unsigned, the
operator can be shared.

As previously mentioned, resources are not shared if the performance of
the hardware accelerator degrades. For example, if the algorithm is
capable of performing two multiplications in parallel, the C2H Compiler
does not share a multiplier resource. The C2H Compiler optimizes for
performance by default and enables sharing only when appropriate.

The exception to this rule is when two pointer dereferences occur that
access data from the same Avalon-MM memory port. The C2H Compiler
knows that memory arbitration already limits the performance of the
accelerator and so the resources are shared. This exception is bound to
Avalon-MM ports since multi-port components can be accessed
concurrently. If you use the appropriate connection pragma statements
and

_ _ restrict_ _

qualifier, you can ensure that memory accesses

occur concurrently instead of becoming a shared Avalon-MM master
port.

The C2H Compiler only shares resources if they reside at the same level
within a loop or function.

Figure 3–26

shows an algorithm which contains

shared and independent resources.

Advertising