ARM / OFFLINE REFERENCE

On this page
← Home

CNTHV_TVAL

Counter-timer Virtual Timer TimerValue register (EL2)

Provides AArch32 access to the timer value for the EL2 virtual timer.

Configuration

AArch32 System register CNTHV_TVAL bits [31:0] are architecturally mapped to AArch64 System register CNTHV_TVAL_EL2[31:0].

This register is present only when FEAT_AA32 is implemented and FEAT_VHE is implemented. Otherwise, direct accesses to CNTHV_TVAL are UNDEFINED.

Attributes

CNTHV_TVAL is a 32-bit register.

Field descriptions

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
TimerValue

TimerValue, bits [31:0]:

The TimerValue view of the EL2 virtual timer.

On a read of this register:

On a write of this register, CNTHV_CVAL is set to (CNTVCT + TimerValue), where TimerValue is treated as a signed 32-bit integer.

When CNTHV_CTL.ENABLE is 1, the timer condition is met when (CNTVCT - CNTHV_CVAL) is greater than or equal to zero. This means that TimerValue acts like a 32-bit downcounter timer. When the timer condition is met:

When CNTHV_CTL.ENABLE is 0, the TimerValue cannot be read but continues to decrement. When the timer is enabled, the TimerValue represents the elapsed time whether that time was spent enabled or disabled.

The reset behavior of this field is:

Access Instructions

This register is accessed using the encoding for CNTV_TVAL.

Accesses to this register use the following encodings in the System register encoding space:

MRC{<c>}{<q>} <coproc>, {#}<opc1>, <Rt>, <CRn>, <CRm>{, {#}<opc2>}

(coproc = 0b1111, opc1 = 0b000, CRn = 0b1110, CRm = 0b0011, opc2 = 0b000)


if !IsFeatureImplemented(FEAT_AA32) then
    Undefined();
elsif PSTATE.EL == EL0 then
    if IsFeatureImplemented(FEAT_AA64EL1) && !ELUsingAArch32(EL1) && EffectivelyAtEL0NotInHost() && CNTKCTL_EL1().EL0VTEN == '0' then
        AArch64_AArch32SystemAccessTraptoEL1orEL2(0x03);
    elsif IsFeatureImplemented(FEAT_AA32EL1) && ELUsingAArch32(EL1) && CNTKCTL().PL0VTEN == '0' then
        if EL2Enabled() && (IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2)) && HCR_EL2().TGE == '1' then
            AArch64_AArch32SystemAccessTrap(EL2, 0x03);
        elsif EL2Enabled() && (IsFeatureImplemented(FEAT_AA32EL2) && ELUsingAArch32(EL2)) && HCR().TGE == '1' then
            AArch32_TakeHypTrapException(0x00);
        else
            Undefined();
        end;
    elsif EffectivelyAtEL0InHost() && (IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2)) && CNTHCTL_EL2().EL0VTEN == '0' then
        AArch64_AArch32SystemAccessTrap(EL2, 0x03);
    elsif EL2Enabled() && (IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2)) && EffectivelyAtEL0NotInHost() && IsFeatureImplemented(FEAT_ECV) && CNTHCTL_EL2().EL1TVT == '1' then
        AArch64_AArch32SystemAccessTrap(EL2, 0x03);
    elsif EffectivelyAtEL0InHost() && IsCurrentSecurityState(SS_Secure) && IsFeatureImplemented(FEAT_SEL2) then
        if CNTHVS_CTL_EL2().ENABLE == '0' then
            R(t) = ARBITRARY:bits(32);
        else
            R(t) = (CNTHVS_CVAL_EL2() - PhysicalCountInt())[31:0];
        end;
    elsif EffectivelyAtEL0InHost() && !IsCurrentSecurityState(SS_Secure) then
        if CNTHV_CTL_EL2().ENABLE == '0' then
            R(t) = ARBITRARY:bits(32);
        else
            R(t) = (CNTHV_CVAL_EL2() - PhysicalCountInt())[31:0];
        end;
    else
        if CNTV_CTL().ENABLE == '0' then
            R(t) = ARBITRARY:bits(32);
        elsif HaveEL(EL2) && IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2) then
            R(t) = (CNTV_CVAL() - (PhysicalCountInt() - CNTVOFF_EL2()))[31:0];
        elsif HaveEL(EL2) && IsFeatureImplemented(FEAT_AA32EL2) then
            R(t) = (CNTV_CVAL() - (PhysicalCountInt() - CNTVOFF()))[31:0];
        else
            R(t) = (CNTV_CVAL() - PhysicalCountInt())[31:0];
        end;
    end;
elsif PSTATE.EL == EL1 then
    if EL2Enabled() && IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2) && IsFeatureImplemented(FEAT_ECV) && CNTHCTL_EL2().EL1TVT == '1' then
        AArch64_AArch32SystemAccessTrap(EL2, 0x03);
    else
        if CNTV_CTL().ENABLE == '0' then
            R(t) = ARBITRARY:bits(32);
        elsif HaveEL(EL2) && IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2) then
            R(t) = (CNTV_CVAL() - (PhysicalCountInt() - CNTVOFF_EL2()))[31:0];
        elsif HaveEL(EL2) && IsFeatureImplemented(FEAT_AA32EL2) then
            R(t) = (CNTV_CVAL() - (PhysicalCountInt() - CNTVOFF()))[31:0];
        else
            R(t) = (CNTV_CVAL() - PhysicalCountInt())[31:0];
        end;
    end;
elsif PSTATE.EL == EL2 then
    if CNTV_CTL().ENABLE == '0' then
        R(t) = ARBITRARY:bits(32);
    else
        R(t) = (CNTV_CVAL() - (PhysicalCountInt() - CNTVOFF()))[31:0];
    end;
elsif PSTATE.EL == EL3 then
    if CNTV_CTL().ENABLE == '0' then
        R(t) = ARBITRARY:bits(32);
    elsif HaveEL(EL2) then
        R(t) = (CNTV_CVAL() - (PhysicalCountInt() - CNTVOFF()))[31:0];
    else
        R(t) = (CNTV_CVAL() - PhysicalCountInt())[31:0];
    end;
end;
                

MCR{<c>}{<q>} <coproc>, {#}<opc1>, <Rt>, <CRn>, <CRm>{, {#}<opc2>}

(coproc = 0b1111, opc1 = 0b000, CRn = 0b1110, CRm = 0b0011, opc2 = 0b000)


if !IsFeatureImplemented(FEAT_AA32) then
    Undefined();
elsif PSTATE.EL == EL0 then
    if IsFeatureImplemented(FEAT_AA64EL1) && !ELUsingAArch32(EL1) && EffectivelyAtEL0NotInHost() && CNTKCTL_EL1().EL0VTEN == '0' then
        AArch64_AArch32SystemAccessTraptoEL1orEL2(0x03);
    elsif IsFeatureImplemented(FEAT_AA32EL1) && ELUsingAArch32(EL1) && CNTKCTL().PL0VTEN == '0' then
        if EL2Enabled() && (IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2)) && HCR_EL2().TGE == '1' then
            AArch64_AArch32SystemAccessTrap(EL2, 0x03);
        elsif EL2Enabled() && (IsFeatureImplemented(FEAT_AA32EL2) && ELUsingAArch32(EL2)) && HCR().TGE == '1' then
            AArch32_TakeHypTrapException(0x00);
        else
            Undefined();
        end;
    elsif EffectivelyAtEL0InHost() && (IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2)) && CNTHCTL_EL2().EL0VTEN == '0' then
        AArch64_AArch32SystemAccessTrap(EL2, 0x03);
    elsif EL2Enabled() && (IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2)) && EffectivelyAtEL0NotInHost() && IsFeatureImplemented(FEAT_ECV) && CNTHCTL_EL2().EL1TVT == '1' then
        AArch64_AArch32SystemAccessTrap(EL2, 0x03);
    elsif EffectivelyAtEL0InHost() && IsCurrentSecurityState(SS_Secure) && IsFeatureImplemented(FEAT_SEL2) then
        CNTHVS_CVAL_EL2() = SignExtend{64}(R(t)) + PhysicalCountInt();
    elsif EffectivelyAtEL0InHost() && !IsCurrentSecurityState(SS_Secure) then
        CNTHV_CVAL_EL2() = SignExtend{64}(R(t)) + PhysicalCountInt();
    else
        if HaveEL(EL2) && IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2) then
            CNTV_CVAL() = (SignExtend{64}(R(t)) + PhysicalCountInt()) - CNTVOFF_EL2();
        elsif HaveEL(EL2) && IsFeatureImplemented(FEAT_AA32EL2) then
            CNTV_CVAL() = (SignExtend{64}(R(t)) + PhysicalCountInt()) - CNTVOFF();
        else
            CNTV_CVAL() = SignExtend{64}(R(t)) + PhysicalCountInt();
        end;
    end;
elsif PSTATE.EL == EL1 then
    if EL2Enabled() && IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2) && IsFeatureImplemented(FEAT_ECV) && CNTHCTL_EL2().EL1TVT == '1' then
        AArch64_AArch32SystemAccessTrap(EL2, 0x03);
    else
        if HaveEL(EL2) && IsFeatureImplemented(FEAT_AA64EL2) && !ELUsingAArch32(EL2) then
            CNTV_CVAL() = (SignExtend{64}(R(t)) + PhysicalCountInt()) - CNTVOFF_EL2();
        elsif HaveEL(EL2) && IsFeatureImplemented(FEAT_AA32EL2) then
            CNTV_CVAL() = (SignExtend{64}(R(t)) + PhysicalCountInt()) - CNTVOFF();
        else
            CNTV_CVAL() = SignExtend{64}(R(t)) + PhysicalCountInt();
        end;
    end;
elsif PSTATE.EL == EL2 then
    CNTV_CVAL() = (SignExtend{64}(R(t)) + PhysicalCountInt()) - CNTVOFF();
elsif PSTATE.EL == EL3 then
    if HaveEL(EL2) then
        CNTV_CVAL() = (SignExtend{64}(R(t)) + PhysicalCountInt()) - CNTVOFF();
    else
        CNTV_CVAL() = SignExtend{64}(R(t)) + PhysicalCountInt();
    end;
end;
                

Version 2026.09 — Copyright © 2010-2026 Arm Limited or its affiliates.

This site is provided as a community resource and is NOT affiliated with nor endorsed by Arm Limited.