riscv-software-src / riscv-unified-db

Machine-readable database of the RISC-V specification, and tools to generate various views
Other
13 stars 12 forks source link

Zihpm.yaml missing several parameters and has vague description for HPM_COUNTER_EN #69

Open james-ball-qualcomm opened 1 month ago

james-ball-qualcomm commented 1 month ago

Couple of issues I noticed with Zihpm.

The Unpriv ISA manual chapter on Zihpm says "The implemented number and width of these additional counters, and the set of events they count, is platform-specific. Accessing an unimplemented or ill-configured counter may cause an illegal-instruction exception or may return a constant value."

Seems like we need a bunch more of parameters in the Zihpm.yaml to capture all these possibilities. Should we add them?

The other issue is that the Zihpm.yaml has this description for HPM_COUNTER_EN: "List of HPM counters that are enabled." What does "enabled" mean? Counting some event (i.e., run-time controlled) or provides a non-zero value when the associated CSR is read (since all 29 perf counters are always implemented but can be read-only-0 if not actually functional).

dhower-qc commented 1 month ago

Yes, I agree we are probably missing parameters for Zihpm.

As for "enabled," that means that the corresponding CSR is present (read won't cause exception or undefined behavior). It may still be read-only-0 even if "enabled".