Verilog “我该如何解决?”;锁存可能由不完整的case或if语句生成;信息?

Verilog “我该如何解决?”;锁存可能由不完整的case或if语句生成;信息?,verilog,system-verilog,Verilog,System Verilog,我试着做4位ALU。 我得到了正确的输出。但是,在执行RTL原理图和技术原理图时,我会遇到如下错误: 灵敏度列表中缺失的信号被添加用于合成 目的。HDL和合成后模拟结果可能不同 锁存可能由不完整的case或if语句生成。是的 不建议在FPGA/CPLD设计中使用锁存器,因为它们可能 导致时间问题 我写了这段代码: module alu4bit( input [3:0] a, b, s, // a = Operand_1 , b = Operand_2, s = S

我试着做4位ALU。
我得到了正确的输出。但是,在执行
RTL原理图
技术原理图
时,我会遇到如下错误:

灵敏度列表中缺失的信号被添加用于合成 目的。HDL和合成后模拟结果可能不同

锁存可能由不完整的case或if语句生成。是的 不建议在FPGA/CPLD设计中使用锁存器,因为它们可能 导致时间问题

我写了这段代码:

module alu4bit(
    input [3:0] a, b, s,            //  a = Operand_1 , b = Operand_2, s = Select
    output reg [7:0] y , remainder, //   y = outPut
    output reg negative
 );

 always @ (s)
    begin
        case(s)
            4'b0000: begin
                        negative = 0;
                        remainder <= 0;
                        y<= a+b;                        // Addition
                    end
                              
            4'b0001: begin
                        if(a<b) begin
                            y<= b-a;
                            negative =1;
                        end                             // Substraction
                        else begin
                                negative = 0;
                                y<= a-b;
                            end
                        end
                                
            4'b0010: begin
                        negative = 0;
                        remainder <= 0;
                        y<= a*b;                        // Multiplication
                    end
                              
            4'b0011: begin
                        if(a<b) begin
                            y<= 0;
                            remainder <= a;
                        end                             // Division  a/b
                        else begin
                                y <= a/b;
                                remainder <= a - (b*y);
                            end
                        end
            default: begin
                        negative = 0;
                        remainder <= 0;                 // Default  
                        y <= 0;
                    end
                              
        endcase
    end
endmodule
模块alu4bit(
输入[3:0]a,b,s,//a=操作数_1,b=操作数_2,s=选择
输出寄存器[7:0]y,余数,//y=output
输出寄存器负
);
始终@(s)
开始
案件(s)
4'b0000:开始
负=0;
余数您看到“灵敏度列表中缺少信号”消息的原因是,组合
始终
块的灵敏度列表中只有一个所需信号。更改:

 always @ (s)
致:

该语法自动包含所需的所有内容:
s
a
b

您看到“可能生成闩锁”消息的原因是您没有对
case
语句的所有分支中的所有信号进行赋值。您没有在
4'b0011
案例中对
negative
进行赋值,在
4'b0001
案例中未对余数进行赋值


我还发现了一个问题:

                            y <= a/b;
                            remainder <= a - (b*y);
y
                            y <= a/b;
                            remainder <= a - (b*y);