From 01948f6cb51203d7453b01bb9dc22e8083857dba Mon Sep 17 00:00:00 2001
From: Tynan McAuley <tynan@galois.com>
Date: Thu, 11 Feb 2021 15:06:29 -0800
Subject: [PATCH] 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