我有以下 Verilog 代码,为什么我得到“分配时不兼容的类型”-分配错误“pwmData = 4'b1000;”?我在 Active-HDL 9.2 中遇到错误。
module PwmTestbench;
parameter dataWidth = 4;
reg clock, reset, pwmData[3:0], loadPwmData;
wire pwmOut;
Pwm #(.dataWidth(dataWidth)) pwm (
.clk(clock),
.reset(reset),
.data(pwmData),
.load(loadPwmData),
.out(pwmOut)
);
initial begin
clock = 1'b1;
reset = 1'b1;
loadPwmData = 1'b0;
end
always begin
#1 clock = !clock;
end
initial begin
#1 pwmData = 4'b1000; // # Error: VCP2852 pwm_tb.v : (29, 1): Incompatible types at assignment: .pwmData<reg[3:0]> <- 4'b1000<[3:0]bit>.
#1 loadPwmData = 1'b1;
#2 loadPwmData = 1'b0;
#1 reset = 1'b0;
#512 $finish;
end
endmodule