spi: SPIParamsBase param needs to be public
[sifive-blocks.git] / src / main / scala / devices / spi / SPIConsts.scala
1 // See LICENSE for license details.
2 package sifive.blocks.devices.spi
3
4 import Chisel._
5
6 object SPIProtocol {
7 val width = 2
8 def Single = UInt(0, width)
9 def Dual = UInt(1, width)
10 def Quad = UInt(2, width)
11
12 def cases = Seq(Single, Dual, Quad)
13 def decode(x: UInt): Seq[Bool] = cases.map(_ === x)
14 }
15
16 object SPIDirection {
17 val width = 1
18 def Rx = UInt(0, width)
19 def Tx = UInt(1, width)
20 }
21
22 object SPIEndian {
23 val width = 1
24 def MSB = UInt(0, width)
25 def LSB = UInt(1, width)
26 }
27
28 object SPICSMode {
29 val width = 2
30 def Auto = UInt(0, width)
31 def Hold = UInt(2, width)
32 def Off = UInt(3, width)
33 }