我在第 11 行遇到语法错误 使用 xor 和 mux2x1 的全加器
module xormux(x1, x2, x3, y1, y2);
input x1, x2, x3;
output y1, y2;
wire w1, w2;
xor gate1(w1, x1, x2);
xor gate2(y1, w1, x3);
mux2x1 gate3(y2, w1, x3, x2);
endmodule
module xor(output o, input i1, i2);
assign o = i1 ^ i2;
endmodule
module mux2x1(output o, input i1, i2, s);
assign o = s ? i2 : i1;
endmodule
使用 xor 和 mux2x1 的全加器
xor
是 Verilog 中的保留关键字,根据标准中的表 22-1(参见 IEEE Std 1800-2017,“22.14.2 IEEE 1364-1995 关键字”)。
为您的模块使用不同的标识符。