File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
projects/ad9084_ebz/common Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change 3838module ad9084_ebz_spi #(
3939
4040 parameter NUM_OF_SLAVES = 8 ,
41- parameter IS_4WIRE = 8'b00000001
41+ parameter [NUM_OF_SLAVES - 1 : 0 ] IS_4WIRE = 8'b00000001
4242) (
4343 input [NUM_OF_SLAVES- 1 :0 ] spi_csn,
4444 input spi_clk,
@@ -59,7 +59,8 @@ module ad9084_ebz_spi #(
5959 wire spi_csn_s;
6060 wire spi_enable_s;
6161
62- wire [NUM_OF_SLAVES- 1 :0 ] spi_csn_4wire;
62+ wire any_4wire_sel;
63+ wire any_3wire_sel;
6364
6465 // check on rising edge and change on falling edge
6566
@@ -88,17 +89,11 @@ module ad9084_ebz_spi #(
8889 end
8990 end
9091
91- // io buffer
92+ assign any_4wire_sel = | (~ spi_csn & IS_4WIRE);
93+ assign any_3wire_sel = | (~ spi_csn & ~ IS_4WIRE);
9294
93- genvar i;
94-
95- generate
96- for (i = 0 ; i < NUM_OF_SLAVES ; i = i + 1 ) begin
97- assign spi_csn_4wire[i] = (IS_4WIRE[i] == 1'b1 ) ? spi_csn[i] : 1'b1 ;
98- end
99- endgenerate
100-
101- assign spi_miso = (& spi_csn_4wire == 1'b0 ) ? spi_miso_in : spi_sdio;
95+ assign spi_miso = (any_4wire_sel) ? spi_miso_in :
96+ (any_3wire_sel) ? spi_sdio : 1'bz ;
10297 assign spi_sdio = (spi_enable_s == 1'b1 ) ? 1'bz : spi_mosi;
10398
10499endmodule
You can’t perform that action at this time.
0 commit comments