通过级联 MUX,我创建了一个 8:1 MUX,我需要它接收 8 个不同的 64 位值的输入,然后 MUX 可以从中选择以输出 64 位值。尝试在 ModelSIm 中运行我的测试平台时出现此错误:数组连接类型“wire[63:0]$[7:0]”与端口 (A) 的“wire[7:0]”不兼容:可以t 混合打包和解包类型。
module control_MUX (control, holdVal, out);
input [2:0] control;
input [63:0] holdVal [7:0];
output [63:0] out;
multi8 ctrlMUX (out, control, holdVal [7:0]);
endmodule
module control_MUX_testbench();
wire [63:0]out;
reg [63:0] holdVal [7:0];
reg [2:0] control;
control_MUX dut (control, holdVal, out);
initial begin
holdVal[0] = 64'd0;
holdVal[1] = 64'd1;
holdVal[2] = 64'd2;
holdVal[3] = 64'd3;
holdVal[4] = 64'd4;
holdVal[5] = 64'd5;
holdVal[6] = 64'd6;
holdVal[7] = 64'd7;
control = 3'b000; #10;
control = 3'b001; #10;
control = 3'b010; #10;
control = 3'b011; #10;
control = 3'b100; #10;
control = 3'b101; #10;
control = 3'b110; #10;
control = 3'b111; #10;
end
endmodule
// 8x3 multiplexer
// A is the 8 bit input and select is a 3 bit input
module multi8 (out, select, A);
output [63:0] out;
input [7:0] A;
input [2:0] select;
wire mux3, mux4;
multi4 muxC (mux3, select[1:0], A[3:0]);
multi4 muxD (mux4, select[1:0], A[7:4]);
multi2 final8 (out, select[2], mux3, mux4);
endmodule