Verilog 防止底流和溢流

Verilog 防止底流和溢流,verilog,Verilog,这会停止下溢和溢出问题吗?regs(和输出regs)在always块中分配值。声明为wire或output的信号被视为“网络类型”,并使用assign语句为其赋值 将Rlower移动到always块中,或从声明中删除reg。这同样适用于Rupper尝试了u建议的方法,但仍然不起作用。相同的错误出现在语句Rlower=30和Rupper=225中,可能是因为没有在始终块中分配它们吗?请参阅:行Rcapture1=30上也有错误始终块-Rcapture是一个输入,无法赋值。很抱歉,我忘记更改此处的代

这会停止下溢和溢出问题吗?

regs
(和
输出regs
)在always块中分配值。声明为
wire
output
的信号被视为“网络类型”,并使用
assign
语句为其赋值


Rlower
移动到
always
块中,或从声明中删除
reg
。这同样适用于
Rupper

尝试了u建议的方法,但仍然不起作用。相同的错误出现在语句
Rlower=30
Rupper=225
中,可能是因为没有在
始终
块中分配它们吗?请参阅:行
Rcapture1=30上也有错误块开头的code>始终
块-
Rcapture
是一个输入,无法赋值。很抱歉,我忘记更改此处的代码,我通过执行赋值
对象解决了这个问题<代码>对象
对象
语句
  module threshold(input[7:0] oLCD_R1,
                  input[7:0] oLCD_G1,
                  input[7:0] oLCD_B1,
                  input[7:0] Rcapture1,
                  input[7:0] Gcapture1,
                  input[7:0] Bcapture1,
                  input oDEN1,
                  output reg[7:0] oLCD_R2,
                  output reg[7:0] oLCD_G2,
                  output reg[7:0] oLCD_B2,
                  output oDEN2,
                  output  [7:0] Rlower,
                  output  [7:0] Rupper,
                  output  [7:0] Glower,
                  output  [7:0] Gupper,
                  output  [7:0] Blower,
                  output  [7:0] Bupper
                );
assign Rlower = Rcapture1;
assign Rupper = Rcapture;
assign oDEN2 = oDEN1;

always @(*)
begin
     if (Rcaputre1 < 30)
     begin
     Rlower = 30;
     end
     if (Rcaputre1 > 225)
       begin
       Rupper = 225;
      end
end 
  begin
  if (
      ( ( Rcapture1 - 30  < oLCD_R1)  &&  (oLCD_R1 < Rcapture1 + 30 ) ) && 
      ( ( Gcapture1 - 30  < oLCD_G1)  &&  (oLCD_G1 < Gcapture1 + 30 ) ) &&
      ( ( Bcapture1 - 30  < oLCD_B1)  &&  (oLCD_B1 < Bcapture1 + 30 ) )
    )   

  begin
 oLCD_R2 = 255;
 oLCD_G2 = 192;
 oLCD_B2 = 0;
 end 
    else 
    begin   
     oLCD_R2 = oLCD_R1;
     oLCD_G2 = oLCD_G1;
     oLCD_B2 = oLCD_B1;
     end 
  end
 endmodule
assign Rlower = Rcapture1 ? Rcapture1 < 30  : Rlower == 30;
assign Rupper = Rcapture1 ? Rcapture1 < 225 : Rupper == 225;

assign Glower = Gcapture1 ? Gcapture1 < 30  : Glower == 30;
assign Gupper = Gcapture1 ? Gcapture1 < 225 : Gupper == 225;

assign Blower = Bcapture1 ? Bcapture1 < 30  : Blower == 30;
assign Bupper = Bcapture1 ? Bcapture1 < 225 : Bupper == 225;