842
March 2002 Release
1-800-255-7778
Virtex-II Pro™ Platform FPGA Documentation
Appendix D:
Programming Considerations
R
rlwinm r
4,
r
4, 32
−
sh, sh, 31
rlwimi r
4,
r
3, 32
−
sh, 0, sh
−
1
rlwinm r
3,
r
3, 32
−
sh, sh, 31
rlwimi r
3,
r
2, 32
−
sh, 0, sh
−
1
srawi
r
2,
r
2, sh
•
Shift-right algebraic,
n
=
2 (shift amount
<
64)
subfic r
31,
r
6, 32
srw
r
3,
r
3,
r
6
slw
r
0,
r
2,
r
31
or
r
3,
r
3,
r
0
addic. r
31,
r
6,
−
32
sraw
r
0,
r
2,
r
31
ble
$
+
8
ori
r
3,
r
0, 0
sraw
r
2,
r
2,
r
6
•
Shift-right algebraic,
n
=
3 (shift amount
<
32)
subfic r
31,
r
6, 32
srw
r
4,
r
4,
r
6
slw
r
0,
r
3,
r
31
or
r
4,
r
4,
r
0
srw
r
3,
r
3,
r
6
slw
r
0,
r
2,
r
31
or
r
3,
r
3,
r
0
sraw
r
2,
r
2,
r
6
Code Optimization Guidelines
The following guidelines can help reduce program execution time in the PPC405.
Additional information on PowerPC code optimization can be found in
The PowerPC
Compiler Writer’s Guide.
Conditional Branches
Multi-way branches and compound branches can be implemented in several ways. The
implementation choice depends on problem specifics, including the number and
distribution of test conditions and the instruction timings and latencies. Usually, the
implementation involves a combination of conditional branches and unconditional
branches.
Conditional branches require the evaluation of conditional expressions. In evaluating
these expressions, performance can be improved by using instructions that update the CR
to reflect their results. These results are represented in the CR as boolean variables that can
be operated on using the CR-logical instructions. This usually yields better performance
than using other instructions to evaluate conditional expressions solely in the GPRs.
The following pseudocode provides a simple example of how the CR register and CR-
logical instructions can be used to improve the performance of conditional expressions by
eliminating branches. In this example, Var28–Var31 are boolean variables maintained as
bits in the CR[CR7] field (CR
28:31
). These variables represent a true condition by using the
binary value 0b1 and a false condition by using the binary value 0b0.
if (Var28 || Var29 || Var30 || Var 31) branch to target
The above pseudocode can be implemented in assembler using branches as follows:
bt
28, target
bt
29, target
bt
30, target
bt
31, target
Содержание Virtex-II Pro PPC405
Страница 1: ...R Volume 2 a PPC405 User Manual Virtex II Pro Platform FPGA Developer s Kit March 2002 Release...
Страница 14: ...322 www xilinx com March 2002 Release 1 800 255 7778 Virtex II Pro Platform FPGA Documentation Preface R...
Страница 252: ...560 www xilinx com March 2002 Release 1 800 255 7778 Virtex II Pro Platform FPGA Documentation R...
Страница 260: ...568 www xilinx com March 2002 Release 1 800 255 7778 Virtex II Pro Platform FPGA Documentation R...
Страница 562: ...870 www xilinx com March 2002 Release 1 800 255 7778 Virtex II Pro Platform FPGA Documentation R...