Re: [sv-bc] RE: functional if statement

From: Steven Sharp <sharp_at_.....>
Date: Tue Dec 09 2008 - 11:00:07 PST
>From: "Satyakam Sudershan" <satyakam@magma-da.com>

>Given the above description, can I replace the command "dout <=
>func(enable,din)" by "dout <= enable ? din : 1'bx"?

No.

The variable temp is static, and will retain its value between calls.
It will start out x, but after it is set to a different value by a
call with enable true, it will still have that value in a later call.
If it is called the next time with enable false, the previous value
will be returned.

This makes it very close to "dout <= enable ? din : dout".  If all
assignments to dout went through the function and therefore temp,
then it would be equivalent.  In that case, temp and dout would
always have the same value, so assigning dout from temp would be the
same as assigning it from itself. But during reset, when you execute
"dout <= 3'd0", dout and temp get out of sync.

Also, this similarity only applies if the function is only called
from this one place.  If it is called from multiple places, then
the different callers will be interfering with each other by
modifying the value of temp used by the next caller.

Steven Sharp
sharp@cadence.com


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Tue Dec 9 11:00:46 2008

This archive was generated by hypermail 2.1.8 : Tue Dec 09 2008 - 11:01:01 PST