chipsalliance / chipsalliance/rocket-chip
Guidance on Building a Standalone RoCC for Unit Testing
- Dominant language
- Scala
- Stars
- 3.9k
- Forks
- 1.3k
- Avg merge
- 5d 13m
- Merged PRs (30d)
- 1
Description
I'd like to be able to build a standalone version of a RoCC and run unit tests on it. This is generally a problem of building anything that mixes in `HasCoreParameters` as this pulls in all sorts of parameters that are only really populated for a full version of Rocket Chip.
I had this working before with a simple top module that instantiated the chosen RoCC, attached a [`TileLinkTestRam`](https://github.com/ucb-bar/rocket-chip/blob/94cc1efadc43a10ad0bdd14b0f672da89a729ffa/src/main/scala/uncore/devices/Bram.scala#L110) to the `autl` line, defined a few missing parameters (`NCoreplexExtClients`), preloaded the RAM using DPI, and drove this with a top-level C++ testbench. (I wasn't using the other ports of the RoCC and tied them off to some "assert if accessed" modules). However, some very recent modifications now require [`TLCacheEdge`](https://github.com/ucb-bar/rocket-chip/blob/master/src/main/scala/rocket/rocket.scala#L42) to be defined and I'm struggling to get something to build while attempting to grok a lot of things I haven't seen before (`LazyModule`, `diplomacy`?).
Is there any guidance on the best approach here?
I'm currently trying to think about this from a "RoccPlex" approach and attempt to replicate the smallest subset of `RocketTile` / `RocketPlex` and see how far I can get.
There are a couple of alternatives approaches which I think are unsound:
* Forgo unit testing and always rely on a Rocket + RoCC system. This may be fine, but only if you're running bare metal. Relying on the proxy kernel puts a user in an ~2 minute loop waiting for tests to run.
* Define some wrapper that extends `CoreModule` and allow the actual RoCC to not extend `CoreModule` but use other parameters which are overridden later.
Alternative phrasing would be: "Does Hwacha have unit tests and how do they work?"
Contributor guide
Research direction
Start by reading HasCoreParameters and TLCacheEdge in src/main/scala/rocket/rocket.scala, then compare the smallest relevant parts of RocketTile and RocketPlex. Review the earlier TileLinkTestRam-based setup and the RoccPlex approach; done would mean a documented, standalone RoCC build with unit tests that does not require a full Rocket system.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100