Semaphore created with no keys

module top;
semaphore key=new(); // no keys

initial begin
  fork
   process1(2);
   process2(4);
  join_none
end

task process1(bit [3:0] id);
  #5 key.get(1);
  $display($time, "got the key for process[%0d]", id);
  #10 key.put(1);
  $display($time, "put the key back for process[%0d]", id);
endtask

task process2(bit [3:0] id);
  #5 key.get(1);
  $display($time, "got the key for process[%0d]", id);
  #10 key.put(1);
  $display($time, "put the key back for process[%0d]", id);
endtask

endmodule

In reply to anamehta:

What is your question?