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.
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: