Chapter 4
Programming the MIPS32® 74K™ Core Family, Revision 02.14
55
Programming the 74K™ core in user mode
This chapter is not very long, because in user mode one MIPS32-compliant CPU looks much like another. But not
everything — sections include:
•
Section 4.1, "User-mode accessible “Hardware registers”"
•
Section 4.2, "Prefetching data"
: how it works.
•
Section 4.3, "Using “synci” when writing instructions"
: writing instructions without needing to use privileged
cache management instructions.
•
: multiply, multiply/accumulate and divide timings.
•
Section 4.5, "Tuning software for the 74K‘ family pipeline"
: for determined programmers, and for compiler writ-
ers. It includes information about the timing of the DSP ASE instructions.
•
Section 4.6 “Tuning floating-point”
: the floating-point unit often runs at half speed, and some of its interactions
(particularly about potential exceptions) are complicated. This section offers some guidance about the timing
issues you’ll encounter.
4.1 User-mode accessible “Hardware registers”
The 74K core complies with Revision 2 of the MIPS32 specification, which introduces hardware registers; CPU-
dependent registers which are readable by unprivileged user space programs, usually to share information which is
worth making accessible to programs without the overhead of a system call.
The hardware registers provide useful information about the hardware, even to unprivileged (user-mode) software,
and are readable with the
rdhwr
instruction.
defines four registers so far. The OS can control access to
each register individually, through a bitmask in the CP0 register
HWREna
- (set bit 0 to enable register 0 etc).
HWREna
is cleared to all-zeroes on reset, so software has to explicitly enable user access — see
HWREna register - Control user rdhwr access”
. Privileged code can access any hardware register.
The five standard registers are:
•
CPUNum (0): Number of the CPU on which the program is currently running. This comes directly from the
coprocessor 0
EBase[CPUNum]
field.
•
SYNCI_Step (1): the effective size of an L1 cache line
14
; this is now important to user programs because they can
now do things to the caches using the
synci
instruction to make instructions you’ve written visible for execu-
tion. Then
SYNCI_Step
tells you the “step size” - the address increment between successive
synci
’s required to
cover all the instructions in a range.
14. Strictly, it’s the lesser of the I-cache and D-cache line size, but it’s most unusual to make them different.
Содержание MIPS32 74K Series
Страница 1: ...Document Number MD00541 Revision 02 14 March 30 2011 Programming the MIPS32 74K Core Family...
Страница 10: ...Programming the MIPS32 74K Core Family Revision 02 14 10...
Страница 20: ...1 4 A brief guide to the 74K core implementation Programming the MIPS32 74K Core Family Revision 02 14 20...
Страница 28: ...2 2 PRId register identifying your CPU type Programming the MIPS32 74K Core Family Revision 02 14 28...
Страница 54: ...3 8 The TLB and translation Programming the MIPS32 74K Core Family Revision 02 14 54...
Страница 83: ......
Страница 86: ...6 5 FPU pipeline and instruction timing Programming the MIPS32 74K Core Family Revision 02 14 86...
Страница 101: ...The MIPS32 DSP ASE 101 Programming the MIPS32 74K Core Family Revision 02 14...
Страница 134: ...8 4 Performance counters Programming the MIPS32 74K Core Family Revision 02 14 134...
Страница 154: ...C 3 FPU changes in Release 2 of the MIPS32 Architecture Programming the MIPS32 74K Core Family Revision 02 14 154...