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

Target-Facing Support for Multiclock Simulation in FireSim #468

Merged
merged 18 commits into from
Mar 25, 2020

Conversation

davidbiancolin
Copy link
Contributor

This is the chipyard side of the multiclock PR in FireSim. I'm mostly interested in feedback on the chisel API for the clock bridge. How we choose to architect in support for multiple clock domains can easily change in the future.

Related issue: firesim/firesim#441

Type of change: new feature

Release Notes
Support simulation of targets with multiple clock domains in FireSim

class WithTracerVBridge extends RegisterBridgeBinder({
case target: HasTraceIOImp => TracerVBridge(target.traceIO)(target.p)
})
class WithTracerVBridge extends Config((_,_,_) => { case InstantiateTracerVBridges => true })
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm curious why this moves away from the IOBinders approach?
I believe @abejgonzalez is developing the Dromajo widget as another BridgeBinder that attaches to HasTraceIOImp.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made this change prior to your generator unification work, and i thought it would be nice to move the instantiation closer to the source. I was thiking that ideally the bridge could be instantiated directly in the tile itself perhaps using one of the generation hooks that exists in rocketchip. Then i could just delete the target mixins altogether.

But yes, in light of recent changes, I think it makes sense to continue plumbing this out to the top. I'll switch back to that scheme.

Copy link
Contributor

@abejgonzalez abejgonzalez Mar 16, 2020

Choose a reason for hiding this comment

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

Yes. Jerry is right. Right now the Dromajo Bridge nicely hooks into the TraceIO so keeping that interface would be nice. However, I am not opposed to it changing, I'll just follow what TracerV is doing.

}
case BoomCrossingKey => up(BoomCrossingKey, site) map { r =>
r.copy(crossingType = RationalCrossing())
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. I have no idea if the ArianeTile deals with crossings properly... but I think this should include this for now:

case ArianeCrossingKey => up(ArianeCrossingKey, site) map { a =>
    a.copy(crossingType = RationalCrossing())
  }

Copy link
Contributor

Choose a reason for hiding this comment

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

Also nit: change the map from r -> b for BOOM?

@@ -72,3 +78,15 @@ trait CanHaveMultiCycleRegfileImp {
}
}

trait HasFireSimClockingImp extends HasAdditionalClocks {
val outer: HasTiles
val (tileClock, tileReset) = p(FireSimClockKey).additionalClocks.headOption match {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you give an example of assigning different clocks to each of the tiles? Is that supported with this right now? It looks like you have the tiles on one domain and the uncore on another.

Copy link
Contributor

@colinschmidt colinschmidt left a comment

Choose a reason for hiding this comment

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

A few questions

@@ -344,3 +346,29 @@ class FireSimTraceGenL2Config extends Config(
outerLatencyCycles = 50) ++
new WithTraceGenBridge ++
new FireSimRocketChipConfig)


class WithRationalTiles(multiplier: Int, divisor: Int) extends Config((site, here, up) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this the right place for this? Or name?
I think there is a similar Config object in rocketchip

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look for it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe we can tear out all the TraceGen related stuff out of firechip. @zhemao do you still want it in here? TraceGenConfigs are now run out of Chipyard.

trait HasFireSimClockingImp extends HasAdditionalClocks {
val outer: HasTiles
val (tileClock, tileReset) = p(FireSimClockKey).additionalClocks.headOption match {
case Some(RationalClock(_, numer, denom)) if numer != denom => (clocks(1), ResetCatchAndSync(clocks(1), reset.toBool))
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this check really do anything? I.e. are there generators that do this math and don't realize they are making a synchronized design?
Also are the magic numbers necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The numer != denom check? No, but it saves the catch and sync hardware in the synchronous case. I can remove it.

I think how we plumb the clocks through the target is mostly a separate question to how we want to expose the generation of those clocks for firesim. I mostly just hacked together the prior to get something working quick.

In light of @jerryz123's recent push to harmonize the targets across firechip and chipyard, we should consider making our targets support multiclock by default. So for RTL bound for target-level RTL simulation or physical design, we'll need to define the other derived clocks somehow.

To remove the vector-indexing hack here i think what we want in the interim is to generate some clock-map [Key/String, ClockInfo] in the parameters object. We can provide some sugar to let the generator index the right element in the clock vector using the same key.

Copy link
Contributor

@colinschmidt colinschmidt left a comment

Choose a reason for hiding this comment

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

LGTM, pending a few questions.

CompleteConfig(p(firesim.configs.MemModelKey), nastiKey, Some(AXI4EdgeSummary(edge))))
})
}).toSeq
}
})

class WithTracerVBridge extends OverrideIOBinder({
(c, r, s, target: CanHaveTraceIOModuleImp) => target.traceIO.map(t => TracerVBridge(t)(target.p)).toSeq
(c, r, s, target: CanHaveTraceIOModuleImp) => target.traceIO match {
case Some(t) => t.traces.map(tileTrace => TracerVBridge(tileTrace)(target.p))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why doesn't this bridge take a clock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does, it's included in the TileTraceIO as it is synchronous to the specific tile that produced it.

"FireSimQuadRocketMulticlockConfig",
"WithSynthAsserts_BaseF1Config")

// Jerry broke these -- damn it Jerry.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this already tracked in a PR/Issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oops
I don't think this tracegen-specific stuff should be tracked in Firechip anyways. Doing a tracegen simulation in firesim should just require changing the BuildTop key.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah i'm in 100% agreement. No one runs the scala tests except me though. I'll fix it when i get the CI to run the scalatests for firechip.

@davidbiancolin davidbiancolin merged commit fe2f50f into dev Mar 25, 2020
@alonamid alonamid mentioned this pull request May 30, 2020
@davidbiancolin davidbiancolin deleted the firesim-multiclock branch May 30, 2020 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants