RE: [sv-ec] Creating semaphores with negative number of keys

From: Rich, Dave <Dave_Rich_at_.....>
Date: Fri Aug 25 2006 - 08:29:58 PDT
In the absence of any wording that prevent negative numbers in the
construction of a semaphore, I would say that it just means some extra
number of keys must be 'put' into the bucket before any can be taken
out. The bucket is just a counter.

> -----Original Message-----
> From: owner-sv-ec@server.eda.org [mailto:owner-sv-ec@server.eda.org]
On
> Behalf Of Kakoli Bhattacharya
> Sent: Friday, August 25, 2006 3:23 AM
> To: sv-ec@server.eda.org
> Subject: [sv-ec] Creating semaphores with negative number of keys
> 
> Hello,
> 
> Given below is a testcase related to the use of semaphores.Here
'my_sm1'
> is
> a semaphore which has been initialized with a negative number of keys.
> I want to know if negative initialization can be done? If yes then
what
> does
> such an initialization mean? I am a bit confused about creating a
> semaphore with
> negative number of keys.
> 
> module semaphore5 (input [7:0] in1,in2, output reg [7:0] out1,out2);
> parameter param1 = 2;
> semaphore my_sm1 = new(-2);
> semaphore my_sm2 = new(param1);
> always @(in1,in2)
> begin
>   if (my_sm1 == null)
>     out1 = my_sm1 ? in1 ~^ in2 : in1 ^ in2;
>   if (my_sm2 != null)
>     out2 = in1 + in2;
> end
> endmodule
> 
> Regards,
> Kakoli
Received on Fri Aug 25 08:30:04 2006

This archive was generated by hypermail 2.1.8 : Fri Aug 25 2006 - 08:30:30 PDT