1
0

More Peripheral-to-pins cleanups

This commit is contained in:
Megan Wachs 2017-06-13 11:00:29 -07:00
parent b3f656affe
commit 8bfda68858
4 changed files with 24 additions and 15 deletions

View File

@ -22,10 +22,10 @@ trait HasPeripheryI2C extends HasSystemNetworks {
trait HasPeripheryI2CBundle { trait HasPeripheryI2CBundle {
val i2cs: Vec[I2CPort] val i2cs: Vec[I2CPort]
def toGPIOPins(syncStages: Int = 0): Seq[I2CGPIOPort] = i2cs.map { i => def I2CtoGPIOPins(syncStages: Int = 0): Seq[I2CPinsIO] = i2cs.map { i =>
val pin = Module(new I2CGPIOPort(syncStages)) val pins = Module(new I2CGPIOPort(syncStages))
pin.io.i2c <> i pins.io.i2c <> i
pin pins.io.pins
} }
} }

View File

@ -43,10 +43,10 @@ trait HasPeripheryPWM extends HasSystemNetworks {
trait HasPeripheryPWMBundle { trait HasPeripheryPWMBundle {
val pwms: HeterogeneousBag[PWMPortIO] val pwms: HeterogeneousBag[PWMPortIO]
def PWMtoGPIOPins(dummy: Int = 1): Seq[PWMGPIOPort] = pwms.map { p => def PWMtoGPIOPins(dummy: Int = 1): Seq[PWMPinsIO] = pwms.map { p =>
val pin = Module(new PWMGPIOPort(p.c)) val pins = Module(new PWMGPIOPort(p.c))
pin.io.pwm <> p pins.io.pwm <> p
pin pins.io.pins
} }
} }

View File

@ -23,10 +23,10 @@ trait HasPeripherySPI extends HasSystemNetworks {
trait HasPeripherySPIBundle { trait HasPeripherySPIBundle {
val spis: HeterogeneousBag[SPIPortIO] val spis: HeterogeneousBag[SPIPortIO]
def SPItoGPIOPins(syncStages: Int = 0): Seq[SPIGPIOPort] = spis.map { s => def SPItoGPIOPins(syncStages: Int = 0): Seq[SPIPinsIO] = spis.map { s =>
val pin = Module(new SPIGPIOPort(s.c, syncStages)) val pins = Module(new SPIGPIOPort(s.c, syncStages))
pin.io.spi <> s pins.io.spi <> s
pin pins.io.pins
} }
} }
@ -54,6 +54,15 @@ trait HasPeripherySPIFlash extends HasSystemNetworks {
trait HasPeripherySPIFlashBundle { trait HasPeripherySPIFlashBundle {
val qspi: HeterogeneousBag[SPIPortIO] val qspi: HeterogeneousBag[SPIPortIO]
// It is important for SPIFlash that the syncStages is agreed upon, because
// internally it needs to realign the input data to the output SCK.
// Therefore, we rely on the syncStages parameter.
def SPIFlashtoGPIOPins(syncStages: Int = 0): Seq[SPIPinsIO] = qspi.map { s =>
val pins = Module(new SPIGPIOPort(s.c, syncStages))
pins.io.spi <> s
pins.io.pins
}
} }
trait HasPeripherySPIFlashModuleImp extends LazyMultiIOModuleImp with HasPeripherySPIFlashBundle { trait HasPeripherySPIFlashModuleImp extends LazyMultiIOModuleImp with HasPeripherySPIFlashBundle {

View File

@ -30,9 +30,9 @@ trait HasPeripheryUARTBundle {
} }
def UARTtoGPIOPins(syncStages: Int = 0): Seq[UARTPinsIO] = uarts.map { u => def UARTtoGPIOPins(syncStages: Int = 0): Seq[UARTPinsIO] = uarts.map { u =>
val pin = Module(new UARTGPIOPort(syncStages)) val pins = Module(new UARTGPIOPort(syncStages))
pin.io.uart <> u pins.io.uart <> u
pin.io.pins pins.io.pins
} }
} }