优化spi,更严谨

This commit is contained in:
RuigeLee
2025-09-09 18:06:14 +08:00
parent ba04725e72
commit e258cd4a6c

View File

@@ -99,8 +99,8 @@ class SSpiInterface extends SpiInterfaceBase{
when( shiftCSn(2) & ~shiftCSn(1) || (~shiftCSn(2) & shiftCSn(1)) ){ //CS下跳或上跳
spiCmd := 0.U
} .elsewhen( isSckPosedgeNext(0) & ~shiftCSn(2) & byteSelNext === 2.U & bitSelNext === 0.U ){ //CS为低且SCK上跳的第0byte
spiCmd := shiftMOSI(2)
} .elsewhen( isSckPosedge & ~shiftCSn(1) & byteSel === 2.U & bitSel === 0.U ){ //CS为低且SCK上跳的第0byte
spiCmd := shiftMOSI(1)
}
@@ -178,8 +178,8 @@ class QSpiInterface extends SpiInterfaceBase{
when( (shiftCSn(2) & ~shiftCSn(1)) || (~shiftCSn(2) & shiftCSn(1)) ){ //CS下跳或上跳
spiCmd := 0.U
} .elsewhen( isSckPosedgeNext(0) & ~shiftCSn(2) & byteSelNext === 2.U & bitSelNext === 0.U ){ //CS为低且SCK上跳的第0byte
spiCmd := shiftMOSI(2).extract(3)
} .elsewhen( isSckPosedge & ~shiftCSn(1) & byteSel === 2.U & bitSel === 0.U ){ //CS为低且SCK上跳的第0byte
spiCmd := shiftMOSI(1).extract(3)
}
when( shiftCSn(2) & ~shiftCSn(1) ){