System Verilog - case with or
10,156
You can create a case
with OR using a comma like this:
string str;
case (str)
"abc" , "dfg": begin
//some code
end
"yfg": begin
//some code
end
default: //some code
endcase
What you're doing is subtly different to ||
. You are presenting a list of alternatives to the case
statement instead of ORing several expressions together to give one alternative to the case
statement.
Related videos on Youtube
Author by
sara8d
Updated on June 04, 2022Comments
-
sara8d almost 2 years
How can I create case with or?
Something like:
string str; case (str) "abc" || "dfg": begin //some code end "yfg": begin //some code end default: //some code endcase