if-else 文の例 - 2023.2 日本語

Vivado Design Suite ユーザー ガイド: 合成 (UG901)

Document ID
UG901
Release Date
2023-11-01
Version
2023.2 日本語

次のコード例は、if-else 文を使用してマルチプレクサーを記述しています。

module mux4 (sel, a, b, c, d, outmux);
input [1:0] sel;
input [1:0] a, b, c, d;
output [1:0] outmux;
reg [1:0] outmux;

always @(sel or a or b or c or d)
begin
if (sel[1])
if (sel[0])
outmux = d;
else
else
outmux = c;
if (sel[0])
outmux = b;
end endmodule
else
outmux = a;