Giter VIP home page Giter VIP logo

Comments (9)

aayupov avatar aayupov commented on August 22, 2024

Anyone could reproduce it at least?

from chisel-testers.

chick avatar chick commented on August 22, 2024

I have reproduced it. Not sure what's going on. For some reason the internal iteration through the elements is missing a field when the bundle is defined with PeekPokeTester

from chisel-testers.

chick avatar chick commented on August 22, 2024

The root of the problem is that when the bundle is declared in a subclass of PeekPokeTester instead of a Module there is a problem in the lazy assembly of the bundle's elements field.

  • It iterates over the public elements of the field.
  • It invokes each element and sees if the return value of the invoke has been seen before
  • It uses a set seen of the return values to do this.
  • When created in a PeekPokeTester the hashCode of these returned elements are zero
    • This is because the trait HasId overrides hashCode and numbers on based on state saved in the Builder DynamicVariable.
    • This is not properly set up when called from PeekPokeTester
  • So it confuses additional fields as ones already seen.
  • This does not happen when Bundles are instantiated within a Module

RECOMMENDATION:
I think this is a Bug, but fixing it requires some delicacy. The issue of Chisel components being instantiated outside of a Builder context has come up before. My inclination would be to defer this to the next release. It may be that we can tackle this along with Bundle literals #417 and #77

from chisel-testers.

jackkoenig avatar jackkoenig commented on August 22, 2024

This is a really tough one. This has come up before and is why in my opinion, there should not be a default dynamic context in chisel3, it should just fail if you try to construct things outside of a Chisel run.

from chisel-testers.

jackkoenig avatar jackkoenig commented on August 22, 2024

The primary reason why bundles need to be instantiated inside the context of Chisel is that the order that the ids are assigned gives order to the fields of the Bundle. It looks like we might be able to do this better with scala reflection (https://stackoverflow.com/a/22478436/2483329). We will have to be super careful in fixing this though because Chisel uses these ids for lots of stuff so "fixing" this could have some very gnarly unintended consequences. Definitely going to require some thought.

from chisel-testers.

chick avatar chick commented on August 22, 2024

I agree with both comments, except that I think it's a reasonable presumption that within a PeekPokeTester one is, in fact, in a chisel context. Perhaps PeekPokeTester can take on some trait that gets it there.

from chisel-testers.

chick avatar chick commented on August 22, 2024

Might be fixed by bundle literals

from chisel-testers.

chick avatar chick commented on August 22, 2024

I think is best answered in the near term with chisel-testers2.

from chisel-testers.

chick avatar chick commented on August 22, 2024

I just retested this using chisel-testers and it seems to work properly now.
In addition, bundle literals now work and also seem to have the correct behavior

from chisel-testers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.