Facing issue in AMBA APB VIP

I developed AMBA APB VIP, when I’m including constraint, the code gets into forever loop and when I’m removing it, it works fine.
Additionally, I cannot increase my gen.count value to more than 10, its again ending in forever loop.

here is EDA link of the code:
(1) - EDA Playground]((1) - EDA Playground)

You are showing simple SV code. Is this your intention? Or do you want to use UVM code?
Even without the constraint it is not stopping. Please add diagnostic messages for debugging. This allows you to identfy the problem.
Your problem is in the driver. The wait statements are stopping the simulation. It is not running in a forever loop. You should explicitely generate writes and reads and remove the waits in your driver.
This code shows how it runs:

Thanks aton. Previously while using if statement, some issue with clock arose hence I changed to wait. I’ll look into it.