Verilog:case statement inside always posedge block

Status
Not open for further replies.

vijay82

Member level 2
Joined
Jan 13, 2007
Messages
52
Helped
6
Reputation
12
Reaction score
7
Trophy points
1,288
Activity points
1,724
verilog case statement

Is is proper coding convention to use a case statement inside an always @posedge clk block? . Something like

always @(posedge clk or negedge rst_n)
if (rst_n == 1'b0)
<reset logic>
else
case < case variable >
<some logic>
.
.
.
endcase

It works all right, but I haven't seen any professional examples so far.
Thanks for any answers.
 

verilog case syntax

Hello,

yes, you can directly assign new states to case variable, then it's called a Mealy state machine. I prefer it for it's compactness.

Regards,
Frank
 
Reactions: bardia

    bardia

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…