| // SPDX-License-Identifier: MIT |
| // SPDX-FileCopyrightText: 2021 Tamas Hubai |
| Fully combinatorial programming multiplexer |
| input [`LOG_CORES-1:0] sel, |
| input [`PC_WIDTH-1:0] waddr, |
| input [`INSTR_WIDTH-1:0] wdata, |
| output [`CORES*`PC_WIDTH-1:0] cwaddr, |
| output [`CORES*`INSTR_WIDTH-1:0] cwdata |
| for (core=0; core<`CORES; core=core+1) begin:g_core |
| wire active = we && sel==core; |
| assign cwe[core] = active; |
| assign cwaddr[core*`PC_WIDTH +: `PC_WIDTH] = {(`PC_WIDTH){active}} & waddr; |
| assign cwdata[core*`INSTR_WIDTH +: `INSTR_WIDTH] = {(`INSTR_WIDTH){active}} & wdata; |