Chisel Lang

93 Members
Discussion about the Chisel Hardware Description Language. Use the following Scastie Template for testing and questions: https://bit.ly/33esRsD1 Servers

Load older messages

21 Oct 2020
@gitter_hitoswal:matrix.orgHitesh Vijay Oswal (Gitter)okat thanks20:17:58
@gitter_hitoswal:matrix.orgHitesh Vijay Oswal (Gitter) (edited) okat thanks => okay thanks 20:18:02
@seldridge:matrix.orgSchuyler EldridgeSorry about that!20:18:09
@seldridge:matrix.orgSchuyler EldridgeI'll file an issue about it. 20:18:15
@seldridge:matrix.orgSchuyler EldridgeFor the negedge triggered flops. No solution for that currently. It's a long-standing open issue. :( (https://github.com/freechipsproject/firrtl/issues/695)20:19:13
@gitter_hitoswal:matrix.orgHitesh Vijay Oswal (Gitter)okay thanks 20:20:09
@seldridge:matrix.orgSchuyler Eldridge Well, I guess you're narrowly asking about the edgedness of just the reset? 20:20:09
@gitter_hitoswal:matrix.orgHitesh Vijay Oswal (Gitter)yes20:20:21
@seldridge:matrix.orgSchuyler EldridgeNo support for that just yet... It's usually be talked about only from the perspective of the clock, but this is good to consider, too.20:20:50
@gitter_hitoswal:matrix.orgHitesh Vijay Oswal (Gitter)I need to instantiate neg edged reset flop20:20:51
@seldridge:matrix.orgSchuyler EldridgeIs this a global setting or something you need for specific registers?20:21:27
@gitter_hitoswal:matrix.orgHitesh Vijay Oswal (Gitter)global setting....20:22:59
@seldridge:matrix.orgSchuyler EldridgeFor expediency, you can probably post-process the Verilog (some quick sed script). Otherwise, it's a question of a proposal and developer effort.20:25:31
@gitter_hitoswal:matrix.orgHitesh Vijay Oswal (Gitter) yes that's the plan for now. 21:28:40
22 Oct 2020
@gitter_danielkasza:matrix.orgDaniel Kasza (Gitter) In this example: https://scastie.scala-lang.org/Fd7JpQaFR5Os7za3zthXcw
Why is it that Bar's reset is a Reset, but Foo's reset is a UInt<1>?
...and what can I do in my FIRRTL transformation to be able to treat a Reset like a UInt<1>?
@gitter_danielkasza:matrix.orgDaniel Kasza (Gitter)

Somewhat related to this: I only ran into this because my transformation currently cannot tell which Modules it should apply to.
What is the correct way to check if a transformation was added to a module?

I have this annotation on the module:

    chisel3.experimental.annotate(new ChiselAnnotation with RunFirrtlTransform {
        def toFirrtl = CoverBranchesAnnotation(module.toNamed)
        def transformClass: Class[_ <: Transform] = classOf[CoverBranchesTransform]

...and I can see the CoverBranchesAnnotation in CircuitState.annotations. Should I just match that up with the Module by (string) name, or is there a better way to do it?

@gitter_jackkoenig:matrix.orgJack Koenig (Gitter) The Chisel side of Reset vs UInt<1> (aka Bool) is described here: https://www.chisel-lang.org/chisel3/docs/wiki-deprecated/reset.html 04:40:35
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter) But basically, val reset in Module and MultiIOModule is of type Reset which is abstract and has two concrete forms, Bool/UInt<1> and AsyncReset 04:41:11
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter) All resets can be inferred to their concrete forms if you run after InferResets 04:41:27
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter)You are correct that the way to apply your transformation to Modules is to find your annotations, get the names from them, and then apply to the modules with those names04:42:41
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter) I guess we could wrap that in some utilities, but basic approach isn't too bad: 04:43:15
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter)
def execute(state: CircuitState): CircuitState = {
  val markedModules: Set[String] = state.annotations.collect { case CoverBranchesAnnotation(modName) => modName.name }.toSet
  val modulesx = state.circuit.modules.map {
    case m: Module if markedModules.contains(m.name) => applyTransform(m)
    case other => other
  state.copy(circuit = state.circuit.copy(modules = modulesx))
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter) It's also often a good idea to "consume" your annotations, annoyingly there isn't a simple utility for it but you can remove those annotations from state.annotations. 04:45:48
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter) To run after InferResets mixin DependencyAPIMigration to your Transform and override prerequisites to include Dependency[InferResets]. I'm assuming you are covering branches of whens right? You'll also want to make sure to run before ExpandWhens by overriding def optionalPrerequisiteOf to include Dependency(ExpandWhens) The square brackets vs. parentheses is whether the transform in question is a class or a singleton object 04:47:48
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter) (edited) To run after `InferResets` mixin `DependencyAPIMigration` to your Transform and override `prerequisites` to include `Dependency[InferResets]`. I'm assuming you are covering branches of `whens` right? You'll also want to make sure to run before `ExpandWhens` by overriding `def optionalPrerequisiteOf` to include `Dependency(ExpandWhens)` The square brackets vs. parentheses is whether the transform in question is a `class` or a singleton `object` => All resets will be inferred to their concrete forms if you run after `InferResets` 04:48:08
@gitter_danielkasza:matrix.orgDaniel Kasza (Gitter) I agree, that does not look too bad. It's also cleaner than what I would have done since I am still learning Scala... :) Thanks again! 12:25:51
23 Oct 2020
@gitter_ekiwi:matrix.orgKevin Laeufer (Gitter) If you want to extract your own annotations, a common pattern that I use is:
val (mine, others) = state.annotations.partition(_.isIntanceOf[MyFancyAnnotation])
@gitter_ekiwi:matrix.orgKevin Laeufer (Gitter) Unfortunately the Scala compiler does not know that all elements in mine are of type MyFancyAnnotation. 04:18:26
@gitter_ekiwi:matrix.orgKevin Laeufer (Gitter)I with there was a partition by type or similar04:18:46
@gitter_jackkoenig:matrix.orgJack Koenig (Gitter)Scala 2.13 has partitionMap which can do that, otherwise we could/should build our own abstractions06:34:21

There are no newer messages yet.

Back to Room List