question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to traversal or return the signalName/Direction/type of all elements of a bundle?

See original GitHub issue

Could you enlight me how to traversal the signalName of a bundle? like

class test extends Bundle {
  val io = IO(new Bundle{
    val a = Input(Bool())
    val b = Input(Bool())
  })
  for ( signame <- io.elements) {
    printf("%s \n",signame)
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
jackkoenigcommented, Aug 7, 2017

You need to iterate on the elements of a, not a itself. Try:

for ((name, d) <- u0.io.a.elements) { ...
}

As for the printf, the type error is because it doesn’t know the type of d (until you make the fix I mentioned above), but you will get an elaboration time error with it as written. Instead try

printf(s"$name <- %d\n", d)

The above is a C-style printf. Alternatively, you could try using our custom String-interpolator which would be simply:

printf(p"$name <- $d\n")

Note how it uses p" instead of s", also that there are no arguments to send after the String. For more information, check out Printing in Chisel

0reactions
azidarcommented, Mar 16, 2018

Please reopen if issue was not resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Iterate through all Bundle objects - android
If you get all the way up to java.lang.Object then you've got a bundled object that can't immediately be stored in SharedPreferences.
Read more >
Bundle Function - NI - National Instruments
When you create a new cluster, you must wire all the inputs. The elements in the output cluster must appear in the same...
Read more >
Bundling Linked Data Structures for Linearizable Range Queries
only a range of the data structure instead of all elements [12]. ... returns the next node in a traversal toward the range...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found