我想用数值设置一个枚举。以下代码对于 SystemVerilog 是否合法?
`define DEC_ADDR 32'hC001CAFE
typedef enum bit [31:0] {
ILLEGAL_ADDR_0=0,
DEC_ADDR=`DEC_ADDR
} my_addr_e;
module tb;
initial begin
my_addr_e addr_name;
bit [31:0] reg_addr;
reg_addr = `DEC_ADDR;
addr_name = reg_addr; // PROBLEM
end
endmodule
这是 EDA Playground 上的完整代码:http ://www.edaplayground.com/s/4/219