All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spinal.lib.generator.package.scala Maven / Gradle / Ivy

There is a newer version: 1.10.2a
Show newest version
package spinal.lib

import spinal.core.ClockDomain
import spinal.core.fiber._

package object generator {
//  type Handle[T] = spinal.core.fiber.Handle[T]

  implicit class GeneratorSeqPimper(pimped : Seq[Handle[_]]){
    //TODO fiber
    def produce[T](body : => T) : Handle[T] = hardFork{pimped.foreach(_.get); body}
  }

  implicit class HandleClockDomainPimper(pimped : Handle[ClockDomain]) {
    def apply[T](block: => T): T = {
      val ctx = ClockDomain.push(pimped)
      val ret: T = block
      ctx.restore()
      ret
    }

    def on[T](block: => T): T = apply(block)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy