Verilog 编程实验(2)-4位2选1多路选择器的设计与实现

4位2选1多路选择器:

Implementation part:

//////////////////////////////////////////////////////////////////////////////////
module MUX_4bits_2_choose_1(

input wire [3:0]a,
input wire [3:0]b,
input wire s,
output wire [3:0]y
    );
assign y = s? a:b;
endmodule

Simulation part:

module MUX_4bits_2_choose_1_Test2;

    // Inputs
    reg [3:0] a;
    reg [3:0] b;
    reg s;

    // Outputs
    wire [3:0] y;

    // Instantiate the Unit Under Test (UUT)
    MUX_4bits_2_choose_1 uut (
        .a(a), 
        .b(b), 
        .s(s), 
        .y(y)
    );

    initial begin
        // Initialize Inputs
        a = 0;
        b = 0;
        s = 0;

        // Wait 100 ns for global reset to finish
        #100;

        // Add stimulus here
        #200
        a <= 4'b0000;
        b <= 4'b0000;


        #200
        a <= 4'b0010;
        b <= 4'b0000;

        #200
        a <= 4'b1010;
        b <= 4'b0011;

        #200
        a <= 4'b1010;
        b <= 4'b0110;   

    end

endmodule

Simulation Behavioral Model:

RTL Schematic:

欢迎指正—-

  • 11
    点赞
  • 35
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值