zoukankan      html  css  js  c++  java
  • 使用verilog实现4选1数据选择器的几种方法

    第一种方法
    module mux(
    d1,
    d2,
    d3,
    d4,
    se1,
    se2,
    dout
    );
    input d1;
    input d2;
    input d3;
    input d4;
    input se1;
    input se2;

    output dout;

    reg dout;

    always @ (d1 or d2 or d3 or d4 or se1 or se2)
    case({se1,se2})
    2'b00 : dout=d1;
    2'b01 : dout=d2;
    2'b10 : dout=d3;
    2'b11 : dout=d4;
    endcase
    endmodule
    第二种方法
    module mux(
    d1,
    d2,
    d3,
    d4,
    se1,
    se2,
    dout
    );
    input d1;
    input d2;
    input d3;
    input d4;
    input se1;
    input se2;

    output dout;

    reg dout;

    always @ (d1 or d2 or d3 or d4 or se1 or se2)
    if (!se1)
    begin
    if (!se2)
    dout = d1;
    else
    dout = d2;
    end
    else begin
    if (!se2)
    dout = d3;
    else
    dout = d4;
    end

    endmodule
    第三种方法
    module se(
    d1,
    d2,
    d3,
    d4,
    se1,
    se2,
    dout
    );
    input d1;
    input d2;
    input d3;
    input d4;
    input se1;
    input se2;

    output dout;

    reg dout;

    always @ (d1 or d2 or d3 or d4 or se1 or se2)
    assign dout=se1?se2?d4:d3:se2?d2:d1;
    endmodule
  • 相关阅读:
    2017-5-2 对话框控件
    2017-4-28 ListView控件
    2017-4-27 WinForm 布局及容器控件
    jQuery与Aiax应用
    jQuery中的动画
    jQuery中的事件
    jQuery中的DOM操作
    认识jQuery
    h5
    js动画效果
  • 原文地址:https://www.cnblogs.com/rednodel/p/4053474.html
Copyright © 2011-2022 走看看