spi_engine: Define SDO default state

There are devices where the SDO default state, between transactions, is
not GND, rather VCC.

Define a parameter, which can be used to set the default state of the
SDO line.
main
Istvan Csomortani 2018-09-05 11:00:08 +01:00 committed by István Csomortáni
parent 45a08a004d
commit 19655b8092
1 changed files with 4 additions and 2 deletions

View File

@ -41,7 +41,8 @@ module spi_engine_execution #(
parameter DEFAULT_SPI_CFG = 0,
parameter DEFAULT_CLK_DIV = 0,
parameter DATA_WIDTH = 8, // Valid data widths values are 8/16/24/32
parameter NUM_OF_SDI = 1 ) (
parameter NUM_OF_SDI = 1,
parameter [0:0] SDO_DEFAULT = 1'b0) (
input clk,
input resetn,
@ -358,7 +359,8 @@ always @(posedge clk) begin
end
end
assign sdo = data_shift[DATA_WIDTH];
assign sdo = (inst_d1 == CMD_TRANSFER) ? data_shift[DATA_WIDTH] : SDO_DEFAULT;
assign sdi_data = (NUM_OF_SDI == 1) ? data_shift[(DATA_WIDTH-1):0] :
(NUM_OF_SDI == 2) ? {data_shift_1[(DATA_WIDTH-1):0], data_shift[(DATA_WIDTH-1):0]} :
(NUM_OF_SDI == 3) ? {data_shift_2[(DATA_WIDTH-1):0], data_shift_1[(DATA_WIDTH-1):0],