Bug fixes: passing OC WB test
This commit is contained in:
parent
2cc1012fa2
commit
3781d1fb1a
@ -328,7 +328,7 @@ trait I2CModule extends Module with HasI2CParameters with HasRegMap {
|
|||||||
when (load) {
|
when (load) {
|
||||||
receivedData := transmitData
|
receivedData := transmitData
|
||||||
}
|
}
|
||||||
.otherwise {
|
.elsewhen (shift) {
|
||||||
receivedData := Cat(receivedData, receivedBit)
|
receivedData := Cat(receivedData, receivedBit)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -453,6 +453,11 @@ trait I2CModule extends Module with HasI2CParameters with HasRegMap {
|
|||||||
|
|
||||||
//////// Top level ////////
|
//////// Top level ////////
|
||||||
|
|
||||||
|
// hack
|
||||||
|
val nextCmd = Wire(UInt(8.W))
|
||||||
|
nextCmd := cmd.asUInt
|
||||||
|
cmd := (new CommandBundle).fromBits(nextCmd)
|
||||||
|
|
||||||
when (cmdAck || arbLost) {
|
when (cmdAck || arbLost) {
|
||||||
cmd.start := false.B // clear command bits when done
|
cmd.start := false.B // clear command bits when done
|
||||||
cmd.stop := false.B // or when aribitration lost
|
cmd.stop := false.B // or when aribitration lost
|
||||||
@ -461,6 +466,7 @@ trait I2CModule extends Module with HasI2CParameters with HasRegMap {
|
|||||||
}
|
}
|
||||||
cmd.irqAck := false.B // clear IRQ_ACK bit (essentially 1 cycle pulse b/c it is overwritten by regmap below)
|
cmd.irqAck := false.B // clear IRQ_ACK bit (essentially 1 cycle pulse b/c it is overwritten by regmap below)
|
||||||
|
|
||||||
|
status.receivedAck := receivedAck
|
||||||
when (stopCond) {
|
when (stopCond) {
|
||||||
status.busy := false.B
|
status.busy := false.B
|
||||||
}
|
}
|
||||||
@ -477,11 +483,6 @@ trait I2CModule extends Module with HasI2CParameters with HasRegMap {
|
|||||||
status.transferInProgress := cmd.read || cmd.write
|
status.transferInProgress := cmd.read || cmd.write
|
||||||
status.irqFlag := (cmdAck || arbLost || status.irqFlag) && !cmd.irqAck
|
status.irqFlag := (cmdAck || arbLost || status.irqFlag) && !cmd.irqAck
|
||||||
|
|
||||||
// hack
|
|
||||||
val nextCmd = Wire(UInt(8.W))
|
|
||||||
nextCmd := cmd.asUInt
|
|
||||||
cmd := (new CommandBundle).fromBits(nextCmd)
|
|
||||||
|
|
||||||
// Note that these are out of order.
|
// Note that these are out of order.
|
||||||
regmap(
|
regmap(
|
||||||
I2CCtrlRegs.prescaler_lo -> Seq(RegField(8, prescaler.lo)),
|
I2CCtrlRegs.prescaler_lo -> Seq(RegField(8, prescaler.lo)),
|
||||||
|
Loading…
Reference in New Issue
Block a user