Skip to content

Instantly share code, notes, and snippets.

@azidar
Created January 21, 2018 20:01
Show Gist options
  • Save azidar/10d93dcb459ed06de3fb5895f440a311 to your computer and use it in GitHub Desktop.
Save azidar/10d93dcb459ed06de3fb5895f440a311 to your computer and use it in GitHub Desktop.
object RemoveNonInst {
def run(c: Circuit): Circuit = c map onModule
def onModule(m: DefModule): DefModule = m map onStmt map firrtl.Utils.squashEmpty
def onStmt(s: Statement): Statement = s map onStmt match {
case d: WDefInstance => d
case d: DefInstance => d
case b: Block => b
case c: Conditionally => Block(Seq(c.conseq, c.alt))
case other => EmptyStmt
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment