Skip to content

Commit

Permalink
Merge pull request #1845 from ucb-bar/empty-chiptop
Browse files Browse the repository at this point in the history
Add EmptyChipTop example
  • Loading branch information
jerryz123 committed Apr 22, 2024
2 parents 6228b28 + d6d5446 commit 0a0dd64
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/Advanced-Concepts/Top-Testharness.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ The default standard ``ChipTop`` provides a mimimal, barebones template for ``IO
For tapeouts, integrating Analog IP, or other non-standard use cases, Chipyard supports specifying a custom ``ChipTop`` using the ``BuildTop`` key.
An example of a custom ChipTop which uses non-standard IOCells is provided in `generators/chipyard/src/main/scala/example/CustomChipTop.scala <https://github.com/ucb-bar/chipyard/blob/main/generators/chipyard/src/main/scala/example/CustomChipTop.scala>`__

You can also specify a fully custom ChipTop that does not use any RocketChip or Chipyard SoC components. An example of this is provided in `generators/chipyard/src/main/scala/example/EmptyChipTop.scala <https://github.com/ucb-bar/chipyard/blob/main/generators/chipyard/src/main/scala/example/EmptyChipTop.scala>`__. The ``EmptyChipTop`` example can be built with ``make CONFIG=EmptyChipTopConfig TOP=EmptyChipTop``.


System/DigitalTop
-------------------------
Expand Down
6 changes: 6 additions & 0 deletions generators/chipyard/src/main/scala/config/NoCoreConfigs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@ class NoCoresConfig extends Config(
new chipyard.config.WithNoDebug ++
new chipyard.config.WithNoPLIC ++
new chipyard.config.AbstractConfig)

// A config that uses a empty chiptop module with no rocket-chip soc components
class EmptyChipTopConfig extends Config(
new chipyard.example.WithEmptyChipTop ++
new chipyard.config.AbstractConfig // since we aren't using rocket-chip, this doesn't do anything
)
21 changes: 21 additions & 0 deletions generators/chipyard/src/main/scala/example/EmptyChipTop.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package chipyard.example

import chisel3._

import org.chipsalliance.cde.config._
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.util.{DontTouch}

import chipyard._
import chipyard.harness.{BuildTop}

class EmptyChipTop(implicit p: Parameters) extends LazyModule {
override lazy val module = new Impl
class Impl extends LazyRawModuleImp(this) with DontTouch {
// Your custom non-rocketchip-soc stuff here
}
}

class WithEmptyChipTop extends Config((site, here, up) => {
case BuildTop => (p: Parameters) => new EmptyChipTop()(p)
})
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ trait HasHarnessInstantiators {
if (p(DontTouchChipTopPorts)) {
duts.map(_ match {
case d: DontTouch => d.dontTouchPorts()
case _ =>
})
}

Expand Down
5 changes: 4 additions & 1 deletion scripts/split-mems-conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ def bfs_collect_submodules(tree):
imhj_data = json.load(imhj)

dut_root = bfs_find_root(imhj_data, args.dut_module_name)
dut_submodules = bfs_collect_submodules(dut_root)
if dut_root:
dut_submodules = bfs_collect_submodules(dut_root)
else:
dut_submodules = set()

model_root = bfs_find_root(imhj_data, args.model_module_name)
model_submodules = bfs_collect_submodules(model_root)
Expand Down

0 comments on commit 0a0dd64

Please sign in to comment.