• mux_xz


    `timescale 1ns / 1ps
    //////////////////////////////////////////////////////////////////////////////////
    // Engineer: connor jiao
    // Create Date: 10:36 2020/6/12
    // Design Name: 
    // Module Name: 
    // Function   :  二选一多路器,sel为z或x,两个输入端为1101,1111,则输出应该是?
    // Revision 0.01 - File Created
    // Additional Comments:
    //////////////////////////////////////////////////////////////////////////////////
    module mux_zx(
                    a,
                    b,
                    sel,
                    out
                    );
        input [3:0]a;
        input [3:0]b;
        input sel;
        output [3:0]out;
        assign out=sel?a:b;
    endmodule
    `timescale 1ns / 1ps
    //////////////////////////////////////////////////////////////////////////////////
    // Engineer: connor jiao
    // Create Date: 10:36 2020/6/12
    // Design Name: 
    // Module Name: 
    // Function   :  
    // Revision 0.01 - File Created
    // Additional Comments:
    //////////////////////////////////////////////////////////////////////////////////
    module mux_zx_tb();
        reg [3:0]a;
        reg [3:0]b;
        reg sel;
        wire [3:0]out;
        mux_zx inst_mux_zx(
                    .a(a),
                    .b(b),
                    .sel(sel),
                    .out(out)
                    );
        initial begin
            a=1101;
            b=1111;
            sel=1'bX;
            #100;
            sel=1'bZ;
            #100;
            $stop;
        end
    endmodule

    可以看到当sel选择端无论是未知态X和高阻态Z,输出都是未知态X。

    同时总结一下:

     reg型悬空为未知态,wire型悬空为高阻态

    YKJIAO
  • 相关阅读:
    五:系统及数据库
    四:WEB源码扩展
    三:搭建安全拓展
    二:数据包扩展
    一:基础入门-概念名词
    LeetCode 11. Container With Most Water
    LeetCode 263. Ugly Number
    LeetCode 10. Regular Expression Matching
    LeetCode 58. Length of Last Word
    LeetCode 53. Maximum Subarray
  • 原文地址:https://www.cnblogs.com/ajiaoa/p/13098132.html
Copyright © 2020-2023  润新知