In previos work, when I encounter the situation counter reach full state (such as counter[3:0] reaches 4'b1111), I used to manually flip counter to zeros on next rsing clock edge . However, I have ignored the fact that counter will automatically overflow on next rising clock edge when it reaches full state.
Codes below are part of synchronous FIFO design, I will release the rest when I finish testing.
Previous coding style
modified coding style