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 3737
3838module ad9084_ebz_spi #(
3939 parameter NUM_OF_SLAVES = 8 ,
40- parameter IS_4WIRE = 8'b00000001
40+ parameter [NUM_OF_SLAVES - 1 : 0 ] IS_4WIRE = 8'b00000001
4141) (
4242 input [NUM_OF_SLAVES- 1 :0 ] spi_csn,
4343 input spi_clk,
@@ -58,7 +58,8 @@ module ad9084_ebz_spi #(
5858 wire spi_csn_s;
5959 wire spi_enable_s;
6060
61- wire [NUM_OF_SLAVES- 1 :0 ] spi_csn_4wire;
61+ wire any_4wire_sel;
62+ wire any_3wire_sel;
6263
6364 // check on rising edge and change on falling edge
6465
@@ -87,17 +88,11 @@ module ad9084_ebz_spi #(
8788 end
8889 end
8990
90- // io buffer
91+ assign any_4wire_sel = | (~ spi_csn & IS_4WIRE);
92+ assign any_3wire_sel = | (~ spi_csn & ~ IS_4WIRE);
9193
92- genvar i;
93-
94- generate
95- for (i = 0 ; i < NUM_OF_SLAVES ; i = i + 1 ) begin
96- assign spi_csn_4wire[i] = (IS_4WIRE[i] == 1'b1 ) ? spi_csn[i] : 1'b1 ;
97- end
98- endgenerate
99-
100- assign spi_miso = (& spi_csn_4wire == 1'b0 ) ? spi_miso_in : spi_sdio;
94+ assign spi_miso = (any_4wire_sel) ? spi_miso_in :
95+ (any_3wire_sel) ? spi_sdio : 1'bz ;
10196 assign spi_sdio = (spi_enable_s == 1'b1 ) ? 1'bz : spi_mosi;
10297
10398endmodule
You can’t perform that action at this time.
0 commit comments