1
0

signal_bundles: add missing file

This commit is contained in:
Megan Wachs 2017-09-22 13:55:55 -07:00
parent 81e301f9f7
commit 5d1e9b793a

View File

@ -0,0 +1,27 @@
// See LICENSE for license details.
package sifive.blocks.devices.pwm
import Chisel._
import freechips.rocketchip.config.Field
import freechips.rocketchip.coreplex.{HasPeripheryBus, HasInterruptBus}
import freechips.rocketchip.diplomacy.{LazyModule, LazyMultiIOModuleImp}
import freechips.rocketchip.util.HeterogeneousBag
import sifive.blocks.devices.pinctrl.{Pin}
class PWMSignals[T <: Data] (pingen: ()=> T, val c: PWMParams) extends Bundle {
val pwm: Vec[T] = Vec(c.ncmp, pingen())
override def cloneType: this.type =
this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]
}
class PWMPins[T <: Pin] (pingen: ()=> T, c: PWMParams) extends PWMSignals[T](pingen, c)
object PWMPinsFromPort {
def apply[T <: Pin] (pins: PWMSignals[T], port: PWMPortIO): Unit = {
(pins.pwm zip port.port) foreach {case (pin, port) =>
pin.outputPin(port)
}
}
}