EBIKE Speed limit to throttle using pwm signals and hall sensor

you could start by:

If (speed_hall_sensor < value_for_maximum_speed) {
   process_for_power_delivery_through_pwm();
}

then you just program the PWM in steps as 25%, 50% and 100% of pedal assist , right?