Verilog 使用'define inside Case语句不起作用

Verilog 使用'define inside Case语句不起作用,verilog,case-statement,Verilog,Case Statement,我试图在Verilogcase语句中使用`define进行设计,但是编译器在使用`define的所有行中都会抛出以下错误: 错误VCP2000“语法错误。意外标记:不可打印:\xe2。” 如果我在case语句之外使用`define,那么它可以正常工作。Verilog是否不允许在案例中定义 以下是我的代码示例: `define AND 4’b0000 `define OR 4’b0001 `define ADD 4’b0010 `define SLL 4’b0011 `define SLLFunc

我试图在Verilog
case
语句中使用
`define
进行设计,但是编译器在使用
`define
的所有行中都会抛出以下错误:

错误VCP2000“语法错误。意外标记:不可打印:\xe2。”

如果我在
case
语句之外使用
`define
,那么它可以正常工作。Verilog是否不允许在
案例中定义

以下是我的代码示例:

`define AND 4’b0000
`define OR 4’b0001
`define ADD 4’b0010
`define SLL 4’b0011
`define SLLFunc 6’b000000
`define SRLFunc 6’b000010
`define SRAFunc 6’b000011
`define ADDFunc 6’b100000

module ALUControl(
  ALUCtrl,
  ALUOp,
  FuncCode);
  
  input [3:0]ALUOp;
  input [5:0]FuncCode;
  output reg [3:0]ALUCtrl;
  
  always@(*) begin
    if (ALUOp == 4'b1111) begin
      case(FuncCode)
        //Compiler throws error for the below 2 lines
        `SLLFunc: ALUCtrl = `SLL;
        default: ALUCtrl = `AND;
      endcase
    end else begin
      ALUCtrl = ALUOp;
    end
  end
endmodule

文本宏不理解Verilog语法。它只是简单的文本替换

您的问题在于用于创建
`define
的编辑器。它使用的是结尾单引号
,而不是重音/勾号