A small advice on PA2 basic infrastructure DiffTest part's snippet
bLueriVerLHR opened this issue · 1 comments
It makes me feel confused when reading the snippet below at first. In the first line of the snippet, there is a dest
which is not mentioned in the definition of difftest_memcpy
.
// 在DUT host memory的`buf`和REF guest memory的`dest`之间拷贝`n`字节,
// `direction`指定拷贝的方向, `DIFFTEST_TO_DUT`表示往DUT拷贝, `DIFFTEST_TO_REF`表示往REF拷贝
void difftest_memcpy(paddr_t addr, void *buf, size_t n, bool direction);
// `direction`为`DIFFTEST_TO_DUT`时, 获取REF的寄存器状态到`dut`;
// `direction`为`DIFFTEST_TO_REF`时, 设置REF的寄存器状态为`dut`;
void difftest_regcpy(void *dut, bool direction);
// 让REF执行`n`条指令
void difftest_exec(uint64_t n);
// 初始化REF的DiffTest功能
void difftest_init();
I search the source code and find it should be the dest
in the definition of sim_t::diff_memcpy
which is predefined in spike-diff. (I am using risc-v64, and I admit I did spend time searching just to confirm the dest
refers to addr
in the context XD )
It is harmless, and clever students may just guess the dest
is addr
. But I thought it would be better to replace dest
with addr
since it could make more sense.
PA is such a marvelous job. I hope it will get much more better!
Oh, I forgot to update the comment. dest
is for the old API.
Thank you very much for this catch!