| // SPDX-License-Identifier: MIT |
| // SPDX-FileCopyrightText: 2021 Tamas Hubai |
| Fully combinatorial circuit shifting input bits from the mask bit positions |
| result = 0000000000011011 |
| input [`IO_PINS-1:0] data, |
| input [`IO_PINS-1:0] mask, |
| output [`IO_PINS-1:0] result |
| for (layer=0; layer<`IO_PINS; layer=layer+1) begin:comp |
| if (layer == 0) begin:i_first |
| assign sd = {{(`IO_PINS-1){1'b0}}, data[`IO_PINS-1] & mask[`IO_PINS-1]}; |
| wire [`IO_PINS-1:0] sdp = comp[layer-1].sd; |
| assign sd = mask[`IO_PINS-1-layer] ? {sdp[`IO_PINS-2:0], data[`IO_PINS-1-layer]} : sdp; |
| assign result = comp[`IO_PINS-1].sd; |