一位比较器语法错误
One-bit comparator syntax errors
我正在尝试为一位比较器编写代码,但我不断收到错误。有帮助吗?
//onebit_comparator code
module onebit_comparator(
input wire a,b;
output wire equation);
wire X0,X1;
assign X0 = -a & b;
assign X1 = a & b;
assign equation = X0|X1;
endmoule;
错误
10170 Verilog HDL syntax error at onebit_comparator.v(4) neat text: "output"; expecting ")".
10112 Ignored design unit "onebit_comparator" at onebit_comaparator.v(2) due to previous errors
10170 Verilog HDL syntax error at onebit_comparator.v(12) near text: ";"; expecting a description
您有 2 个语法错误和 1 个拼写错误。
变化:
input wire a,b;
至:
input wire a,b,
您必须使用逗号而不是分号来分隔端口。
endmoule
是错字;你打算输入 endmodule
您不得在 endmodule
关键字(或任何其他 end
类型的关键字,例如 endcase
等)后使用分号。
这里是没有语法错误的完整代码:
module onebit_comparator(
input wire a,b,
output wire equation);
wire X0,X1;
assign X0 = -a & b;
assign X1 = a & b;
assign equation = X0|X1;
endmodule
我正在尝试为一位比较器编写代码,但我不断收到错误。有帮助吗?
//onebit_comparator code
module onebit_comparator(
input wire a,b;
output wire equation);
wire X0,X1;
assign X0 = -a & b;
assign X1 = a & b;
assign equation = X0|X1;
endmoule;
错误
10170 Verilog HDL syntax error at onebit_comparator.v(4) neat text: "output"; expecting ")".
10112 Ignored design unit "onebit_comparator" at onebit_comaparator.v(2) due to previous errors
10170 Verilog HDL syntax error at onebit_comparator.v(12) near text: ";"; expecting a description
您有 2 个语法错误和 1 个拼写错误。
变化:
input wire a,b;
至:
input wire a,b,
您必须使用逗号而不是分号来分隔端口。
endmoule
是错字;你打算输入 endmodule
您不得在 endmodule
关键字(或任何其他 end
类型的关键字,例如 endcase
等)后使用分号。
这里是没有语法错误的完整代码:
module onebit_comparator(
input wire a,b,
output wire equation);
wire X0,X1;
assign X0 = -a & b;
assign X1 = a & b;
assign equation = X0|X1;
endmodule