Re: function semantics

Eli Sternheim (eli@interhdl.interhdl.com)
24 Nov 1998 19:13:22 -0000

This can cause a mismatch between simulation and synthesis. Verilint
detects this problem and issues a warning to that effect.

Eli

Delivered-To: eli@interhdl.com
X-Authentication-Warning: server.eda.org: majordom set sender to owner-vlog-synth@eda.org using -f
Reply-To: <muzok@pacbell.net>
From: "Muzaffer Kal" <muzok@pacbell.net>
Date: Tue, 24 Nov 1998 10:26:35 -0800
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook 8.5, Build 4.71.2377.0
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Sender: owner-vlog-synth@eda.org
Precedence: bulk

hi,
how are functions supposed to behave ? The specific question is what is the
value of a function when the function name is not assigned for a certain
invocation ? My simulator remembers the previous value (as a latch) but DC
creates a fully combinational implementation. An example is the following
module

module foo(in, out);
input in;
output out;

assign out = bar(in);

function bar;
input barin;

if (barin)
bar = 1;
endfunction

endmodule

what happens when in changes 0->1->0 ? I get 1'bx->1'b1->1'b1 so function
bar remembers the last value when bar is not assigned. I have been told that
other simulators do the same but this requires a latch, doesn't it ? I have
seen this problem with an 1'bX input which propogated to the output with DC
but not with simulation. I think the best way to solve this is to require
that the function internal register should get initialized to unknown for
every invocation. 1364 doesn't say how functions are supposed to behave.

thanks

-- 
Eli Sternheim                          interHDL, Inc.
4984 El Camino Real, Suite 210         Los Altos, CA. 94022-1433
phone: 650-428-4200                    fax:   650-428-4201
email: eli@interhdl.com
web: http://www.interhdl.com           ftp: ftp.interhdl.com