Fix BB resource references | More BB docs
This commit is contained in:
@@ -119,12 +119,12 @@ $(BOOTROM_TARGETS): $(build_dir)/bootrom.%.img: $(TESTCHIP_RSRCS_DIR)/testchipip
|
||||
#########################################################################################
|
||||
# compile scala jars
|
||||
#########################################################################################
|
||||
$(CHIPYARD_CLASSPATH_TARGETS) &: $(CHIPYARD_SCALA_SOURCES) $(SCALA_BUILDTOOL_DEPS)
|
||||
$(CHIPYARD_CLASSPATH_TARGETS) &: $(CHIPYARD_SCALA_SOURCES) $(SCALA_BUILDTOOL_DEPS) $(CHIPYARD_VLOG_SOURCES)
|
||||
mkdir -p $(dir $@)
|
||||
$(call run_sbt_assembly,$(SBT_PROJECT),$(CHIPYARD_CLASSPATH))
|
||||
|
||||
# order only dependency between sbt runs needed to avoid concurrent sbt runs
|
||||
$(TAPEOUT_CLASSPATH_TARGETS) &: $(BARSTOOLS_SCALA_SOURCES) $(SCALA_BUILDTOOL_DEPS) | $(CHIPYARD_CLASSPATH_TARGETS)
|
||||
$(TAPEOUT_CLASSPATH_TARGETS) &: $(BARSTOOLS_SCALA_SOURCES) $(SCALA_BUILDTOOL_DEPS) $(BARSTOOLS_VLOG_SOURCES) | $(CHIPYARD_CLASSPATH_TARGETS)
|
||||
mkdir -p $(dir $@)
|
||||
$(call run_sbt_assembly,tapeout,$(TAPEOUT_CLASSPATH))
|
||||
|
||||
@@ -227,7 +227,7 @@ $(FINAL_ANNO_FILE): $(EXTRA_ANNO_FILE) $(SFC_EXTRA_ANNO_FILE) $(SFC_LEVEL)
|
||||
touch $@
|
||||
|
||||
$(SFC_MFC_TARGETS) &: private TMP_DIR := $(shell mktemp -d -t cy-XXXXXXXX)
|
||||
$(SFC_MFC_TARGETS) &: $(TAPEOUT_CLASSPATH_TARGETS) $(FIRRTL_FILE) $(FINAL_ANNO_FILE) $(SFC_LEVEL) $(EXTRA_FIRRTL_OPTIONS) $(MFC_LOWERING_OPTIONS) $(CHIPYARD_VLOG_SOURCES) $(BARSTOOLS_VLOG_SOURCES)
|
||||
$(SFC_MFC_TARGETS) &: $(TAPEOUT_CLASSPATH_TARGETS) $(FIRRTL_FILE) $(FINAL_ANNO_FILE) $(SFC_LEVEL) $(EXTRA_FIRRTL_OPTIONS) $(MFC_LOWERING_OPTIONS)
|
||||
rm -rf $(GEN_COLLATERAL_DIR)
|
||||
$(call run_jar_scala_main,$(TAPEOUT_CLASSPATH),barstools.tapeout.transforms.GenerateModelStageMain,\
|
||||
--no-dedup \
|
||||
|
||||
@@ -161,4 +161,31 @@ transformed or augmented by any Chipyard FIRRTL transform.
|
||||
As mentioned earlier in this section, ``BlackBox`` resource files must
|
||||
be integrated into the build process, so any project providing
|
||||
``BlackBox`` resources must be made visible to the ``tapeout`` project
|
||||
in ``build.sbt``
|
||||
in ``build.sbt``.
|
||||
|
||||
Differences between ``HasBlackBoxPath`` and ``HasBlackBoxResource``
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Chisel provides two mechanisms for integrating blackbox files into a Chisel project that work slightly differently in Chipyard: ``HasBlackBoxPath`` and ``HasBlackBoxResource``.
|
||||
|
||||
``HasBlackBoxResource`` incorporates extra files by looking up the relative path of the files within the ``src/main/resources`` area of project.
|
||||
This requires that the file added by ``addResource`` is present in the ``src/main/resources`` area and is **not** auto-generated (the file is static throughout the lifetime of generating RTL).
|
||||
This is due to the fact that when the Chisel sources are compiled they are put in a ``jar`` file, along with the ``src/main/resources`` area, and that ``jar`` is used to run the Chisel generator.
|
||||
Files referenced by the ``addResource`` must be located within this ``jar`` file during the Chisel elaboration.
|
||||
Thus if a file is generated during Chisel generation it will not be present in the ``jar`` file until the next time the Chisel sources are compiled.
|
||||
|
||||
``HasBlackBoxPath`` differs in that it incorporates extra files by using an absolute path to them.
|
||||
Later in the build process, the FIRRTL compiler will copy the file from that location to the generated sources directory.
|
||||
Thus, the file must be present before the FIRRTL compiler is run (i.e. the file doesn't need to be in the ``src/main/resources`` or it can be auto-generated during Chisel elaboration).
|
||||
|
||||
Additionally, both mechanisms do not enforce the order of files added.
|
||||
For example:
|
||||
|
||||
.. code-block:: scala
|
||||
|
||||
addResource("fileA")
|
||||
addResource("fileB")
|
||||
|
||||
In this case, ``fileA`` is not guaranteed to be before ``fileB`` when passed to downstream tools.
|
||||
To bypass this, it is recommended to auto-generate a single file with the ordering needed by concatenating the files and using ``addPath`` given by ``HasBlackBoxPath``.
|
||||
An example of this is https://github.com/ucb-bar/ibex-wrapper/blob/main/src/main/scala/IbexCoreBlackbox.scala.
|
||||
|
||||
Reference in New Issue
Block a user