hpmcounter13h
User-mode Hardware Performance Counter 10, high half
Alias for M-mode CSR mhpmcounter13h.
Privilege mode access is controlled with mcounteren.HPM13, scounteren.HPM13, and hcounteren.HPM13 as follows:
hpmcounter13h behavior |
||||||
---|---|---|---|---|---|---|
S-mode |
U-mode |
VS-mode |
VU-mode |
|||
0 |
- |
- |
|
|
|
|
1 |
0 |
0 |
read-only |
|
|
|
1 |
1 |
0 |
read-only |
read-only |
|
|
1 |
0 |
1 |
read-only |
|
read-only |
|
1 |
1 |
1 |
read-only |
read-only |
read-only |
read-only |
Attributes
CSR Address |
0xc8d |
---|---|
Defining extension |
|
Length |
64-bit |
Privilege Mode |
U |
Fields
COUNT
- Location
-
hpmcounter13h[63:0]
- Description
-
Alias of mhpmcounter13h.COUNT.
- Type
RO-H |
Read-Only with Hardware update Writes are ignored. Reads reflect a value dynamically generated by hardware. |
- Reset value
-
UNDEFINED_LEGAL
Software read
This CSR may return a value that is different from what is stored in hardware.
-
Pruned
-
Original
if (%%LINK%func;mode;mode%%() == PrivilegeMode::S) {
if (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%func;mode;mode%%() == PrivilegeMode::U) {
if (%%LINK%csr_field;misa.S;CSR[misa].S%% == 1'b1) {
if ((%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% & %%LINK%csr_field;scounteren.HPM13;CSR[scounteren].HPM13%%) == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%func;mode;mode%%() == PrivilegeMode::VS) {
if (%%LINK%csr_field;hcounteren.HPM13;CSR[hcounteren].HPM13%% == 1'b0 && %%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b1) {
%%LINK%func;raise;raise%%(ExceptionCode::VirtualInstruction, %%LINK%func;mode;mode%%(), $encoding);
} else if (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%func;mode;mode%%() == PrivilegeMode::VU) {
if (%%LINK%csr_field;hcounteren.HPM13;CSR[hcounteren].HPM13%% & %%LINK%csr_field;scounteren.HPM13;CSR[scounteren].HPM13%%) == 1'b0) && (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b1 {
%%LINK%func;raise;raise%%(ExceptionCode::VirtualInstruction, %%LINK%func;mode;mode%%(), $encoding);
} else if (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
}
return %%LINK%func;read_hpm_counter;read_hpm_counter%%(13)[63:32];
if (%%LINK%func;mode;mode%%() == PrivilegeMode::S) {
if (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%func;mode;mode%%() == PrivilegeMode::U) {
if (%%LINK%csr_field;misa.S;CSR[misa].S%% == 1'b1) {
if ((%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% & %%LINK%csr_field;scounteren.HPM13;CSR[scounteren].HPM13%%) == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%func;mode;mode%%() == PrivilegeMode::VS) {
if (%%LINK%csr_field;hcounteren.HPM13;CSR[hcounteren].HPM13%% == 1'b0 && %%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b1) {
%%LINK%func;raise;raise%%(ExceptionCode::VirtualInstruction, %%LINK%func;mode;mode%%(), $encoding);
} else if (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%func;mode;mode%%() == PrivilegeMode::VU) {
if (%%LINK%csr_field;hcounteren.HPM13;CSR[hcounteren].HPM13%% & %%LINK%csr_field;scounteren.HPM13;CSR[scounteren].HPM13%%) == 1'b0) && (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b1 {
%%LINK%func;raise;raise%%(ExceptionCode::VirtualInstruction, %%LINK%func;mode;mode%%(), $encoding);
} else if (%%LINK%csr_field;mcounteren.HPM13;CSR[mcounteren].HPM13%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
}
return %%LINK%func;read_hpm_counter;read_hpm_counter%%(13)[63:32];