module naive_bus_router #( parameter [7:0] N_MASTER = 2, parameter [7:0] N_SLAVE = 3, parameter [0:N_SLAVE-1][31:0] SLAVES_MASK = { 32'h0000_3fff , 32'h0000_3fff , 32'h0000_3fff }, parameter [0:N_SLAVE-1][31:0] SLAVES_BASE = { 32'h0000_0000 , 32'h0001_0000 , 32'h0002_0000 } )( input logic clk, rstn, naive_bus.slave masters [N_MASTER-1:0] , naive_bus.master slaves [ N_SLAVE-1:0] ); `define SLAVE_ADDRESS(master_addr, slave_index) (master_addr) & ( SLAVES_MASK[slave_index] ) `define SLAVE_INRANGE(master_addr, slave_index) ( ((master_addr) & (~SLAVES_MASK[slave_index]))==(SLAVES_BASE[slave_index]) ) logic [N_MASTER-1:0] masters_rd_req; logic [N_MASTER-1:0][ 3:0] masters_rd_be; logic [N_MASTER-1:0][31:0] masters_rd_addr; logic [N_MASTER-1:0] masters_wr_req; logic [N_MASTER-1:0][ 3:0] masters_wr_be; logic [N_MASTER-1:0][31:0] masters_wr_addr; logic [N_MASTER-1:0][31:0] masters_wr_data; logic [N_MASTER-1:0] masters_rd_gnt = 1'b0; logic [N_MASTER-1:0][ 7:0] master_rd_slv_index = {N_MASTER{N_SLAVE}}; logic [N_MASTER-1:0][ 7:0] master_rd_slv_index_latch = {N_MASTER{N_SLAVE}}; logic [N_MASTER-1:0][ 7:0] slv = {N_MASTER{N_SLAVE}}; logic [N_SLAVE-1:0] slaves_wr_gnt, slaves_rd_gnt; logic [N_SLAVE-1:0][ 7:0] mst = {N_SLAVE{N_MASTER}}; logic [N_SLAVE-1:0][ 7:0] slaves_wr_mst_index = {N_SLAVE{N_MASTER}}; logic [N_SLAVE-1:0][ 7:0] slaves_rd_mst_index = {N_SLAVE{N_MASTER}}; logic [N_SLAVE :0][31:0] slaves_rd_data; assign slaves_rd_data[N_SLAVE] = 0; generate genvar slv_i_assign; for(slv_i_assign=0; slv_i_assign