-
Notifications
You must be signed in to change notification settings - Fork 597
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
More of the bindings refactor #635
Conversation
rocket builds on this now, with one change to src/main/scala/uncore/axi4/Deinterleaver.scala diff --git a/src/main/scala/uncore/axi4/Deinterleaver.scala b/src/main/scala/uncore/axi4/Deinterleaver.scala
index 3778c91..e7cb257 100644
--- a/src/main/scala/uncore/axi4/Deinterleaver.scala
+++ b/src/main/scala/uncore/axi4/Deinterleaver.scala
@@ -46,7 +46,7 @@ class AXI4Deinterleaver(maxReadBytes: Int)(implicit p: Parameters) extends LazyM
val qs = Seq.tabulate(endId) { i =>
val depth = edgeOut.master.masters.find(_.id.contains(i)).flatMap(_.maxFlight).getOrElse(0)
if (depth > 0) {
- Module(new Queue(out.r.bits, beats)).io
+ Module(new Queue(out.r.bits.cloneType, beats)).io
} else {
Wire(new QueueIO(out.r.bits, beats))
}
|
Why is the clonetype needed? |
The new semantics require a chisel type on the Mem constructor in chisel3._. What happens here is that rocket invokes a Queue constructor (under This is a larger problem in the compatibility layer, since many things are only validated at the chiselFrontend level (UInt(...), Reg(...), ...), but a higher-level library (like |
Is it possible to introduce an overload for Queue that takes in a hardware type and calls clonetype to get the Chisel type automatically? |
Even if it leads to a little code duplication we really need to not force |
I could patch Queue specifically, but the more general problem here is that libraries (like chisel utils) are loose in what they accept and don't propagate (or even take) compile options. I'm not sure as to the best way to solve this. Also, I think a fix in rocket is fine since it's only one use, rather than generally accepted practice (as in, I think the convention people are following is to pass in chisel types where chisel types are expected, and this was an instance where a break in convention was not caught and made it through. |
What other libraries in utils have the same issue, and does it make sense to pre-emptively work around them (e.g. deal with compatibility errors like chisel vs hardware type)?
Is this convention valid in |
It's an issue that potentially affects everything in utils, but this seems to be the only problem in rocket. This PR doesn't add strict semantics to Bundle construction, though. That might cause more issues, and a more robust workaround may be needed. |
Resolution: add CompileOptions to Queue and hope that this is the only code that this change breaks, also add a big nasty dynamic deprecation warning when this is detected |
1708b4a
to
ce25416
Compare
@jackkoenig does this fix things? |
I pushed some changes, Mems weren't checking compile options properly. In doing those changes I got an idea, what if |
|
||
def do_tabulate[T <: Data](n: Int)(gen: (Int) => T)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Vec[T] = | ||
apply((0 until n).map(i => gen(i))) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, if I recall correctly, we removed Vec.fill because it confused people when they were trying to create Chisel Types. Now that we're splitting Vec and VecInit, might it be time to bring it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds cleaner than VecInit(Seq.fill(...)).
requireIsChiselType taking compile options: I really don't want to thread compile options through the code any more than is necessary, it just bloats the argument lists. I also don't want library writers using compile options, and it shouldn't be part of the chisel external API (it's actually not exposed in chisel3._). (similarly with SourceInfo, at least until we develop abstractions that make sense for propagating library entry locators and internals locators). requireIsChiselType is also experimental, and I think we should look for better abstractions than having library writers haphazardly sprinkling require guards in their code. |
Rest of the Bindings refactor
Tests with rocket-chip pending, will fix the use cases in chisel test suite soon so they stop spewing deprecated warnings.
It's likely that rocket-chip will need some fixes to match the new semantics. That list to come soon...
Part 2 (of probably 3?) in a series of PRs for #578