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

Add PortAPI between IO and Harness blocks #1610

Merged
merged 13 commits into from
Oct 15, 2023
Merged

Add PortAPI between IO and Harness blocks #1610

merged 13 commits into from
Oct 15, 2023

Conversation

jerryz123
Copy link
Contributor

@jerryz123 jerryz123 commented Oct 3, 2023

This adds trait iobinders.Port, which represents some IO bundle that should be exposed by ChipTop, and connected to in the Harness. Case classes extending this trait should package enough parameter information about the IO bundle to facilitate harness instantiation and/or IO-cell generation.

Changes:

  • IOBinders now emit Port objects, instead of raw IO. The Port object contains the IO, as well as parameterization information around the IO
  • HarnessBinders are now partial functions which match on Ports emitted by the ChipTop. This is only a cosmetic change to the implementations
  • HarnessBinders now cannot be used to inject arbitrary annotations/RTL into the harness
  • MultiHarnessBinders now can specify exact Ports to connect.

Unfortunately, due to the API change, the surface area of this PR is quite large. The main places to look are in chipyard/src/main/scala/iobinders/Ports.scala, to see the case classes describing top-level ports, as well as chipyard/src/main/scala/harness/HarnessBinders.scala, to see the updated HarnessBinder API

Related PRs / Issues:

Type of change:

  • Bug fix
  • New feature
  • Other enhancement

Impact:

  • RTL change
  • Software change (RISC-V software)
  • Build system change
  • Other

Contributor Checklist:

  • Did you set main as the base branch?
  • Is this PR's title suitable for inclusion in the changelog and have you added a changelog:<topic> label?
  • Did you state the type-of-change/impact?
  • Did you delete any extraneous prints/debugging code?
  • Did you mark the PR with a changelog: label?
  • (If applicable) Did you update the conda .conda-lock.yml file if you updated the conda requirements file?
  • (If applicable) Did you add documentation for the feature?
  • (If applicable) Did you add a test demonstrating the PR?
  • (If applicable) Did you mark the PR as Please Backport?

@jerryz123 jerryz123 marked this pull request as ready for review October 6, 2023 00:02
Copy link
Contributor

@joonho3020 joonho3020 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice API cleanups 👍🏼
LGTM

Copy link
Contributor

@abejgonzalez abejgonzalez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits. Overall LGTM

@@ -55,6 +55,16 @@ class WithScalaTestFeatures extends Config((site, here, up) => {
case TracePortKey => up(TracePortKey, site).map(_.copy(print = true))
})

// Multi-cycle regfile for rocket+boom
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of scope of this PR? If this PR takes a while to merge we can separate it out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the old IOBInder-based approach for adding these annotations, to a simpler match statement at the FireSim top level.

case class ExtIntPort (val io: UInt)
extends Port[UInt]

case class DMIPort (val io: ClockedDMIIO)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you deal with Parameters in these case classes? Sometimes the IO depends on p: Parameters?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered offline. The IO is constructed outside of this case class, thus you don't need the parameters to generate the IO.

Comment on lines +29 to +30
case class I2CPort (val io: sifive.blocks.devices.i2c.I2CPort)
extends Port[sifive.blocks.devices.i2c.I2CPort]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Why is this fully qualified?

Copy link
Contributor Author

@jerryz123 jerryz123 Oct 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because sifive.I2CPort name conflicts with this I2CPort. Ugly, unfortunately

// TODO FIX: This currently makes each SimDRAM contain the entire memory space
val memSize = port.params.master.size
val memBase = port.params.master.base
val lineSize = 64 // cache block size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LineSize isn't parameterized anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line_size doesn't actually matter for DRAM. We shouldn't even be passing it back to DRAMSim in the first place (and our DRAMSim driver doesn't use the line_size parameter for any calculations). It also requires line_size=64.

Future TODO is to remove the line_size argument to DRAMSim, so we can get rid of this here as well too.

@jerryz123 jerryz123 merged commit 2b16b9b into main Oct 15, 2023
1 check passed
@jerryz123 jerryz123 deleted the port_api branch November 8, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants