|
|
@@ -24,8 +24,8 @@ module S5443_3Top
|
|
|
#(
|
|
|
parameter CmdRegWidth = 32,
|
|
|
parameter AddrRegWidth = 12,
|
|
|
- parameter STAGES = 2,
|
|
|
- parameter SpiNum = 7
|
|
|
+ parameter STAGES = 3,
|
|
|
+ parameter SpiNum = 1
|
|
|
|
|
|
)
|
|
|
(
|
|
|
@@ -279,6 +279,12 @@ module S5443_3Top
|
|
|
|
|
|
wire smcValComb;
|
|
|
wire [CmdRegWidth/2-1:0] ansData;
|
|
|
+
|
|
|
+ wire requestToFifo;
|
|
|
+
|
|
|
+ wire [SpiNum-1: 0] emptyFlagTx;
|
|
|
+
|
|
|
+ wire [SpiNum-1:0] spiEn;
|
|
|
//================================================================================
|
|
|
// ASSIGNMENTS
|
|
|
//================================================================================
|
|
|
@@ -294,20 +300,41 @@ module S5443_3Top
|
|
|
assign Mosi1_io[6] =(SpiDir_o[6])?mosi1[6]:1'bz;
|
|
|
assign Mosi2_o = mosi2;
|
|
|
assign Mosi3_o = mosi3;
|
|
|
- assign Ss_o[0] = (assel[0])? ((chipSelFpga[0])? ssMuxed[0]:~ssMuxed[0]):chipSelFpga[0];
|
|
|
- assign Ss_o[1] = (assel[1])? ((chipSelFpga[1])? ssMuxed[1]:~ssMuxed[1]):chipSelFpga[1];
|
|
|
- assign Ss_o[2] = (assel[2])? ((chipSelFpga[2])? ssMuxed[2]:~ssMuxed[2]):chipSelFpga[2];
|
|
|
- assign Ss_o[3] = (assel[3])? ((chipSelFpga[3])? ssMuxed[3]:~ssMuxed[3]):chipSelFpga[3];
|
|
|
- assign Ss_o[4] = (assel[4])? ((chipSelFpga[4])? ssMuxed[4]:~ssMuxed[4]):chipSelFpga[4];
|
|
|
- assign Ss_o[5] = (assel[5])? ((chipSelFpga[5])? ssMuxed[5]:~ssMuxed[5]):chipSelFpga[5];
|
|
|
- assign Ss_o[6] = (assel[6])? ((chipSelFpga[6])? ssMuxed[6]:~ssMuxed[6]):chipSelFpga[6];
|
|
|
- assign SsFlash_o[0] = (assel[0])?(chipSelFlash[0]? ssMuxed[0]:~ssMuxed[0]):chipSelFlash[0];
|
|
|
- assign SsFlash_o[1] = (assel[1])?(chipSelFlash[1]? ssMuxed[1]:~ssMuxed[1]):chipSelFlash[1];
|
|
|
- assign SsFlash_o[2] = (assel[2])?(chipSelFlash[2]? ssMuxed[2]:~ssMuxed[2]):chipSelFlash[2];
|
|
|
- assign SsFlash_o[3] = (assel[3])?(chipSelFlash[3]? ssMuxed[3]:~ssMuxed[3]):chipSelFlash[3];
|
|
|
- assign SsFlash_o[4] = (assel[4])?(chipSelFlash[4]? ssMuxed[4]:~ssMuxed[4]):chipSelFlash[4];
|
|
|
- assign SsFlash_o[5] = (assel[5])?(chipSelFlash[5]? ssMuxed[5]:~ssMuxed[5]):chipSelFlash[5];
|
|
|
- assign SsFlash_o[6] = (assel[6])?(chipSelFlash[6]? ssMuxed[6]:~ssMuxed[6]):chipSelFlash[6];
|
|
|
+ // assign Ss_o[0] = (assel[0])? ((chipSelFpga[0])? ssMuxed[0]:~ssMuxed[0]):chipSelFpga[0];
|
|
|
+ // assign Ss_o[1] = (assel[1])? ((chipSelFpga[1])? ssMuxed[1]:~ssMuxed[1]):chipSelFpga[1];
|
|
|
+ // assign Ss_o[2] = (assel[2])? ((chipSelFpga[2])? ssMuxed[2]:~ssMuxed[2]):chipSelFpga[2];
|
|
|
+ // assign Ss_o[3] = (assel[3])? ((chipSelFpga[3])? ssMuxed[3]:~ssMuxed[3]):chipSelFpga[3];
|
|
|
+ // assign Ss_o[4] = (assel[4])? ((chipSelFpga[4])? ssMuxed[4]:~ssMuxed[4]):chipSelFpga[4];
|
|
|
+ // assign Ss_o[5] = (assel[5])? ((chipSelFpga[5])? ssMuxed[5]:~ssMuxed[5]):chipSelFpga[5];
|
|
|
+ // assign Ss_o[6] = (assel[6])? ((chipSelFpga[6])? ssMuxed[6]:~ssMuxed[6]):chipSelFpga[6];
|
|
|
+
|
|
|
+ assign Ss_o[0] = (assel[0]) ? ssMuxed[0] : chipSelFpga[0];
|
|
|
+ assign Ss_o[1] = (assel[1]) ? ssMuxed[1] : chipSelFpga[1];
|
|
|
+ assign Ss_o[2] = (assel[2]) ? ssMuxed[2] : chipSelFpga[2];
|
|
|
+ assign Ss_o[3] = (assel[3]) ? ssMuxed[3] : chipSelFpga[3];
|
|
|
+ assign Ss_o[4] = (assel[4]) ? ssMuxed[4] : chipSelFpga[4];
|
|
|
+ assign Ss_o[5] = (assel[5]) ? ssMuxed[5] : chipSelFpga[5];
|
|
|
+ assign Ss_o[6] = (assel[6]) ? ssMuxed[6] : chipSelFpga[6];
|
|
|
+
|
|
|
+
|
|
|
+ // assign SsFlash_o[0] = (assel[0])?(chipSelFlash[0]? ssMuxed[0]:~ssMuxed[0]):chipSelFlash[0];
|
|
|
+ // assign SsFlash_o[1] = (assel[1])?(chipSelFlash[1]? ssMuxed[1]:~ssMuxed[1]):chipSelFlash[1];
|
|
|
+ // assign SsFlash_o[2] = (assel[2])?(chipSelFlash[2]? ssMuxed[2]:~ssMuxed[2]):chipSelFlash[2];
|
|
|
+ // assign SsFlash_o[3] = (assel[3])?(chipSelFlash[3]? ssMuxed[3]:~ssMuxed[3]):chipSelFlash[3];
|
|
|
+ // assign SsFlash_o[4] = (assel[4])?(chipSelFlash[4]? ssMuxed[4]:~ssMuxed[4]):chipSelFlash[4];
|
|
|
+ // assign SsFlash_o[5] = (assel[5])?(chipSelFlash[5]? ssMuxed[5]:~ssMuxed[5]):chipSelFlash[5];
|
|
|
+ // assign SsFlash_o[6] = (assel[6])?(chipSelFlash[6]? ssMuxed[6]:~ssMuxed[6]):chipSelFlash[6];
|
|
|
+
|
|
|
+ assign SsFlash_o[0] = (assel[0]) ? ssMuxed[0] : chipSelFlash[0];
|
|
|
+ assign SsFlash_o[1] = (assel[1]) ? ssMuxed[1] : chipSelFlash[1];
|
|
|
+ assign SsFlash_o[2] = (assel[2]) ? ssMuxed[2] : chipSelFlash[2];
|
|
|
+ assign SsFlash_o[3] = (assel[3]) ? ssMuxed[3] : chipSelFlash[3];
|
|
|
+ assign SsFlash_o[4] = (assel[4]) ? ssMuxed[4] : chipSelFlash[4];
|
|
|
+ assign SsFlash_o[5] = (assel[5]) ? ssMuxed[5] : chipSelFlash[5];
|
|
|
+ assign SsFlash_o[6] = (assel[6]) ? ssMuxed[6] : chipSelFlash[6];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
assign Sck_o = sckMuxed;
|
|
|
|
|
|
assign widthSel[0] = spi0CtrlRR[6:5];
|
|
|
@@ -317,6 +344,15 @@ module S5443_3Top
|
|
|
assign widthSel[4] = spi4CtrlRR[6:5];
|
|
|
assign widthSel[5] = spi5CtrlRR[6:5];
|
|
|
assign widthSel[6] = spi6CtrlRR[6:5];
|
|
|
+
|
|
|
+ assign spiEn[0] = spi0CtrlRR[0];
|
|
|
+ assign spiEn[1] = spi1CtrlRR[0];
|
|
|
+ assign spiEn[2] = spi2CtrlRR[0];
|
|
|
+ assign spiEn[3] = spi3CtrlRR[0];
|
|
|
+ assign spiEn[4] = spi4CtrlRR[0];
|
|
|
+ assign spiEn[5] = spi5CtrlRR[0];
|
|
|
+ assign spiEn[6] = spi6CtrlRR[0];
|
|
|
+
|
|
|
|
|
|
assign spiMode[0] = spi0CtrlRR[7];
|
|
|
assign spiMode[1] = spi1CtrlRR[7];
|
|
|
@@ -578,6 +614,7 @@ module S5443_3Top
|
|
|
.Clk_i(gclk),
|
|
|
.Addr_i(addrExt),
|
|
|
.ToRegMapAddr_i(toRegMapAddr),
|
|
|
+ .RequestToFifo_i(requestToFifo),
|
|
|
.FifoRxRst_i(fifoRxRstRdPtr[0]),
|
|
|
.DataFromRegMap_i(ansData),
|
|
|
.SmcAre_i(SmcAre_i),
|
|
|
@@ -606,7 +643,7 @@ module S5443_3Top
|
|
|
.SmcVal_i(smcValComb),
|
|
|
.SmcData_i(SmcData_io),
|
|
|
.SmcAddr_i(addrExt),
|
|
|
-
|
|
|
+ .RequestToFifo_o(requestToFifo),
|
|
|
.ToRegMapVal_o(toRegMapVal),
|
|
|
.ToRegMapData_o(toRegMapData),
|
|
|
.ToRegMapAddr_o(toRegMapAddr),
|
|
|
@@ -872,6 +909,7 @@ module S5443_3Top
|
|
|
|
|
|
.TxFifoCtrlReg_o(txFifoCtrlReg[i]),
|
|
|
.RxFifoCtrlReg_o(rxFifoCtrlReg[i]),
|
|
|
+ .EmptyFlagTx_o(emptyFlagTx[i]),
|
|
|
.ToSpiVal_o(toSpiVal[i]),
|
|
|
.DataFromRxFifo_o(dataFromRxFifo[i]),
|
|
|
.ToSpiData_o(toSpiData[i])
|
|
|
@@ -880,7 +918,8 @@ module S5443_3Top
|
|
|
SPIm SPIm_inst (
|
|
|
.Clk_i(spiClkBus[i]),
|
|
|
.Start_i(spiTxEnSync[i]),
|
|
|
- .Rst_i(initRstGen[i]| spiMode[i]),
|
|
|
+ .Rst_i(initRstGen[i]| spiMode[i] | !spiEn[i]),
|
|
|
+ .EmptyFlag_i(emptyFlagTx[i]),
|
|
|
.SpiData_i(toSpiData[i]),
|
|
|
.Sck_o(sckR[i]),
|
|
|
.Ss_o(ssR[i]),
|
|
|
@@ -912,7 +951,8 @@ module S5443_3Top
|
|
|
QuadSPIm QuadSPIm_inst (
|
|
|
.Clk_i(spiClkBus[i]),
|
|
|
.Start_i(spiTxEnSync[i]),
|
|
|
- .Rst_i(initRstGen[i]| !spiMode[i]),
|
|
|
+ .Rst_i(initRstGen[i]| !spiMode[i] | !spiEn[i]),
|
|
|
+ .EmptyFlag_i(emptyFlagTx[i]),
|
|
|
.SpiDataVal_i(toSpiVal),
|
|
|
.SpiData_i(toSpiData[i]),
|
|
|
.Sck_o(sckQ[i]),
|