Remove pluralization on interface names. Require clocks and resets explicitly when...
[sifive-blocks.git] / src / main / scala / devices / pinctrl / PinCtrl.scala
index 28beb0bbea1b6eb5509c7b0737bb355c02f1915b..f487d390963d2e44d7261b27644466b42e97d7b0 100644 (file)
@@ -21,6 +21,7 @@ abstract class Pin extends Bundle {
   val o: PinCtrl
 
   // Must be defined by the subclasses
+  def default(): Unit
   def inputPin(pue: Bool = Bool(false)): Bool
   def outputPin(signal: Bool,
     pue: Bool = Bool(false),
@@ -28,13 +29,6 @@ abstract class Pin extends Bundle {
     ie: Bool = Bool(false)
   ): Unit
   
-  def inputPin(pins: Vec[this.type], pue: Bool): Vec[Bool] = {
-    val signals = Wire(Vec(pins.length, new Bool()))
-    for ((signal, pin) <- (signals zip pins)) {
-      signal := pin.inputPin(pue)
-    }
-    signals
-  }
 }
 
 
@@ -43,6 +37,12 @@ abstract class Pin extends Bundle {
 class BasePin extends Pin() {
   val o = new PinCtrl().asOutput
 
+  def default(): Unit = {
+    this.o.oval := Bool(false)
+    this.o.oe   := Bool(false)
+    this.o.ie   := Bool(false)
+  }
+
   def inputPin(pue: Bool = Bool(false) /*ignored*/): Bool = {
     this.o.oval := Bool(false)
     this.o.oe   := Bool(false)
@@ -59,7 +59,6 @@ class BasePin extends Pin() {
     this.o.oe   := Bool(true)
     this.o.ie   := ie
   }
-
 }
 
 /////////////////////////////////////////////////////////////////////////
@@ -72,6 +71,14 @@ class EnhancedPin extends Pin() {
 
   val o = new EnhancedPinCtrl().asOutput
 
+  def default(): Unit = {
+    this.o.oval := Bool(false)
+    this.o.oe   := Bool(false)
+    this.o.ie   := Bool(false)
+    this.o.ds   := Bool(false)
+    this.o.pue  := Bool(false)
+  }
+
   def inputPin(pue: Bool = Bool(false)): Bool = {
     this.o.oval := Bool(false)
     this.o.oe   := Bool(false)