fix(difftest): include difftest-def.h
in spike
#81
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, we only include
diffteset-def.h
in difftest-related files, which causes various inconsistencies in class or struct definitions.Take
processor.h
for an example. The structure or size ofstruct state_t
is dependent on the macro definition ofCONFIG_PMP_MAX_NUM
indiffteset-def.h
. DifferentCONFIG_PMP_MAX_NUM
results in differentstruct state_t
, and further results in differentclass processor_t
.Considering that we includes
processor.h
and usesclass processor_t
in bothdifftest/difftest.cc
andriscv/sim.cc
, where the firstdifftest/difftest.cc
hasCONFIG_PMP_MAX_NUM
defined but the secondriscv/sim.cc
not. If a variable ofclass processor_t
is defined in one file and is used in another one (by global variable, return value of function call, etc.), the data may corrupt.Here are some
printf
s below for better explanation.This is a temporary fixup and a better way is to use a "spike-way" (autoconf / automake /
./configure
) to manage difftest codes with spike.