Verilog刷题笔记26

题目:
Build a combinational circuit with 100 inputs, in[99:0].

There are 3 outputs:

out_and: output of a 100-input AND gate.
out_or: output of a 100-input OR gate.
out_xor: output of a 100-input XOR gate.
Verilog刷题笔记26_第1张图片
解题:

module top_module( 
    input [99:0] in,
    output out_and,
    output out_or,
    output out_xor 
);
    assign out_and=&in[99:0];
    assign out_or=|in[99:0];
    assign out_xor=^in[99:0];
endmodule

结果正确:
Verilog刷题笔记26_第2张图片
Verilog刷题笔记26_第3张图片

你可能感兴趣的:(笔记)