// Original Coco 3 Plus contributions: Copyright (c) 2026 Brian K. Holman. // Original component notices/terms retained; see COPYRIGHT.md and LICENSING.md. // SPDX-License-Identifier: BSD-3-Clause // One shared engine per controller, independently placeable in four sockets. // ROM and SCS selectors remain separate, software-addressable MPI fields. module bh_mpi_router( input wire [11:0] layout,input wire [1:0] cts,scs, output wire [2:0] rom_kind,io_kind, output wire floppy_io,sdc_io,rom_io,serial_io, output reg ssc_present,orchestra_present,floppy_present,sdc_present); assign rom_kind=layout[cts*3+:3]; assign io_kind=layout[scs*3+:3]; assign floppy_io=io_kind==2; assign sdc_io=io_kind==3; assign rom_io=io_kind==1||io_kind==5||io_kind==6; // Legacy floppy/SDC setups include the existing RS232 endpoint. A separate // RS232 device can also be assigned without requiring a storage controller. assign serial_io=io_kind==2||io_kind==3||io_kind==7; integer n; always_comb begin ssc_present=0;orchestra_present=0;floppy_present=0;sdc_present=0; for(n=0;n<4;n=n+1)begin ssc_present=ssc_present||(layout[n*3+:3]==4)||(layout[n*3+:3]==6); orchestra_present=orchestra_present||(layout[n*3+:3]==5)||(layout[n*3+:3]==6); floppy_present=floppy_present||(layout[n*3+:3]==2); sdc_present=sdc_present||(layout[n*3+:3]==3); end end endmodule