verif/debug_controller: convert to a state machine.

Rather than having the main block wait multiple edges, convert it to a
state machine.  Icarus verilog is fine with the current implementation
but verilator is not.