How to implement semaphore with priority request to bypass other pending request?

In reply to rahulkumarbudhwani:

Hi Rahul,

I still can’t get your request clearly but whatever my understanding is there i will put in the pseudo code here. I understand that you need to drive certain threads based on certain condition and priority. You can use combination of if and case statement for getting the condition and then choosing/assigning the priority of thread and then driving the pins within those thread using semaphore.

// In driver code (Runs in forever block)


if(condition on which priority is defined)  
begin
  case(priority)
  1 : priority 1 thread ();
  2 : priority 2 thread (); 
  3 : priority 3 thread ();
  endcase
end

task priority 1 thread();
  sema.get(1)
   drive();
  sema.put(1);
endtask