From 851df86aba06b984680feaf27c8a5c036b5df2cc Mon Sep 17 00:00:00 2001 From: Tynan McAuley Date: Thu, 11 Feb 2021 14:55:36 -0800 Subject: [PATCH 1/3] docs: Fix dual-BOOM-single-Rocket documentation There were two problems here: 1. The docs indicated that this should be a dual-BOOM and single-Rocket config, but the config actually had two Rocket cores. 2. Since the doc include string was 'DualBoomAndRocket', it was accidentally matching against the 'DualBoomAndRocketOneHwacha' section, which comes first in the file. So, I created a new 'DualLargeBoomAndSingleRocketConfig' config which only has one Rocket core, and changed the doc include string to 'DualBoomAndSingleRocket'. --- docs/Customization/Heterogeneous-SoCs.rst | 4 ++-- .../chipyard/src/main/scala/config/HeteroConfigs.scala | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/Customization/Heterogeneous-SoCs.rst b/docs/Customization/Heterogeneous-SoCs.rst index 6ff88129c3..df5043c3b0 100644 --- a/docs/Customization/Heterogeneous-SoCs.rst +++ b/docs/Customization/Heterogeneous-SoCs.rst @@ -17,8 +17,8 @@ The following example shows a dual core BOOM with a single core Rocket. .. literalinclude:: ../../generators/chipyard/src/main/scala/config/HeteroConfigs.scala :language: scala - :start-after: DOC include start: DualBoomAndRocket - :end-before: DOC include end: DualBoomAndRocket + :start-after: DOC include start: DualBoomAndSingleRocket + :end-before: DOC include end: DualBoomAndSingleRocket Adding Hwachas diff --git a/generators/chipyard/src/main/scala/config/HeteroConfigs.scala b/generators/chipyard/src/main/scala/config/HeteroConfigs.scala index 862ee64385..55d2f77074 100644 --- a/generators/chipyard/src/main/scala/config/HeteroConfigs.scala +++ b/generators/chipyard/src/main/scala/config/HeteroConfigs.scala @@ -31,12 +31,17 @@ class LargeBoomAndHwachaRocketConfig extends Config( // DOC include end: DualBoomAndRocketOneHwacha -// DOC include start: DualBoomAndRocket class DualLargeBoomAndDualRocketConfig extends Config( new boom.common.WithNLargeBooms(2) ++ // add 2 boom cores new freechips.rocketchip.subsystem.WithNBigCores(2) ++ // add 2 rocket cores new chipyard.config.AbstractConfig) -// DOC include end: DualBoomAndRocket + +// DOC include start: DualBoomAndSingleRocket +class DualLargeBoomAndSingleRocketConfig extends Config( + new boom.common.WithNLargeBooms(2) ++ // add 2 boom cores + new freechips.rocketchip.subsystem.WithNBigCores(1) ++ // add 1 rocket core + new chipyard.config.AbstractConfig) +// DOC include end: DualBoomAndSingleRocket class LargeBoomAndRocketWithControlCoreConfig extends Config( new freechips.rocketchip.subsystem.WithNSmallCores(1) ++ // Add a small "control" core From 01948f6cb51203d7453b01bb9dc22e8083857dba Mon Sep 17 00:00:00 2001 From: Tynan McAuley Date: Thu, 11 Feb 2021 15:06:29 -0800 Subject: [PATCH 2/3] docs: Fix dual-BOOM-Rocket-Hwacha documentation The docs indicate that this should be a dual-BOOM and single-Rocket config, with the Hwacha attached to the Rocket. However, the 'LargeBoomAndHwachaRocketConfig' config only has a single Rocket core. Added the 'DualLargeBoomAndHwachaRocketConfig' config to accurately reflect what's stated in the docs. Additionally, this fixes hart numbering to place the Hwacha accelerator on the Rocket core rather than on the BOOM core. --- docs/Customization/Heterogeneous-SoCs.rst | 2 +- .../src/main/scala/config/HeteroConfigs.scala | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/Customization/Heterogeneous-SoCs.rst b/docs/Customization/Heterogeneous-SoCs.rst index df5043c3b0..380ccb102c 100644 --- a/docs/Customization/Heterogeneous-SoCs.rst +++ b/docs/Customization/Heterogeneous-SoCs.rst @@ -48,7 +48,7 @@ An example is shown below with two BOOM cores, and one Rocket tile with a RoCC a :start-after: DOC include start: DualBoomAndRocketOneHwacha :end-before: DOC include end: DualBoomAndRocketOneHwacha -The ``WithMultiRoCCHwacha`` config fragment assigns a Hwacha accelerator to a particular ``hartId`` (in this case, the ``hartId`` of ``2`` corresponds to the Rocket core). +The ``WithMultiRoCCHwacha`` config fragment assigns a Hwacha accelerator to a particular ``hartId`` (in this case, the ``hartId`` of ``0`` corresponds to the Rocket core). Finally, the ``WithMultiRoCC`` config fragment is called. This config fragment sets the ``BuildRoCC`` key to use the ``MultiRoCCKey`` instead of the default. This must be used after all the RoCC parameters are set because it needs to override the ``BuildRoCC`` parameter. diff --git a/generators/chipyard/src/main/scala/config/HeteroConfigs.scala b/generators/chipyard/src/main/scala/config/HeteroConfigs.scala index 55d2f77074..28cdc4cb20 100644 --- a/generators/chipyard/src/main/scala/config/HeteroConfigs.scala +++ b/generators/chipyard/src/main/scala/config/HeteroConfigs.scala @@ -20,16 +20,23 @@ class HwachaLargeBoomAndHwachaRocketConfig extends Config( new chipyard.config.AbstractConfig) // DOC include end: BoomAndRocketWithHwacha -// DOC include start: DualBoomAndRocketOneHwacha class LargeBoomAndHwachaRocketConfig extends Config( new chipyard.config.WithMultiRoCC ++ // support heterogeneous rocc - new chipyard.config.WithMultiRoCCHwacha(1) ++ // put hwacha on hart-1 (rocket) + new chipyard.config.WithMultiRoCCHwacha(0) ++ // put hwacha on hart-0 (rocket) new hwacha.DefaultHwachaConfig ++ // set default hwacha config keys new boom.common.WithNLargeBooms(1) ++ // add 1 boom core new freechips.rocketchip.subsystem.WithNBigCores(1) ++ // add 1 rocket core new chipyard.config.AbstractConfig) -// DOC include end: DualBoomAndRocketOneHwacha +// DOC include start: DualBoomAndRocketOneHwacha +class DualLargeBoomAndHwachaRocketConfig extends Config( + new chipyard.config.WithMultiRoCC ++ // support heterogeneous rocc + new chipyard.config.WithMultiRoCCHwacha(0) ++ // put hwacha on hart-0 (rocket) + new hwacha.DefaultHwachaConfig ++ // set default hwacha config keys + new boom.common.WithNLargeBooms(2) ++ // add 2 boom cores + new freechips.rocketchip.subsystem.WithNBigCores(1) ++ // add 1 rocket core + new chipyard.config.AbstractConfig) +// DOC include end: DualBoomAndRocketOneHwacha class DualLargeBoomAndDualRocketConfig extends Config( new boom.common.WithNLargeBooms(2) ++ // add 2 boom cores From 4824662323876d09398356ebc9eaeb4b16bb6e8e Mon Sep 17 00:00:00 2001 From: Tynan McAuley Date: Thu, 11 Feb 2021 16:21:36 -0800 Subject: [PATCH 3/3] docs: Document hart ID ordering --- docs/Customization/Heterogeneous-SoCs.rst | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/Customization/Heterogeneous-SoCs.rst b/docs/Customization/Heterogeneous-SoCs.rst index 380ccb102c..7e31108bb0 100644 --- a/docs/Customization/Heterogeneous-SoCs.rst +++ b/docs/Customization/Heterogeneous-SoCs.rst @@ -56,6 +56,29 @@ If this is used earlier in the configuration sequence, then MultiRoCC does not w This config fragment can be changed to put more accelerators on more cores by changing the arguments to cover more ``hartId``'s (i.e. ``WithMultiRoCCHwacha(0,1,3,6,...)``). +Since config fragments are applied from right-to-left (or bottom-to-top as they are formatted here), the right-most config fragment specifying a core (which is ``freechips.rocketchip.subsystem.WithNBigCores`` in the example above) gets the first hart ID. +Consider this config: + +.. code-block:: scala + + class RocketThenBoomHartIdTestConfig extends Config( + new boom.common.WithNLargeBooms(2) ++ + new freechips.rocketchip.subsystem.WithNBigCores(3) ++ + new chipyard.config.AbstractConfig) + +This specifies an SoC with three Rocket cores and two BOOM cores. +The Rocket cores would have hart IDs 0, 1, and 2, while the BOOM cores would have hard IDs 3 and 4. +On the other hand, consider this config which reverses the order of those two fragments: + +.. code-block:: scala + + class BoomThenRocketHartIdTestConfig extends Config( + new freechips.rocketchip.subsystem.WithNBigCores(3) ++ + new boom.common.WithNLargeBooms(2) ++ + new chipyard.config.AbstractConfig) + +This also specifies an SoC with three Rocket cores and two BOOM cores, but because the BOOM config fragment is evaluated before the Rocket config fragment, the hart IDs are reversed. +The BOOM cores would have hart IDs 0 and 1, while the Rocket cores would have hard IDs 2, 3, and 4. .. [1] Note, in this section "core" and "tile" are used interchangeably but there is subtle distinction between a "core" and "tile" ("tile" contains a "core", L1D/I$, PTW). For many places in the documentation, we usually use "core" to mean "tile" (doesn't make a large difference but worth the mention).