连续赋值错误 Error (10219): Verilog HDL Continuous Assignment error
- 错误
Error (10219): Verilog HDL Continuous Assignment error
不能将一个连续赋值(continuous assignment)应用于具有寄存器(reg)类型的对象。
- 在Verilog中,连续赋值使用
assign
关键字,它只能用于连接型(net type)变量(如 wire
类型、SystemVerilog 中增加的logic 类型)。
错误示例
// 定义顶层模块
module top (
input wire clk, // 时钟信号
output reg [DATA_WIDTH-1:0] data_out // 数据输出
);
// 参数定义
parameter DATA_WIDTH = 8; // 数据宽度,根据需要调整
// 内部信号声明
wire [DATA_WIDTH-1:0] q_sig;
// 将顶层模块的端口连接到内部信号
assign data_out = q_sig;// Error (10219): Verilog HDL Continuous Assignment error at ***.v(36): object "data_out" on left-hand side of assignment must have a net type
// 实例化
//…………
endmodule
修正
// 定义顶层模块
module