![Xilinx Virtex-II Pro PPC405 Скачать руководство пользователя страница 217](http://html1.mh-extra.com/html/xilinx/virtex-ii-pro-ppc405/virtex-ii-pro-ppc405_user-manual_3410279217.webp)
March 2002 Release
Virtex-II Pro™ Platform FPGA Documentation
1-800-255-7778
Time Base
R
summarizes the time-base numbers and SPR numbers used by the above
instructions to access the time base registers. Simplified instruction mnemonics are
available for reading and writing the time base. See
for more information.
Reading and Writing the Time Base
The 64-bit time-base cannot be read or written using a single instruction. Software must
access the upper and lower portions separately. During the time it takes to execute the
instructions necessary to access the time base, it is possible for the TBU to be incremented.
This occurs when TBL rolls over from 0xFFFF_FFFF to 0x0000_0000 (at 300 MHz, this
happens every 14.3 seconds). If there is a rollover, the values read from or written to TBU
and TBL can be inconsistent.
Following is a code example for reading the time base. The comparison of old and new
TBU values within the loop ensures that a consistent pair of TBU and TBL values are read,
avoiding problems with TBL rollover.
loop:
mftbu
r
x
! Read TBU.
mftb
r
y
! Read TBL.
mftbu
r
z
! Read TBU again.
cmpw
r
z,
r
x
! Check for TBU rollover by comparing old and new.
bne
loop
! Read the time base again if a rollover occurred.
Following is a code example for writing the time base (simplified mnemonics are used for
writing the time-base registers). Clearing TBL to 0 before writing it with a non-zero value
ensures TBL rollover does not occur in the brief time required to update both TBU and
TBL.
lwz
r
x,upper_value
! Load upper 32-bit time-base value into
r
x.
lwz
r
y,lower_value
! Load lower 32-bit time-base value into
r
y.
li
r
z, 0
! Clear
r
z.
mttbl
r
z
! Clear TBL to avoid rollover after writing TBU.
mttbu
r
x
! Update TBU.
mttbl
r
y
! Update TBL.
Table 8-1:
Time-Base Register Instructions
Mnemonic
Name
Operation
Operand
Syntax
mftb
Move from Time Base Register
This instruction provides read-only access from the
time base for user and privileged software.
r
D is loaded with the contents of the time-base
register specified by TBRN.
r
D,TBRN
mtspr
Move to Special Purpose Register
This instruction provides write-only access to the
time base for privileged software.
The time-base register specified by SPRN is loaded
with the contents of
r
S.
SPRN,
r
S
Table 8-2:
Time-Base Register Numbers
Register
Decimal
Hex
Access
TBL
268
0x10C
User and privileged read-only—
mftb.
TBU
269
0x10D
TBL
284
0x11C
Privileged write-only—
mtspr.
TBU
285
0x11D
Содержание 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...