Skip to content
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

Dromajo + TraceIO Cleanup #553

Merged
merged 6 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,4 @@
url = https://github.com/ucb-bar/nvdla-workload.git
[submodule "tools/dromajo/dromajo-src"]
path = tools/dromajo/dromajo-src
url = https://github.com/abejgonzalez/dromajo.git
url = https://github.com/riscv-boom/dromajo.git
30 changes: 30 additions & 0 deletions docs/Advanced-Concepts/Debugging-BOOM.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Debugging BOOM
======================

In addition to the default debugging techniques specified in :ref:`Debugging RTL`,
single-core BOOM designs can utilize the Dromajo co-simulator (see :ref:`Dromajo`)
to verify functionality.

.. warning:: Dromajo currently only works in single-core BOOM systems without accelerators.

.. warning:: Dromajo currently only works in VCS simulation and FireSim.

Setting up Dromajo Co-simulation
--------------------------------------

Dromajo co-simulation is setup to work when two config fragments are added to a BOOM config.
First, a ``chipyard.config.WithTraceIO`` config fragment must be added so that BOOM's traceport is enabled.
Second, a ``chipyard.iobinders.WithSimDromajoBridge`` config fragment must be added to
connect the Dromajo co-simulator to the traceport.
Once both config fragments are added Dromajo should be enabled.

To build/run Dromajo with a BOOM design, run your configuration the following make commands:

.. code-block:: shell

# build the default Dromajo BOOM config without waveform dumps
# replace "DromajoBoomConfig" with your particular config
make CONFIG=DromajoBoomConfig ENABLE_DROMAJO=1

# run a simulation with Dromajo
make CONFIG=DromajoBoomConfig ENABLE_DROMAJO=1 BINARY=<YOUR-BIN> run-binary
23 changes: 0 additions & 23 deletions docs/Advanced-Concepts/Debugging-RTL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,29 +86,6 @@ identical program behavior. The torture utility can also be configured to run
continuously for stress-testing. The torture utility exists within the ``utilities``
directory.

Dromajo Co-simulation for BOOM designs
--------------------------------------
Dromajo co-simulation is setup to work when two config. fragments are added to a BOOM config.
First, a ``chipyard.config.WithTraceIO`` config. fragment must be added so that BOOM's traceport is enabled.
Second, a ``chipyard.iobinders.WithSimDromajoBridge`` config. fragment must be added to
connect the Dromajo co-simulator to the traceport.
Once both config. fragments are added Dromajo should be enabled.

To build/run Dromajo with a BOOM design, run your configuration the following make commands:

.. code-block:: shell

# build the default Dromajo BOOM config. without waveform dumps
# replace "DromajoBoomConfig" with your particular config
make CONFIG=DromajoBoomConfig ENABLE_DROMAJO=1

# run a simulation with Dromajo
make CONFIG=DromajoBoomConfig ENABLE_DROMAJO=1 BINARY=<YOUR-BIN> run-binary

.. warning:: Dromajo currently only works in single-core BOOM systems without accelerators.

.. warning:: Dromajo currently only works in VCS simulation and FireSim.

Firesim Debugging
---------------------------
Chisel printfs, asserts, Dromajo co-simulation, and waveform generation are also available in FireSim
Expand Down
1 change: 1 addition & 0 deletions docs/Advanced-Concepts/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ They expect you to know about Chisel, Parameters, configs, etc.
Top-Testharness
Chip-Communication
Debugging-RTL
Debugging-BOOM
Resources
CDEs

2 changes: 1 addition & 1 deletion docs/Chipyard-Basics/Chipyard-Components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Tools
A Chisel library for writing custom signal processing hardware, as well as integrating custom signal processing hardware into an SoC (especially a Rocket-based SoC).

**Dromajo**
A RV64GC emulator primarily used for co-simulation and was originally developed by Esperanto Technology.
A RV64GC emulator primarily used for co-simulation and was originally developed by Esperanto Technologies.
See :ref:`Dromajo` for more information.

Toolchains
Expand Down
2 changes: 1 addition & 1 deletion generators/boom
27 changes: 4 additions & 23 deletions generators/chipyard/src/main/scala/Subsystem.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import freechips.rocketchip.amba.axi4._
import boom.common.{BoomTile, BoomTilesKey, BoomCrossingKey, BoomTileParams}
import ariane.{ArianeTile, ArianeTilesKey, ArianeCrossingKey, ArianeTileParams}

import testchipip.{DromajoHelper}

trait HasChipyardTiles extends HasTiles
with CanHavePeripheryPLIC
with CanHavePeripheryCLINT
Expand Down Expand Up @@ -106,27 +108,6 @@ class SubsystemModuleImp[+L <: Subsystem](_outer: L) extends BaseSubsystemModule
ElaborationArtefacts.add("""core.config""", outer.tiles.map(x => x.module.toString).mkString("\n"))

// Generate C header with relevant information for Dromajo
// THIS IS INCLUDED IN THE `dromajo_params.h` header file
var dromajoParams: String = ""
dromajoParams += "#ifndef DROMAJO_PARAMS_H"
dromajoParams += "\n#define DROMAJO_PARAMS_H"
dromajoParams += "\n\n" + "#define DROMAJO_RESET_VECTOR " + "\"" + "0x" + f"${p(BootROMParams).hang}%X" + "\""
dromajoParams += "\n" + "#define DROMAJO_MMIO_START " + "\"" + "0x" + f"${p(BootROMParams).address + p(BootROMParams).size}%X" + "\""
p(ExtMem) map { eP =>
dromajoParams += "\n" + "#define DROMAJO_MMIO_END " + "\"" + "0x" + f"${eP.master.base}%X" + "\""
// dromajo memory is in MiB chunks
dromajoParams += "\n" + "#define DROMAJO_MEM_SIZE " + "\"" + "0x" + f"${eP.master.size >> 20}%X" + "\""
}
p(PLICKey) map { pP =>
dromajoParams += "\n" + "#define DROMAJO_PLIC_BASE " + "\"" + "0x" + f"${pP.baseAddress}%X" + "\""
dromajoParams += "\n" + "#define DROMAJO_PLIC_SIZE " + "\"" + "0x" + f"${PLICConsts.size(pP.maxHarts)}%X" + "\""
}
p(CLINTKey) map { cP =>
dromajoParams += "\n" + "#define DROMAJO_CLINT_BASE " + "\"" + "0x" + f"${cP.baseAddress}%X" + "\""
dromajoParams += "\n" + "#define DROMAJO_CLINT_SIZE " + "\"" + "0x" + f"${CLINTConsts.size}%X" + "\""
}
dromajoParams += "\n\n#endif"

ElaborationArtefacts.add("""dromajo_params.h""", dromajoParams)

// This is included in the `dromajo_params.h` header file
DromajoHelper.addArtefacts
}
2 changes: 1 addition & 1 deletion generators/testchipip