SystemVerilog 如何处理 case 语句中可能出现的通配符冲突?
How does SystemVerilog handle possible wildcard conflicts in case statements?
当我编写包含案例通配符的案例陈述时,如何处理或多或少的特定案例?
always_comb case(selector)
4'b0???: begin // Pick me if the msb is 0, unless the two lsb's are 01.
end
4'b0?01: begin // Pick me if the msb is 0 and the two lsb's are 01.
end
default: begin // Pick me if the msb is X or 1.
end
endcase
在上面的简化示例中,第一种情况(所有通配符)可以 selected 为 selector 的任何值,但我希望它 select 最具体可能的情况。案件就是这样处理的吗?
SystemVerilog 假定 case 语句具有优先顺序 - 第二项永远不会匹配。所以你需要先移动最具体的案例。 SystemVerilog 具有 unique case
和 priority case
构造以更好地指定您的意图。
当我编写包含案例通配符的案例陈述时,如何处理或多或少的特定案例?
always_comb case(selector)
4'b0???: begin // Pick me if the msb is 0, unless the two lsb's are 01.
end
4'b0?01: begin // Pick me if the msb is 0 and the two lsb's are 01.
end
default: begin // Pick me if the msb is X or 1.
end
endcase
在上面的简化示例中,第一种情况(所有通配符)可以 selected 为 selector 的任何值,但我希望它 select 最具体可能的情况。案件就是这样处理的吗?
SystemVerilog 假定 case 语句具有优先顺序 - 第二项永远不会匹配。所以你需要先移动最具体的案例。 SystemVerilog 具有 unique case
和 priority case
构造以更好地指定您的意图。