Address generator unification PR reviews
This commit is contained in:
25
docs/Customization/IOBinders.rst
Normal file
25
docs/Customization/IOBinders.rst
Normal file
@@ -0,0 +1,25 @@
|
||||
IOBinders
|
||||
=========
|
||||
|
||||
In Chipyard we use a special ``Parameters`` key, ``IOBinders`` to determine what modules to bind to the IOs of a ``Top`` in the ``TestHarness``.
|
||||
|
||||
.. literalinclude:: ../../generators/chipyard/src/main/scala/IOBinders.scala
|
||||
:language: scala
|
||||
:start-after: DOC include start: IOBinders
|
||||
:end-before: DOC include end: IOBinders
|
||||
|
||||
|
||||
This special key solves the problem of duplicating test-harnesses for each different ``Top`` type.
|
||||
|
||||
You could just as well create a custom harness module that attaches IOs explicitly. Instead, the IOBinders key provides a map from Scala traits to attachment behaviors.
|
||||
|
||||
For example, the ``WithSimAXIMemTiedOff`` IOBinder specifies that any ``Top`` which matches ``CanHaveMasterAXI4MemPortModuleImp`` will have a ``SimAXIMem`` connected.
|
||||
|
||||
.. literalinclude:: ../../generators/chipyard/src/main/scala/IOBinders.scala
|
||||
:language: scala
|
||||
:start-after: DOC include start: WithSimAXIMem
|
||||
:end-before: DOC include end: WithSimAXIMem
|
||||
|
||||
These classes are all ``Config`` objects, which can be mixed into the configs to specify IO connection behaviors.
|
||||
|
||||
There are two macros for generating these ``Configs``. ``OverrideIOBinder`` overrides any existing behaviors set for a particular IO in the ``Config`` object. This macro is frequently used because typically top-level IOs drive or are driven by only one source, so a composition of ``IOBinders`` does not make sense. The ``ComposeIOBinder`` macro provides the functionality of not overriding existing behaviors.
|
||||
@@ -9,89 +9,30 @@ The L1 Caches
|
||||
Each CPU tile has an L1 instruction cache and L1 data cache. The size and
|
||||
associativity of these caches can be configured. The default ``RocketConfig``
|
||||
uses 16 KiB, 4-way set-associative instruction and data caches. However,
|
||||
if you use the ``NMedCores`` or ``NSmallCores`` configurations, you can
|
||||
if you use the ``WithNMedCores`` or ``WithNSmallCores`` configurations, you can
|
||||
configure 4 KiB direct-mapped caches for L1I and L1D.
|
||||
|
||||
.. code-block:: scala
|
||||
|
||||
class SmallRocketConfig extends Config(
|
||||
new chipyard.iobinders.WithUARTAdapter ++
|
||||
new chipyard.iobinders.WithTieOffInterrupts ++
|
||||
new chipyard.iobinders.WithSimAXIMem ++
|
||||
new chipyard.iobinders.WithTiedOffDebug ++
|
||||
new chipyard.iobinders.WithSimSerial ++
|
||||
new testchipip.WithTSI ++
|
||||
new chipyard.config.WithNoGPIO ++
|
||||
new chipyard.config.WithBootROM ++
|
||||
new chipyard.config.WithUART ++
|
||||
new chipyard.config.WithL2TLBs(1024) ++
|
||||
new freechips.rocketchip.subsystem.WithNoMMIOPort ++
|
||||
new freechips.rocketchip.subsystem.WithNoSlavePort ++
|
||||
new freechips.rocketchip.subsystem.WithInclusiveCache ++
|
||||
new freechips.rocketchip.subsystem.WithNExtTopInterrupts(0) ++
|
||||
new freechips.rocketchip.subsystem.WithNSmallCores(1) ++ // small rocket cores
|
||||
new freechips.rocketchip.system.BaseConfig)
|
||||
|
||||
class MediumRocketConfig extends Config(
|
||||
new chipyard.iobinders.WithUARTAdapter ++
|
||||
new chipyard.iobinders.WithTieOffInterrupts ++
|
||||
new chipyard.iobinders.WithSimAXIMem ++
|
||||
new chipyard.iobinders.WithTiedOffDebug ++
|
||||
new chipyard.iobinders.WithSimSerial ++
|
||||
new testchipip.WithTSI ++
|
||||
new chipyard.config.WithNoGPIO ++
|
||||
new chipyard.config.WithBootROM ++
|
||||
new chipyard.config.WithUART ++
|
||||
new chipyard.config.WithL2TLBs(1024) ++
|
||||
new freechips.rocketchip.subsystem.WithNoMMIOPort ++
|
||||
new freechips.rocketchip.subsystem.WithNoSlavePort ++
|
||||
new freechips.rocketchip.subsystem.WithInclusiveCache ++
|
||||
new freechips.rocketchip.subsystem.WithNExtTopInterrupts(0) ++
|
||||
new freechips.rocketchip.subsystem.WithNMediumCores(1) ++ // Medium rocket cores
|
||||
new freechips.rocketchip.system.BaseConfig)
|
||||
|
||||
|
||||
|
||||
If you only want to change the size or associativity, there are configuration
|
||||
mixins for those too.
|
||||
mixins for those too. See :ref:`Mixins` for how to add these to a custom ``Config``
|
||||
|
||||
.. code-block:: scala
|
||||
|
||||
import freechips.rocketchip.subsystem.{WithL1ICacheSets, WithL1DCacheSets, WithL1ICacheWays, WithL1DCacheWays}
|
||||
|
||||
class MyL1RocketConfig extends Config(
|
||||
new freechips.rocketchip.subsystem.WithL1ICacheSets(128) ++ // change rocket I$
|
||||
new freechips.rocketchip.subsystem.WithL1ICacheWays(2) ++ // change rocket I$
|
||||
new freechips.rocketchip.subsystem.WithL1DCacheSets(128) ++ // change rocket D$
|
||||
new freechips.rocketchip.subsystem.WithL1DCacheWays(2) ++ // change rocket D$
|
||||
new RocketConfig)
|
||||
|
||||
|
||||
You can also configure the L1 data cache as an data scratchpad instead.
|
||||
However, there are some limitations on this. If you are using a data scratchpad,
|
||||
you can only use a single core and you cannot give the design an external DRAM.
|
||||
Note that these configurations fully remove the L2 cache and mbus.
|
||||
|
||||
.. code-block:: scala
|
||||
|
||||
class ScratchpadSmallRocketConfig extends Config(
|
||||
new chipyard.iobinders.WithUARTAdapter ++
|
||||
new chipyard.iobinders.WithTieOffInterrupts ++
|
||||
new chipyard.iobinders.WithSimAXIMem ++
|
||||
new chipyard.iobinders.WithTiedOffDebug ++
|
||||
new chipyard.iobinders.WithSimSerial ++
|
||||
new testchipip.WithTSI ++
|
||||
new chipyard.config.WithNoGPIO ++
|
||||
new chipyard.config.WithBootROM ++
|
||||
new chipyard.config.WithUART ++
|
||||
new chipyard.config.WithL2TLBs(1024) ++
|
||||
new freechips.rocketchip.subsystem.WithNMemoryChannels(0) ++
|
||||
new freechips.rocketchip.subsystem.WithNBanks(0) ++
|
||||
new freechips.rocketchip.subsystem.WithScratchpadsOnly ++
|
||||
new freechips.rocketchip.subsystem.WithNoMMIOPort ++
|
||||
new freechips.rocketchip.subsystem.WithNoSlavePort ++
|
||||
new freechips.rocketchip.subsystem.WithNExtTopInterrupts(0) ++
|
||||
new freechips.rocketchip.subsystem.WithNSmallCores(1) ++
|
||||
new freechips.rocketchip.system.BaseConfig)
|
||||
.. literalinclude:: ../../generators/chipyard/src/main/scala/RocketConfigs.scala
|
||||
:language: scala
|
||||
:start-after: DOC include start: scratchpadrocket
|
||||
:end-before: DOC include end: scratchpadrocket
|
||||
|
||||
|
||||
This configuration fully removes the L2 cache and memory bus by setting the
|
||||
@@ -121,27 +62,8 @@ To make such a configuration, you can just copy the definition of
|
||||
list of included mixims.
|
||||
|
||||
If you want to reduce the resources used even further, you can configure
|
||||
the Broadcast Hub to use a bufferless design.
|
||||
|
||||
.. code-block:: scala
|
||||
|
||||
class NoL2SmallRocketConfig extends Config(
|
||||
new chipyard.iobinders.WithUARTAdapter ++
|
||||
new chipyard.iobinders.WithTieOffInterrupts ++
|
||||
new chipyard.iobinders.WithSimAXIMem ++
|
||||
new chipyard.iobinders.WithTiedOffDebug ++
|
||||
new chipyard.iobinders.WithSimSerial ++
|
||||
new testchipip.WithTSI ++
|
||||
new chipyard.config.WithNoGPIO ++
|
||||
new chipyard.config.WithBootROM ++
|
||||
new chipyard.config.WithUART ++
|
||||
new chipyard.config.WithL2TLBs(1024) ++
|
||||
new freechips.rocketchip.subsystem.WithBufferlessBroadcastHub ++
|
||||
new freechips.rocketchip.subsystem.WithNoMMIOPort ++
|
||||
new freechips.rocketchip.subsystem.WithNoSlavePort ++
|
||||
new freechips.rocketchip.subsystem.WithNExtTopInterrupts(0) ++
|
||||
new freechips.rocketchip.subsystem.WithNSmallCores(1) ++
|
||||
new freechips.rocketchip.system.BaseConfig)
|
||||
the Broadcast Hub to use a bufferless design. This mixin is
|
||||
``freechips.rocketchip.subsystem.WithBufferlessBroadcastHub``.
|
||||
|
||||
|
||||
The Outer Memory System
|
||||
@@ -156,11 +78,7 @@ number of DRAM channels is restricted to powers of two.
|
||||
|
||||
.. code-block:: scala
|
||||
|
||||
import freechips.rocketchip.subsystem.WithNMemoryChannels
|
||||
|
||||
class DualChannelRocketConfig extends Config(
|
||||
new freechips.rocketchip.subsystem.WithNMemoryChannels(2) ++
|
||||
new RocketConfig)
|
||||
new freechips.rocketchip.subsystem.WithNMemoryChannels(2)
|
||||
|
||||
|
||||
In VCS and Verilator simulation, the DRAM is simulated using the
|
||||
|
||||
@@ -42,3 +42,4 @@ We recommend reading all these pages in order. Hit next to get started!
|
||||
Memory-Hierarchy
|
||||
Boot-Process
|
||||
Firrtl-Transforms
|
||||
IOBinders
|
||||
|
||||
Reference in New Issue
Block a user