device pins: Create classes that can be something other than a Pin subclass
[sifive-blocks.git] / src / main / scala / devices / pwm / PWMPeriphery.scala
index 3754f71ca3dbf562d05f3169ba370e9a5e1335ba..94f65dd760e8c5d75537fc380140492a689526d8 100644 (file)
@@ -13,10 +13,17 @@ class PWMPortIO(val c: PWMParams) extends Bundle {
   override def cloneType: this.type = new PWMPortIO(c).asInstanceOf[this.type]
 }
 
-class PWMPins[T <: Pin] (pingen: ()=> T, val c: PWMParams) extends Bundle {
+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, val c: PWMParams) extends PWMSignals[T](pingen, c) {
+
   override def cloneType: this.type =
     this.getClass.getConstructors.head.newInstance(pingen, c).asInstanceOf[this.type]