Bugs mux4

2023. 6. 18. 19:00FPGA/HDLBits

728x90

Problem Statement

This 4-to-1 multiplexer doesn't work. Fix the bug(s).

You are provided with a bug-free 2-to-1 multiplexer:

module mux2 (
    input sel,
    input [7:0] a,
    input [7:0] b,
    output [7:0] out
);
module top_module (
    input [1:0] sel,
    input [7:0] a,
    input [7:0] b,
    input [7:0] c,
    input [7:0] d,
    output [7:0] out  ); //

    wire [7:0] mux0, mux1;
    mux2 mux00 ( sel[0],    a,    b, mux0 );
    mux2 mux11 ( sel[0],    c,    d, mux1 );
    mux2 mux22 ( sel[1], mux0, mux1,  out );

endmodule

 

 


인스턴스화 시킨 모듈과 포트 명이 중복되면 안된다.

'FPGA > HDLBits' 카테고리의 다른 글

Exams/m2014 q4b  (0) 2023.06.19
Bugs addsubz  (0) 2023.06.18
Bugs nand3  (0) 2023.06.18
Exams/m2014 q4d  (0) 2023.06.18
Exams/m2014 q4c  (0) 2023.06.18