How to write a state machine with verilog