-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gen C++ and Verilog macros by GatewayConfig #251
Conversation
6e96fa9
to
a9eb938
Compare
src/main/scala/Difftest.scala
Outdated
def generateVeriogHeader(): Unit = { | ||
val difftestVeriog = ListBuffer.empty[String] | ||
vMacros.foreach(m => difftestVeriog += s"`define $m") | ||
val outputDir = sys.env("NOOP_HOME") + "/build/rtl" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generate files must be put in generated-src
only to avoid confusions. build/rtl
is only for chisel design files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make the output directory a function shared by generateVeriogHeader and generateCppHeader
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure.
src/main/scala/Gateway.scala
Outdated
@@ -32,16 +32,38 @@ case class GatewayConfig( | |||
replaySize : Int = 256, | |||
diffStateSelect: Boolean = false, | |||
isBatch : Boolean = false, | |||
batchSize : Int = 32 | |||
batchSize : Int = 32, | |||
isNonBlock : Boolean = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always add a ,
after the arguments. Then adding arguments will not modify the previous line. isNonBlock: Boolean = false,
src/main/scala/Gateway.scala
Outdated
} | ||
def vMacros: Seq[String] = { | ||
val macros = ListBuffer.empty[String] | ||
macros += s"TB_DIFF_STEP_WIDTH ${stepWidth}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not also use the CONFIG_DIFFTEST_*
names?
One of the good naming practice is to avoid abbreviations if acceptable.
bee2c4e
to
ed8bcfe
Compare
CI fails because NutShell changes the RTL path. I'll fix it later |
Makefile
Outdated
@@ -64,7 +64,8 @@ PLUGIN_CSRC_DIR = $(abspath ./src/test/csrc/plugin) | |||
PLUGIN_INC_DIR = $(abspath $(PLUGIN_CSRC_DIR)/include) | |||
SIM_CXXFLAGS += -I$(PLUGIN_INC_DIR) | |||
|
|||
VSRC_DIR = $(abspath ./src/test/vsrc/common) | |||
GEN_VSRC_DIR = $(BUILD_DIR)/generated-src | |||
VSRC_DIR = $(abspath ./src/test/vsrc/common) $(GEN_VSRC_DIR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add $(GEN_VSRC_DIR) to VSRC_DIR?
VCS and verilator will search for the missing modules in include paths
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I will delete it. Now I have trouble using cross-directory include on Palladium,and I am asking Palladium engineer for help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about passing all verilog files, including the generated ones, to palladium?
ed8bcfe
to
88ae92e
Compare
Currently all macros in Gateway can be decided by GatewayConfig, we move macros inside Config for better comprehension. Difftest-related macros in Verilog can be configured in generated DifftestMacros.v, which should be included by all files use those macros. Some redundant passing of config and return val of collect is removed. Some macros are renamed for similar format. Makefile and mk are changed to include generated/DifftestMacros.v
Currently all macros in Gateway can be decided by GatewayConfig, we move macros inside Config for better comprehension. Difftest-related macros in Verilog can be configured in generated DifftestMacros.v, which should be included by all files use those macros. Some redundant passing of config and return val of collect is removed. Some macros are renamed for similar format. Makefile and mk are changed to include generated/DifftestMacros.v
Currently all macros in Gateway can be decided by GatewayConfig, we move macros inside Config for better comprehension. Difftest-related macros in Verilog can be configured in generated DifftestMacros.v, which should be included by all files use those macros. Some redundant passing of config and return val of collect is removed. Some macros are renamed for similar format. Makefile and mk are changed to include generated/DifftestMacros.v
Currently all macros in Gateway can be decided by GatewayConfig, we move macros inside Config for better comprehension.
Difftest-related macros in Verilog can be configured in generated DifftestMacros.v, which should be included by all files use those macros.
Some redundant passing of config and return val of collect is removed. Some macros are renamed for similar format.