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

Properly invalidate submodule IOs in tests #745

Merged
merged 1 commit into from
Dec 20, 2017
Merged

Conversation

jackkoenig
Copy link
Contributor

Needed for chipsalliance/firrtl#706
Firrtl wasn't properly checking that submodule ports were invalidated, now it will. The Firrtl PR is failing the Chisel tests without this fix.

  • Type of change

    • Bug report
    • Feature request
    • Other enhancement
  • Impact

    • no functional change
    • API addition (no impact on existing code)
    • API modification
  • Development Phase

    • proposal
    • implementation
  • Release Notes

Fix tests

@jackkoenig jackkoenig added the Bugfix Fixes a bug, will be included in release notes label Dec 20, 2017
@jackkoenig jackkoenig added this to the 3.0.1 milestone Dec 20, 2017
@@ -32,6 +32,7 @@ class PipeInternalWires extends Module {

class CrossConnectTester(inType: Data, outType: Data) extends BasicTester {
val dut = Module(new CrossConnects(inType, outType))
dut.io := DontCare
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems odd: CrossConnects.io is bidirectional, I'm surprised this doesn't error (or does it?) out when assigning DontCare to it.

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 it works fine. Awkwardly just connecting to the actual input port errors because it's a Clock and apparently connecting DontCare to Clocks directly is an error

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait what is this code doing then? DontCare shouldn't have any effect on outputs, and the bundle connect should recurse to the inputs. Any thoughts why the behavior differs? That also sounds like a bug...

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 recurse and mark both as invalid including the output. Firrtl allows this, it's just ignored.

I think it is sensible to mark bidirectional aggregates DontCare. IMO it's a useful shorthand rather than having to call out each submodule input or your own module output. We should fix the mismatch between marking a clock DontCare yet still being able to just mark it's parent aggregate DontCare.

Let's discuss these issues before 3.1!

@@ -51,7 +51,8 @@ class BrokenVectorPacketModule extends Module {
}

class VectorPacketIOUnitTester extends BasicTester {
val device_under_test = Module(new BrokenVectorPacketModule)
val dut = Module(new BrokenVectorPacketModule)
dut.io <> DontCare
Copy link
Contributor

Choose a reason for hiding this comment

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

These tests don't check circuit behavior at all? They just elaborate? (in which case, another PR might be just to have them elaborate instead of run)

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 looks like it's a test for an old bug in Firrtl, what it really needs is "compileToVerilog".

Anyway this PR was just intended to get my very important Firrtl bugfix to work. It's a pretty scary bug that drops logic on connections to submodule ports. It must be in 3.0.1/1.01

Copy link
Contributor

@ducky64 ducky64 left a comment

Choose a reason for hiding this comment

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

The changes make sense, though I'm pretty concerned about the dut.io := DontCare, this seems like it might be masking a bug elsewhere.

@@ -32,6 +32,7 @@ class PipeInternalWires extends Module {

class CrossConnectTester(inType: Data, outType: Data) extends BasicTester {
val dut = Module(new CrossConnects(inType, outType))
dut.io := DontCare
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait what is this code doing then? DontCare shouldn't have any effect on outputs, and the bundle connect should recurse to the inputs. Any thoughts why the behavior differs? That also sounds like a bug...

@jackkoenig jackkoenig merged commit 0f5ba51 into master Dec 20, 2017
@jackkoenig jackkoenig deleted the invalidate-submodules branch May 15, 2018 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bugfix Fixes a bug, will be included in release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants