1 //See LICENSE for license details
3 package sifive.blocks.devices.pinctrl
7 // This is the base class of things you "always"
8 // want to control from a HW block.
9 class PinCtrl extends Bundle {
15 // Package up the inputs and outputs
17 abstract class Pin extends Bundle {
19 val ival = Bool(INPUT)
23 // Must be defined by the subclasses
25 def inputPin(pue: Bool = Bool(false)): Bool
26 def outputPin(signal: Bool,
27 pue: Bool = Bool(false),
28 ds: Bool = Bool(false),
29 ie: Bool = Bool(false)
35 ////////////////////////////////////////////////////////////////////////////////////
37 class BasePin extends Pin() {
38 val o = new PinCtrl().asOutput
40 def default(): Unit = {
41 this.o.oval := Bool(false)
42 this.o.oe := Bool(false)
43 this.o.ie := Bool(false)
46 def inputPin(pue: Bool = Bool(false) /*ignored*/): Bool = {
47 this.o.oval := Bool(false)
48 this.o.oe := Bool(false)
49 this.o.ie := Bool(true)
53 def outputPin(signal: Bool,
54 pue: Bool = Bool(false), /*ignored*/
55 ds: Bool = Bool(false), /*ignored*/
56 ie: Bool = Bool(false)
59 this.o.oe := Bool(true)
64 /////////////////////////////////////////////////////////////////////////
65 class EnhancedPinCtrl extends PinCtrl {
70 class EnhancedPin extends Pin() {
72 val o = new EnhancedPinCtrl().asOutput
74 def default(): Unit = {
75 this.o.oval := Bool(false)
76 this.o.oe := Bool(false)
77 this.o.ie := Bool(false)
78 this.o.ds := Bool(false)
79 this.o.pue := Bool(false)
82 def inputPin(pue: Bool = Bool(false)): Bool = {
83 this.o.oval := Bool(false)
84 this.o.oe := Bool(false)
86 this.o.ds := Bool(false)
87 this.o.ie := Bool(true)
92 def outputPin(signal: Bool,
93 pue: Bool = Bool(false),
94 ds: Bool = Bool(false),
95 ie: Bool = Bool(false)
98 this.o.oe := Bool(true)