Conditional Statements: (same as C)
Multiway Branching :
Case statement syntax :
Alternative 1 : statement 1;
Alternative 2 : statement 2;
Alternative 3 : statement 3;
default : default_statement;
casez :- treats all z values in the case alternatives or the case expression as don’t cares. All bit positions with z can also represented by ? in that position.
casex :- treats all x and z values in the case item or the case expression as don’t cares.
while loop (same as C)
for loop (same as C)
repeat loop :
Keyword : repeat
->executes the loop fixed number of times.
forever loop :
Keyword : forever
->executes forever until the $finish task is encountered
->equivalent to while(1)
->can be exited by the ‘disable’ statement
Eg : //clock generation
forever #10 clock=~clock; //clock with period of 20 units