This commit is contained in:
alonamid
2019-05-16 00:41:33 -07:00
parent f5c191871d
commit d091fe8b22
3 changed files with 61 additions and 34 deletions

View File

@@ -1,7 +1,7 @@
Configs, Parameters, Mix-ins, and Everything In Between
========================================================
A significant portion of generators in the ReBAR framework use the Rocket chip parameter system.
A significant portion of generators in the ReBAR framework use the Rocket chip parameter system.
This parameter system enables for the flexible configuration of the SoC without invasive RTL changes.
In order to use the parameter system correctly, we will use several terms and conventions:
@@ -13,15 +13,16 @@ It is important to note that a significant challenge with the Rocket parameter s
**Config**
A *Config* is a collection of multiple parameters being set to specific values.
A `Config` is a collection of multiple parameters being set to specific values.
Configs are additive, and can override each other.
A Config can be composed of other configs.
The naming convetion for an additive config is `With<YourConfig>`, while the naming convention for a non-additive config will be `<YourConfig>`.
The naming convetion for an additive config is ``With<YourConfig>``, while the naming convention for a non-additive config will be ``<YourConfig>``.
Configs can take arguments which will in-turn set parameters in the specific configs.
Example config:
..
.. code-block:: scala
class WithMyAcceleratorParams extends Config((site, here, up) => {
case MyAcceleratorKey =>
MyAcceleratorConfig(
@@ -35,7 +36,8 @@ Example config:
Example config which uses a higher level config:
..
.. code-block:: scala
class WithMyMoreComplexAcceleratorConfig extends Config((site, here, up) => {
case MyAcceleratorKey =>
MyAcceleratorConfig(
@@ -47,7 +49,8 @@ Example config which uses a higher level config:
Example of additive configs:
..
.. code-block:: scala
class SomeAdditiveConfig extends Config(
new WithMyMoreComplexAcceleratorConfig ++
new WithMyAcceleratorParams ++
@@ -60,7 +63,8 @@ The cake pattern is a scala programming pattern, which enable "mixing" of multip
Example of using the cake pattern to merge multiple system components into a single top-level design, extending a basic Rocket SoC:
..
.. code-block:: scala
class MySoC(implicit p: Parameters) extends RocketSubsystem
with CanHaveMisalignedMasterAXI4MemPort
with HasPeripheryBootROM
@@ -75,5 +79,5 @@ Example of using the cake pattern to merge multiple system components into a sin
**Mix-in**
A mix-in is a scala trait, which sets parameters for specific system components, as well as enabling instantiation and wiring of the relevant system components to system buses.
The naming convetion for an additive mix-in is `Has<YourMixin>`.
The naming convetion for an additive mix-in is ``Has<YourMixin>``.