b18b08a4acbaaed701253505d97fda22c8d1fb69
[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 val Single = UInt(0, width)
9 val Dual = UInt(1, width)
10 val Quad = UInt(2, width)
11
12 val 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 val Rx = UInt(0, width)
19 val Tx = UInt(1, width)
20 }
21
22 object SPIEndian {
23 val width = 1
24 val MSB = UInt(0, width)
25 val LSB = UInt(1, width)
26 }
27
28 object SPICSMode {
29 val width = 2
30 val Auto = UInt(0, width)
31 val Hold = UInt(2, width)
32 val Off = UInt(3, width)
33 }