A0 can be compared with D1 as is shown in the training video.
there's a video on an 8 bit pwm using datapath. that'll be useful for you to understand the use of comparison of A0 and D1.
Writing new components in verilog is somewhat involved, and rarely necessary for a simple state machine.
I would first use a Lookup Table Component, and do it with schematic capture.
It will accomplish what you want without having to manually code a datapath.