hpmcounter6
User-mode Hardware Performance Counter 3
Alias for M-mode CSR mhpmcounter6.
Privilege mode access is controlled with mcounteren.HPM6 <%- if ext?(:S) -%> , scounteren.HPM6 <%- if ext?(:H) -%> , and hcounteren.HPM6 <%- end -%> <%- end -%> as follows:
<%- if ext?(:H) -%>
hpmcounter6 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 |
<%- elsif ext?(:S) -%>
hpmcounter6 behavior |
|||
---|---|---|---|
S-mode |
U-mode |
||
0 |
- |
|
|
1 |
0 |
read-only |
|
1 |
1 |
read-only |
read-only |
<%- else -%>
hpmcounter6 behavior |
|
---|---|
U-mode |
|
0 |
|
1 |
read-only |
<%- end -%>
Attributes
Defining Extension |
|
---|---|
CSR Address |
0xc06 |
Length |
64-bit |
Privilege Mode |
U |
Software read
This CSR may return a value that is different from what is stored in hardware.
if (%%LINK%func;mode;mode%%() == PrivilegeMode::S) {
if (%%LINK%csr_field;mcounteren.HPM6;CSR[mcounteren].HPM6%% == 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.HPM6;CSR[mcounteren].HPM6%% & %%LINK%csr_field;scounteren.HPM6;CSR[scounteren].HPM6%%) == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
} else if (%%LINK%csr_field;mcounteren.HPM6;CSR[mcounteren].HPM6%% == 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.HPM6;CSR[hcounteren].HPM6%% == 1'b0 && %%LINK%csr_field;mcounteren.HPM6;CSR[mcounteren].HPM6%% == 1'b1) {
%%LINK%func;raise;raise%%(ExceptionCode::VirtualInstruction, %%LINK%func;mode;mode%%(), $encoding);
} else if (%%LINK%csr_field;mcounteren.HPM6;CSR[mcounteren].HPM6%% == 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.HPM6;CSR[hcounteren].HPM6%% & %%LINK%csr_field;scounteren.HPM6;CSR[scounteren].HPM6%%) == 1'b0) && (%%LINK%csr_field;mcounteren.HPM6;CSR[mcounteren].HPM6%% == 1'b1 {
%%LINK%func;raise;raise%%(ExceptionCode::VirtualInstruction, %%LINK%func;mode;mode%%(), $encoding);
} else if (%%LINK%csr_field;mcounteren.HPM6;CSR[mcounteren].HPM6%% == 1'b0) {
%%LINK%func;raise;raise%%(ExceptionCode::IllegalInstruction, %%LINK%func;mode;mode%%(), $encoding);
}
}
return %%LINK%func;read_hpm_counter;read_hpm_counter%%(6);