proc.v

来自「表决器,实现7人表决. 使用max+plus3编写. 使用简单方便.」· Verilog 代码 · 共 26 行

V
26
字号
// MAX+plus II Verilog Example
// Combinatorial Always Statement 
// Copyright (c) 1994 Altera Corporation

module proc (d, q);

    input  [2:0] d;
    output [1:0] q;

    integer num_bits;

    always @(d)
    begin: block
        integer i;

        num_bits = 0;
        for (i = 0; i < 3; i = i + 1)
           if (d[i] == 1)
               num_bits = num_bits + 1;
    end

    assign q = num_bits;

endmodule

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?