2

I am updating a Firrtl transform that looks like this

class RetimeTransform extends Transform {
  override def inputForm: CircuitForm = LowForm
  override def outputForm: CircuitForm = LowForm
  
  ...

to the new Dependency API. Changed the transform to this

class RetimeTransform extends Transform with DependencyAPIMigration {

but now it does not run the transform in the same order as before. Is there a simple way to specify the dependencies so I get the original behavior?

Jack Koenig
  • 5,840
  • 15
  • 21
Chick Markley
  • 4,023
  • 16
  • 17

1 Answers1

2

Many thanks to the Chisel team. It seems the answer is to do the conversion like this.

class RetimeTransform extends Transform with DependencyAPIMigration {

  override def prerequisites: Seq[TransformDependency] = Forms.LowForm
  override def optionalPrerequisites: Seq[TransformDependency] = Forms.LowFormOptimized
  override def optionalPrerequisiteOf: Seq[TransformDependency] = Forms.LowEmitters
Chick Markley
  • 4,023
  • 16
  • 17
  • 1
    Note: For _exactly_ the same behavior as before, this also needs an `override def optionalPrerequisites = Forms.LowFormOptimized` to have the custom transform run after optimizations if optimizations are requested. The old scheduling algorithm would schedule `inputForm=LowForm` after "the last transform which has `outputForm=LowForm`", which used to be the optimization transform sequence. There is more info on this in the migration guide: https://gist.github.com/seldridge/0959d714fba6857c5f71ebc7c9044fcf#case-2-inputform--lowform. – seldridge Sep 29 '20 at 16:59