riscv-software-src / riscv-perf-model

Example RISC-V Out-of-Order/Superscalar Processor Performance Core and MSS Model
Apache License 2.0
133 stars 56 forks source link

Ignore Renaming of x0 #120

Closed aarongchan closed 10 months ago

aarongchan commented 10 months ago

Fix renaming to skip renaming of x0 outlined in https://github.com/riscv-software-src/riscv-perf-model/issues/118.

Changes:

danbone commented 10 months ago

Missing logic here: https://github.com/riscv-software-src/riscv-perf-model/blob/55661600abe6604d3fc369da398e7677efdb1b1c/core/Rename.cpp#L197-L201

danbone commented 10 months ago

This change seems a bit convoluted, would it not be better to refactor the allocation and freeing into separate functions, and act differently when the input register is X0.

Also, I can't find out where the scoreboard will always ready x0 reads? https://github.com/riscv-software-src/riscv-perf-model/blob/55661600abe6604d3fc369da398e7677efdb1b1c/core/Rename.cpp#L292-L297

aarongchan commented 10 months ago

This change seems a bit convoluted, would it not be better to refactor the allocation and freeing into separate functions, and act differently when the input register is X0.

Also, I can't find out where the scoreboard will always ready x0 reads?

https://github.com/riscv-software-src/riscv-perf-model/blob/55661600abe6604d3fc369da398e7677efdb1b1c/core/Rename.cpp#L292-L297

The scoreboard is marked here: https://github.com/riscv-software-src/riscv-perf-model/blob/55661600abe6604d3fc369da398e7677efdb1b1c/core/Rename.cpp#L107

And because we bypass any destinations of x0, we can assume the scoreboard is always marked ready. An alternative I'm considering is just storing whether a data operand in a LSU operation is x0, if so we just pass it through, without checking the scoreboard.

With regards to refactoring, my initial thoughts were to keep as much of the original code as possible, but am considering ways to refactor it currently. Allocate and freeing are currently separated with regards to renameInstructions_() and getAckFromROB_(), but are you saying to have a more generic functions that we pass the operands through?