Compaq ECQD2KCTE manual Read Processor Cycle Counter, Rpcc

Models: ECQD2KCTE

1 371
Download 371 pages 20.35 Kb
Page 199
Image 199

4.11.8 Read Processor Cycle Counter

Format:

RPCC

Ra.wq

!Memory format

Operation:

Ra {cycle counter}

Exceptions:

None

Instruction mnemonics:

RPCC

Read Processor Cycle Counter

Qualifiers:

None

Description:

Register Ra is written with the processor cycle counter (PCC). The PCC register consists of two 32-bit fields. The low-order 32 bits (PCC<31:0>) are an unsigned, wrapping counter, PCC_CNT. The high-order 32 bits (PCC<63:32>), PCC_OFF, are operating-system depen- dent in their implementation.

See Section 3.1.5 for a description of the PCC.

If an operating system uses PCC_OFF to calculate the per-process or per-thread cycle count, that count must be derived from the 32-bit sum of PCC_OFF and PCC_CNT. The following example computes that cycle count, modulo 2**32, and returns the count value in R0. Notice the care taken not to cause an unwanted sign extension.

RPCC

R0

; Read the process cycle counter

SLL

R0, #32, R1

; Line up the offset and count fields

ADDQ

R0, R1, R0

; Do add

SRL

R0, #32, R0

; Zero extend the count to 64 bits

The following example code returns the value of PCC_CNT in R0<31:0> and all zeros in R0<63:32>.

RPCC R0

ZAPNOT R0,#15,R0

Instruction Descriptions 4–143

Page 199
Image 199
Compaq ECQD2KCTE manual Read Processor Cycle Counter, Rpcc