ISSUE 16

Number 16
Category errata
Synopsis 19.7: `line - meaning of level parameter is unclear
State lrmdraft
Class errata-discuss
Arrival-DateAug 12 2001
Originator Shalom.Bresticker@motorola.com
Release 2001b: 19.7
Environment
http://boydtechinc.com/btf/archive/btf_2001/1446.html
Description
In 19.7 (`line): "The level parameter indicates whether an
include file has been entered (value is 1), an include file
is existed (value is), or neither has been done(value is 0)."

This sentence is incomprehensible to me.

At the very least, an example or examples must be added.
Fix
REWRITE 19.7 as follows:

"19.7 `line

It is important for Verilog tools to keep track of the filenames of the
Verilog source files and the line numbers in the files. This information
can be used for error messages or source code debugging, and can be
accessed by the Verilog PLI.

In many cases, however, the Verilog source is preprocessed by some other
tool, and the line and file information of the original source file can
be lost because the preprocessor might add additional lines to the source
code file, combine multiple source code lines into one line, concatenate
multiple source files, and so on.

The `line compiler directive can be used to specify the original source
code line number and filename. This allows the location in the original
file to be maintained if another process modifies the source. After the
new line number and filename are specified, the compiler can correctly
refer to the original source location. However, a tool is not required to
produce `line directives. These directives are not intended to be inserted
manually into the code, although they can be.

The compiler shall maintain the current line number and filename
of the file being compiled. The `line directive shall set
the line number and filename of the following line to those
specified in the directive.
The directive can be specified anywhere within the Verilog HDL source
description. However, only white space may appear on the
same line as the `line directive. Comments are not allowed
on the same line as a 'line directive.
All parameters in the `line directive are required. The
results of this directive are not affected by the `resetall
directive.

The syntax for the `line directive is given in Syntax 19-7.

line_compiler_directive ::=
`line number "filename" level

Syntax 19-7 Syntax for `line compiler directive

The number parameter shall be a positive integer that specifies
the new line number of the following text line. The filename parameter shall
be a string constant that is treated as the new name of the file. The filename
can also be a full or relative path name. The level parameter shall be 0, 1,
or 2. The value 1 indicates that the following line is the first line after
an include file has been entered. The value 2 indicates that the following line
is the first line after an include file has been exited. The value 0 indicates
any other line.

Example:
`line 3 "orig.v" 2
// This line is line 3 of orig.v after exiting include file

As the compiler processes the remainder of the file and new
files, the line number shall be incremented as each line is
read and the name shall be updated to the new current file
being processed. The line number shall be reset to 1 at the
beginning of each file. When beginning to read include files, the current line
and filename shall be stored for restoration at the termination of the include
file. The updated line number and filename information shall be available for
PLI access. The mechanism of library searching is not affected by the effects
of the `line compiler directive."


Also CLOSE errata/291 as superceded by the fix to errata/16.
Audit-Trail

From: Adam Krolnik <krolnik@lsil.com>
To: btf-bugs@boyd.com
Cc: btf@boyd.com
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Mon, 13 Aug 2001 10:13:55 -0500

Funny, there was a change request made on this line. It looks as
though the line was corrupted in the process somehow.

From the archives:

----------------------------------------
Date: Wed, 15 Dec 1999 10:34:44 -0600
From: Adam Krolnik <krolnik@lsil.com>
Subject: BTF - Draft 4 requested change.


-------------------------------------------------------------------
Was:

Section 19.7 `line, last sentence of paragraph 2.

"The level parameter indicates whether an include file has
been specified (value is 1), an include file is exited (value is 2),
or neither has been done (value is 0).

Proposed:

"The level parameter indicates whether an include file has
been entered (value is 1), an include file is exited (value is 2),
or neither has been done (value is 0).


Proposed change:

Switch 'specified' to 'entered' - removes ambiguity.



Adam Krolnik
Verification Mgr.
LSI Logic Corp.
Plano TX. 75074

From: Shalom Bresticker <Shalom.Bresticker@motorola.com>
To: btf-bugs@boyd.com
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Tue, 14 Aug 2001 07:30:21 +0300

--------------01F42FCF04F21168CC4AA238
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Adam,

That change was done.

The problem is not that the value 2 is missing.
It is there, it simply fell in my copy-and-paste.

The problem is that the meaning of 'entered' and 'exited'
in this context is completely unclear.

I'm going back to the 'cc' man page to find out the intended meaning.

Shalom


Adam Krolnik wrote:

> Funny, there was a change request made on this line. It looks as
> though the line was corrupted in the process somehow.
>
> From the archives:
>
> ----------------------------------------
> Date: Wed, 15 Dec 1999 10:34:44 -0600
> From: Adam Krolnik <krolnik@lsil.com>
> Subject: BTF - Draft 4 requested change.
>
>
> -------------------------------------------------------------------
> Was:
>
> Section 19.7 `line, last sentence of paragraph 2.
>
> "The level parameter indicates whether an include file has
> been specified (value is 1), an include file is exited (value is 2),
> or neither has been done (value is 0).
>
> Proposed:
>
> "The level parameter indicates whether an include file has
> been entered (value is 1), an include file is exited (value is 2),
> or neither has been done (value is 0).
>
>
> Proposed change:
>
> Switch 'specified' to 'entered' - removes ambiguity.

--
**************************************************************************
Shalom Bresticker Shalom.Bresticker@motorola.com
Motorola Semiconductor Israel, Ltd. Tel #: +972 9 9522268
P.O.B. 2208, Herzlia 46120, ISRAEL Fax #: +972 9 9522890
**************************************************************************



--------------01F42FCF04F21168CC4AA238
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

Adam,

That change was done.

The problem is not that the value 2 is missing.

It is there, it simply fell in my copy-and-paste.

The problem is that the meaning of 'entered' and 'exited'

in this context is completely unclear.

I'm going back to the 'cc' man page to find out the intended meaning.

Shalom

 

Adam Krolnik wrote:
<blockquote TYPE=CITE>Funny, there was a change request made on this line.
It looks as

 though the line was corrupted in the process somehow.

 From the archives:

 ----------------------------------------

 Date: Wed, 15 Dec 1999 10:34:44 -0600

 From: Adam Krolnik <krolnik@lsil.com>

 Subject: BTF - Draft 4 requested change.

 

 -------------------------------------------------------------------

 Was:

 Section 19.7 `line, last sentence of paragraph 2.

 "The level parameter indicates whether an include file has

 been specified (value is 1), an include file is exited (value
is 2),

 or neither has been done (value is 0).

 Proposed:

 "The level parameter indicates whether an include file has

 been entered (value is 1), an include file is exited (value is
2),

 or neither has been done (value is 0).

 

 Proposed change:

 Switch 'specified' to 'entered' - removes ambiguity.

-- 
 **************************************************************************
 Shalom Bresticker                           Shalom.Bresticker@motorola.com
 Motorola Semiconductor Israel, Ltd.                  Tel #: +972 9 9522268
 P.O.B. 2208, Herzlia 46120, ISRAEL                   Fax #: +972 9 9522890
 **************************************************************************

 

--------------01F42FCF04F21168CC4AA238--


From: Shalom Bresticker <Shalom.Bresticker@motorola.com>
To: btf-bugs@boyd.com
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Tue, 14 Aug 2001 15:06:10 +0300

--------------DA2FA00D11C738E468F57DA0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Please see the following, and then my comments:

Subject: Re: B29 Line and File compiler Directives.
From: Adam Krolnik <adamk@cyrix.com>
To: eli@avanticorp.com

> You mention that the `line directive having 2 additional optional parameters.
> I only have access to a sun/solaris CPP man page. These are the relevant
> sections:
>
> #line integer-constant "filename"
> Generate line control information for the next pass of
> the C compiler. integer-constant is interpreted as the
> line number of the next line and filename is inter-
> preted as the file from where it comes. If "filename"
> is not given, the current filename is unchanged. No
> additional tokens are permitted on the directive line
> after the optional filename.
>
> Output
> Output consists of a copy of the input file, with modifica-
> tions, plus lines of the form:
>
> #lineno " filename" "level"
>
> indicating the original source line number and filename of
> the following output line and whether this is the first such
> line after an include file has been entered (level=1), the
> first such line after an include file has been exited
> (level=2), or any other such line (level is empty).
>
> Are you asking for allowing the 'level' field from non specifyable
> directive? It would have to be optional since we are effectively
> merging two directives into one for Verilog.

It looks to me as though there was some confusion about the `line directive.
I looked at both CPP and Gnu CPP.

- The worst is the "level" parameter, which is a CPP output ! It is not a user directive at all ! It is INFORMATION
for the compiler which DESCRIBES the file hierarchy, not CONTROLLING it. Even worse, it became a REQUIRED parameter in 1364-2001. No
wonder I did not understand its meaning and use in 1364!

- Why is "filename" required ? Neither CPP nor Gnu CPP require it ! I might want to use the same file
in different places under different names. I should not have to play with this directive each time.

- The Gnu CPP man page says that "filename" is a string constant. Neither CPP nor Gnu CPP say that "filename" can be a full or
relative path name. Why here ? (I'm devil's advocate here.) What happens if "filename"
is something like ".." ? Is the Verilog compiler/interpreter supposed to relate to this as just a filename or is it
supposed to interpret file location as well ?

- By the way, the Gnu CPP man page specifies that the number parameter "is a non-negative decimal integer constant". (Interesting.
"Non-negative" means that 0 is permitted.)

- Also by the way, the CPP man page description of "level" is much clearer than what entered 1364.

In my opinion, "level" is a mistake and should be eliminated, and "filename" should be "optional".

Comments ?

Shalom


Shalom.Bresticker@motorola.com wrote:

> In 19.7 (`line): "The level parameter indicates whether an
> include file has been entered (value is 1), an include file
> is existed (value is), or neither has been done(value is 0)."
>
> This sentence is incomprehensible to me.
>
> At the very least, an example or examples must be added.

--
**************************************************************************
Shalom Bresticker Shalom.Bresticker@motorola.com
Motorola Semiconductor Israel, Ltd. Tel #: +972 9 9522268
P.O.B. 2208, Herzlia 46120, ISRAEL Fax #: +972 9 9522890
**************************************************************************



--------------DA2FA00D11C738E468F57DA0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

Please see the following, and then my comments:
Subject:        Re: B29
Line and File compiler Directives.

   From:        Adam Krolnik
<adamk@cyrix.com>

     To:       
eli@avanticorp.com
<blockquote TYPE=CITE>You mention that the `line directive having 2 additional
optional parameters.

I only have access to a sun/solaris CPP man page. These are the relevant

sections:

     #line integer-constant "filename"

          Generate line
control information for the next pass  of

          the C compiler. 
integer-constant is interpreted as the

          line number
of the next line  and  filename  is  inter-

          preted 
as the file from where it comes.  If "filename"

          is not given,
the current filename  is  unchanged.   No

          additional 
tokens  are permitted on the directive line

          after the optional
filename.

 Output

     Output consists of a copy of the input file,
with  modifica-

     tions, plus lines of the form:

          #lineno " filename"
"level"

     indicating the original source line number
and  filename  of

     the following output line and whether this
is the first such

     line after an include file has been entered 
(level=1),  the

     first  such  line  after 
an  include  file  has been exited

     (level=2), or any other such line (level is
empty).

Are you asking for allowing the 'level' field from non specifyable

directive?  It would have to be optional since we are effectively

merging two directives into one for Verilog.





It looks to me as though there was some confusion about the `line
directive.

I looked at both CPP  and Gnu CPP.

- The worst is the "level" parameter, which is a CPP output
! It is not a user directive at all ! It is INFORMATION

for the compiler which DESCRIBES the file hierarchy, not CONTROLLING it.
Even worse, it became a REQUIRED parameter in 1364-2001. No wonder
I did not understand its meaning and use in 1364!

- Why is "filename" required ? Neither CPP nor Gnu CPP require
it !  I might want to use the same file

in different places under different names. I should not have to
play with this directive each time.

-  The Gnu CPP man page says that "filename" is a string
constant. Neither CPP nor Gnu CPP say that "filename" can
be a full or relative path name. Why here ? (I'm devil's advocate
here.) What happens if "filename"

is something like ".." ? Is the Verilog compiler/interpreter supposed
to relate to this as just a filename or is it

supposed to interpret file location as well ?

- By the way, the Gnu CPP man page specifies that the number parameter
"is a non-negative decimal integer constant". (Interesting. "Non-negative"
means that 0 is permitted.)

- Also by the way, the CPP man page description of "level" is
much clearer than what entered 1364.

In my opinion, "level" is a mistake and should be eliminated, and
"filename" should be "optional".

Comments ?

Shalom

 

Shalom.Bresticker@motorola.com wrote:
<blockquote TYPE=CITE>In 19.7 (`line): "The level parameter indicates whether
an

include file has been entered (value is 1), an include file

is existed (value is), or neither has been done(value is 0)."

This sentence is incomprehensible to me.

At the very least, an example or examples must be added.

-- 
 **************************************************************************
 Shalom Bresticker                           Shalom.Bresticker@motorola.com
 Motorola Semiconductor Israel, Ltd.                  Tel #: +972 9 9522268
 P.O.B. 2208, Herzlia 46120, ISRAEL                   Fax #: +972 9 9522890
 **************************************************************************

 

--------------DA2FA00D11C738E468F57DA0--


From: Adam Krolnik <krolnik@lsil.com>
To: btf-bugs@boyd.com
Cc: btf@boyd.com
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Wed, 15 Aug 2001 15:13:55 -0500

So many questions... all in my archives somewhere...

>- The worst is the "level" parameter, which is a CPP output ! It is not a
>user directive at all ! It is INFORMATION
> for the compiler which DESCRIBES the file hierarchy, not CONTROLLING it. >Even worse, it became a REQUIRED parameter in 1364-2001. No
> wonder I did not understand its meaning and use in 1364!

> - Why is "filename" required ? Neither CPP nor Gnu CPP require it ! I >might want to use the same file
> in different places under different names. I should not have to play with >this directive each time.

This came up in the discussions. To simplify parsing, all parameters
became required. Since this directive was envisioned to be used by a
source code generator (preprocessor, source to source translator, etc.)
the requirement of the parameters was not considered a hardcase. You are
correct, it is not controlling anything; nor would you want it to.

> - The Gnu CPP man page says that "filename" is a string constant. >Neither CPP nor Gnu CPP say that "filename" can be a full or
> relative path name. Why here ? (I'm devil's advocate here.) What happens
> if "filename"
> is something like ".." ? Is the Verilog compiler/interpreter supposed to
>relate to this as just a filename or is it supposed to interpret file
>location as well ?

The filename is a string - whatever you want to put there. The
compiler's
only use for this data is to inform the user of something pertaining
to it. So your filename could be any of your examples. What the user
puts in is what he will get out.


Adam Krolnik
Verification Mgr.
LSI Logic Corp.
Plano TX. 75074

From: Shalom Bresticker <Shalom.Bresticker@motorola.com>
To: <btf-bugs@boyd.com>
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Thu, 16 Aug 2001 16:20:52 +0300

--------------475A0F87A8A42B1DEE7B3138
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Adam Krolnik wrote:

> >- The worst is the "level" parameter, which is a CPP output ! It is not a
> >user directive at all ! It is INFORMATION
> > for the compiler which DESCRIBES the file hierarchy, not CONTROLLING it. >Even worse, it became a REQUIRED parameter in 1364-2001. No
> > wonder I did not understand its meaning and use in 1364!
>
> > - Why is "filename" required ? Neither CPP nor Gnu CPP require it ! I >might want to use the same file
> > in different places under different names. I should not have to play with >this directive each time.
>
> This came up in the discussions. To simplify parsing, all parameters
> became required.

I don't understand the parsing problem.
It seems to have easy solutions.
The 'linenum' parameter is required.
"filename" is always surrounded by parentheses.
'level' is not surrounded by parentheses.
Further, you could make "filename" required if you want to give 'level'.
So parsing should be easy.


> Since this directive was envisioned to be used by a
> source code generator (preprocessor, source to source translator, etc.)
> the requirement of the parameters was not considered a hardcase. You are
> correct, it is not controlling anything; nor would you want it to.

Again, it looks to me to be a confusion between a compiler DIRECTIVE,
which TELLS the compiler to DO something, on the one hand,
and an informative preprocessor output on the other.

If, for CPP, 'linenum' and "filename" were enough, why does Verilog need 'level' as well ?
What does it add ? Why can't it just be a comment ?

And a preprocessor may not know, for example, whether a file is included or not.


> > - The Gnu CPP man page says that "filename" is a string constant. >Neither CPP nor Gnu CPP say that "filename" can be a full or
> > relative path name. Why here ? (I'm devil's advocate here.) What happens
> > if "filename"
> > is something like ".." ? Is the Verilog compiler/interpreter supposed to
> >relate to this as just a filename or is it supposed to interpret file
> >location as well ?
>
> The filename is a string - whatever you want to put there. The
> compiler's
> only use for this data is to inform the user of something pertaining
> to it. So your filename could be any of your examples. What the user
> puts in is what he will get out.

But if the LRM says it can be a full or relative path name, that seems to imply that it has real meaning.


--
**************************************************************************
Shalom Bresticker Shalom.Bresticker@motorola.com
Motorola Semiconductor Israel, Ltd. Tel #: +972 9 9522268
P.O.B. 2208, Herzlia 46120, ISRAEL Fax #: +972 9 9522890
**************************************************************************



--------------475A0F87A8A42B1DEE7B3138
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">

Adam Krolnik wrote:
<blockquote TYPE=CITE>>- The worst is the "level" parameter, which is a
CPP output ! It is not a

>user directive at all ! It is INFORMATION

> for the compiler which DESCRIBES the file hierarchy, not CONTROLLING
it. >Even worse, it became a REQUIRED parameter in 1364-2001. No

> wonder I did not understand its meaning and use in 1364!

> - Why is "filename" required ? Neither CPP nor Gnu CPP require it
!  I >might want to use the same file

> in different places under different names. I should not have to play
with >this directive each time.

This came up in the discussions. To simplify parsing, all parameters

became required.
I don't understand the parsing problem.

It seems to have easy solutions.

The 'linenum' parameter is required.

"filename" is always surrounded by parentheses.

'level' is not surrounded by parentheses.

Further, you could make "filename" required if you want to give
'level'.

So parsing should be easy.

 
<blockquote TYPE=CITE>Since this directive was envisioned to be used by
a

source code generator (preprocessor, source to source translator, etc.)

the requirement of the parameters was not considered a hardcase. You
are

correct, it is not controlling anything; nor would you want it to.
Again, it looks to me to be a confusion between a compiler DIRECTIVE,

which TELLS the compiler to DO something, on the one hand,

and an informative preprocessor output on the other.

If, for CPP, 'linenum' and "filename" were enough, why does Verilog
need 'level' as well ?

What does it add ? Why can't it just be a comment ?

And a preprocessor may not know, for example, whether a file is included
or not.

 
<blockquote TYPE=CITE>> -  The Gnu CPP man page says that "filename"
is a string constant. >Neither CPP nor Gnu CPP say that "filename" can
be a full or

> relative path name. Why here ? (I'm devil's advocate here.) What
happens

> if "filename"

> is something like ".." ? Is the Verilog compiler/interpreter supposed
to

>relate to this as just a filename or is it supposed to interpret file

>location as well ?

The filename is a string - whatever you want to put there. The

compiler's

only use for this data is to inform the user of something pertaining

to it. So your filename could be any of your examples. What the user

puts in is what he will get out.
But if the LRM says it can be a full or relative path name, that seems
to imply that it has real meaning.

 

-- 
 **************************************************************************
 Shalom Bresticker                           Shalom.Bresticker@motorola.com
 Motorola Semiconductor Israel, Ltd.                  Tel #: +972 9 9522268
 P.O.B. 2208, Herzlia 46120, ISRAEL                   Fax #: +972 9 9522890
 **************************************************************************

 

--------------475A0F87A8A42B1DEE7B3138--


From: Adam Krolnik <krolnik@lsil.com>
To: btf-bugs@boyd.com
Cc: btf@boyd.com
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Thu, 16 Aug 2001 10:12:08 -0500

>If, for CPP, 'linenum' and "filename" were enough, why does Verilog need >'level' as well ?
> What does it add ? Why can't it just be a comment ?

CPP had the parameter and so we deferred to their wisdom.
Today this information is a comment. People that write source to
source translators (glorified preprocessors) can now identify the
actual source of a line of code, rather than having to accept the
location of the generated file.

E.g. run cpp on some of the C include files and look at the output,
you can see what file a given line is from.

> And a preprocessor may not know, for example, whether a file is included > or not.

If they don't know, CPP doesn't include a value. We translated that
'no value' to the constant 0.


> But if the LRM says it can be a full or relative path name, that seems to >imply that it has real meaning.

We wrote it that way because that is conceptually what should be there.
If we simply put, "any string value can be put there..." then nobody
would know really what this is used for.


Adam

From: Dennis Marsa <drm@xilinx.com>
To: btf-bugs@boyd.com
Cc: btf@boyd.com
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Thu, 16 Aug 2001 09:52:10 -0600

Shalom Bresticker wrote:

> > Since this directive was envisioned to be used by a
> > source code generator (preprocessor, source to source translator, etc.)
> > the requirement of the parameters was not considered a hardcase. You are
> > correct, it is not controlling anything; nor would you want it to.
>
> Again, it looks to me to be a confusion between a compiler DIRECTIVE,
> which TELLS the compiler to DO something, on the one hand,
> and an informative preprocessor output on the other.

But it is a directive. A tool must update its current file/linenumber
state upon seeing a `line directive with the info it provides.

> If, for CPP, 'linenum' and "filename" were enough, why does Verilog need 'level' as well ?
> What does it add ? Why can't it just be a comment ?

It would seem to me, one application of the level information would be
to keep track of all currently active source files on a stack, so that when
you issue a message you could provide a trail of include files:

Error: You messed up! at file: XXX line: YYY
included from file: XXX line: YYY
included from file: XXX line: YYY
...

The level number would guide you whether to push/pop or leave your stack alone.

Dennis

From: Shalom Bresticker <shalom@msil.sps.mot.com>
To: btf-bugs@boyd.com
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Fri, 17 Aug 2001 11:55:17 +0300 (IDT)

On Thu, 16 Aug 2001, Adam Krolnik wrote:

> >If, for CPP, 'linenum' and "filename" were enough, why does Verilog need >'level' as well ?
> > What does it add ? Why can't it just be a comment ?
>
> CPP had the parameter and so we deferred to their wisdom.
> Today this information is a comment. People that write source to
> source translators (glorified preprocessors) can now identify the
> actual source of a line of code, rather than having to accept the
> location of the generated file.
>
> E.g. run cpp on some of the C include files and look at the output,
> you can see what file a given line is from.

So if you are deferring to CPP's wisdom, why change preprocessor outputs into
preprocessor inputs ? In CPP, #line has no level parameter and filename is
optional.

>
> > And a preprocessor may not know, for example, whether a file is included > or not.
>
> If they don't know, CPP doesn't include a value. We translated that
> 'no value' to the constant 0.
>
>
> > But if the LRM says it can be a full or relative path name, that seems to >imply that it has real meaning.
>
> We wrote it that way because that is conceptually what should be there.
> If we simply put, "any string value can be put there..." then nobody
> would know really what this is used for.

Why ? Look at the Gnu CPP description. It says that filename is used for the
compiler reports, but it can be any string constant. That's in short, look at
the exact description. I don't have it with me at the moment.

Shalom


From: Shalom Bresticker <shalom@msil.sps.mot.com>
To: btf-bugs@boyd.com
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Fri, 17 Aug 2001 12:05:05 +0300 (IDT)

On Thu, 16 Aug 2001, Dennis Marsa wrote:

> > > Since this directive was envisioned to be used by a
> > > source code generator (preprocessor, source to source translator, etc.)
> > > the requirement of the parameters was not considered a hardcase. You are
> > > correct, it is not controlling anything; nor would you want it to.
> >
> > Again, it looks to me to be a confusion between a compiler DIRECTIVE,
> > which TELLS the compiler to DO something, on the one hand,
> > and an informative preprocessor output on the other.
>
> But it is a directive. A tool must update its current file/linenumber
> state upon seeing a `line directive with the info it provides.

I was referring to 'level'.


>
> > If, for CPP, 'linenum' and "filename" were enough, why does Verilog need 'level' as well ?
> > What does it add ? Why can't it just be a comment ?
>
> It would seem to me, one application of the level information would be
> to keep track of all currently active source files on a stack, so that when
> you issue a message you could provide a trail of include files:
>
> Error: You messed up! at file: XXX line: YYY
> included from file: XXX line: YYY
> included from file: XXX line: YYY
> ...
>
> The level number would guide you whether to push/pop or leave your stack alone.

So that's fine as a preprocessor output, not a preprocessor input.


From: Stuart Sutherland <stuart@sutherland-hdl.com>
To: btf-bugs@boyd.com
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is
unclear
Date: Fri, 17 Aug 2001 03:11:34 -0700

I guess I'll add my $0.02 to this topic. It seems to me that we are
carrying the comparison between Verilog and C too far on this. C doesn't
have simulation data structures with complex hierarchy and multiple
instances of the same module. C doesn't have a PLI, either.

`line is not an INPUT to a preprocessor; it is an OUTPUT of a preprocessor
and an INPUT to Verilog tools such as simulation. The engineer writing
Verilog models should never have a need to type in the `line
directive. The engineer writes regular Verilog code. A preprocessor
modifies the code in some way, and adds the `line directives to indicate
original source information. The Verilog simulator could care less what
values are in the `line directives, but it does store the information in
its data structure. Why? because the PLI can access the information, and
use it to relate simulation objects back to original source file. It goes
beyond having more intelligent error messages. Applications such as source
code debuggers and code coverage need to closely link original file
locations with specific simulation data structure objects. Without `line,
the only information available to the PLI would be file and line
information from the results of the preprocessor instead of the original
source information.

Sure, the file is a string that could hold anything, whether sensible or
not. Whatever is in the string, the PLI can access and print out. It
doesn't matter to the PLI or any other tool printing the string whether or
not the string is meaningful. If an engineer were typing in the `line
directive, I would expect some stupid strings to be created. But, a
preprocessor is creating the `line directive. I have great confidence that
whoever wrote the preprocessor is smart enough to use the string
intelligently. Same thing for the level value. It's not an input to a
preprocessor, it's an output. I'm confident a preprocessor will put
something sensible in the field.

Just my thoughts...

Stu


At 02:10 AM 8/17/2001, Shalom Bresticker wrote:
>Precedence: bulk
>
>The following reply was made to PR errata/16; it has been noted by GNATS.
>
>From: Shalom Bresticker <shalom@msil.sps.mot.com>
>To: btf-bugs@boyd.com
>Cc:
>Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
>Date: Fri, 17 Aug 2001 12:05:05 +0300 (IDT)
>
> On Thu, 16 Aug 2001, Dennis Marsa wrote:
>
> > > > Since this directive was envisioned to be used by a
> > > > source code generator (preprocessor, source to source translator,
> etc.)
> > > > the requirement of the parameters was not considered a hardcase.
> You are
> > > > correct, it is not controlling anything; nor would you want it to.
> > >
> > > Again, it looks to me to be a confusion between a compiler DIRECTIVE,
> > > which TELLS the compiler to DO something, on the one hand,
> > > and an informative preprocessor output on the other.
> >
> > But it is a directive. A tool must update its current file/linenumber
> > state upon seeing a `line directive with the info it provides.
>
> I was referring to 'level'.
>
>
> >
> > > If, for CPP, 'linenum' and "filename" were enough, why does Verilog
> need 'level' as well ?
> > > What does it add ? Why can't it just be a comment ?
> >
> > It would seem to me, one application of the level information would be
> > to keep track of all currently active source files on a stack, so that
> when
> > you issue a message you could provide a trail of include files:
> >
> > Error: You messed up! at file: XXX line: YYY
> > included from file: XXX line: YYY
> > included from file: XXX line: YYY
> > ...
> >
> > The level number would guide you whether to push/pop or leave your
> stack alone.
>
> So that's fine as a preprocessor output, not a preprocessor input.
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stuart Sutherland Sutherland HDL Inc.
stuart@sutherland-hdl.com 22805 SW 92nd Place
phone: 503-692-0898 Tualatin, OR 97062
www.sutherland-hdl.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


From: Adam Krolnik <krolnik@lsil.com>
To: btf-bugs@boyd.com, btf@boyd.com
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Tue, 21 Aug 2001 10:40:49 -0500




Shalom is proposing an erratta for the 'level' parameter of the
`line directive. This definition also includes a functionality change.

Was:

The level parameter indicates whether an include file has been entered
(value is 1), an include file has been exited (value is 2) or neither
has been done (value is 0).


Proposed:

The level parameter indicates when we are starting a new file (value is
1),
which also includes starting an include file, returning to a file (value
is 2), after having included another file, or the value 0 if neither of
the
other conditions has occurred.


This is based on the GNU CPP definitions as thus:

'0' This indicates none of the following are occurring (the file was not
changed.)
`1' This indicates the start of a new file.
`2' This indicates returning to a file (after having included another
file).

There is a functionality change with regard to the level parameter
having the value 1. This now means that any time a new file is being
read, the value is to be 1. This is in contrast to the previous
definition only requiring the value 1 when an include file is being
started.

Second note: I have read the GNU CPP source code in an attempt to
determine if they use level=1 when actually starting new files, vs.
just for include files. It appears that they only use level=1 when
starting an include file, and when reading a precompiled include file.
I guess a precompiled file is somewhat equivalent to starting another
file - C compilers process 1 file at a time in contrast to verilog
compilers that read multiple files (and keep the preprocessor state
active across files) at once.

Yet I see no reason that one should be required to indicate the
start of a new file (with a special flag) other than to say I want
you to save the current file information and start another.

Comments?

Adam Krolnik
Verification Mgr.
LSI Logic Corp.
Plano TX. 75074

From: "Brad Pierce" <Brad.Pierce@synopsys.com>
To: <etf-bugs@boyd.com>
Cc:
Subject: Re: errata/16: Section 19.7: `line - meaning of level parameter is unclear
Date: Fri, 13 Dec 2002 10:43:41 -0800

I still don't see why Verilog needs a level field in its `line directive,
even though CPP doesn't need one in its #line directive. I'm inclined
to vote against the proposal on the grounds that the level field should
be eliminated instead.

-- Brad








From: Steven Sharp <sharp@cadence.com>
To: etf-bugs@boyd.com, Brad.Pierce@synopsys.com
Cc:
Subject: Re: errata/16: Section 19.7: `line - meaning of level parameter is unclear
Date: Fri, 13 Dec 2002 16:06:37 -0500 (EST)

> I still don't see why Verilog needs a level field in its `line directive,
> even though CPP doesn't need one in its #line directive. I'm inclined
> to vote against the proposal on the grounds that the level field should
> be eliminated instead.

I'm not clear on the need myself. However, it does appear that it came
from some versions of CPP. See discussion in

http://boydtechinc.com/btf/archive/btf_1999/0439.html

and related items in the archive.

Steven Sharp
sharp@cadence.com


From: "Brad Pierce" <Brad.Pierce@synopsys.com>
To: <etf-bugs@boyd.com>
Cc:
Subject: Re: errata/16: Section 19.7: `line - meaning of level parameter is unclear
Date: Fri, 13 Dec 2002 13:15:11 -0800

Steven,

Even in the page for which you sent the link there
are no levels in #line.

Yes, there are levels in line number directives,
such as

#524 original.h 1

but there are no levels in #line directives.

-- Brad



From: Shalom.Bresticker@motorola.com
To: etf-bugs@boyd.com
Cc:
Subject: Re: errata/16: Section 19.7: `line - meaning of level parameter is
unclear
Date: Sat, 14 Dec 2002 19:54:53 +0200 (IST)

What is clear is that the proposal is not ready for voting.

I submitted the original issue.
The proposal was submitted without my agreement and is not supported by me.

What is needed is to summarize the issue clearly and succintly,
including all the major claims and arguments and all the proposals,
complete and incomplete, made on the issue.

Shalom



From: Shalom.Bresticker@motorola.com
To: etf-bugs@boyd.com
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Fri, 25 Apr 2003 13:01:59 +0300 (IDT)

The following was the original complaint:

> In 19.7 (`line): "The level parameter indicates whether an
> include file has been entered (value is 1), an include file
> is existed (value is 2), or neither has been done(value is 0)."
>
> This sentence is incomprehensible to me.
>
> At the very least, an example or examples must be added.

A long discussion followed.

I have reviewed all the discussion and most of the original correspondence which
led to its addition to 1364-2001 (It was Enhancement B29, see BTF archives from
Jan,Apr,Jul 1999).

I will try to summarize here what I have learned and concluded, and propose
a resolution which only minimally affects the standard.

Read section 19.7 of the LRM before the following.

The form of `line is:

`line number "filename" level

'line was derived from the combination of a similar CPP input directive and CPP
output linemarkers. If that sounds confusing, that's because it is.

The SunOs 5.7 CPP man page says,

"Output consists of a copy of the input file, with modifications, plus lines of
the form:

#lineno "filename" "level"

indicating the original source line number and filename of the following output
line and whether this is the first such line after an include file has been
entered (level=1), the first such line after an include file has been exited
(level=2), or any other such line (level is empty)."

Note that lineno is the actual line number, not the literal string "lineno".

So `line is basically copying this CPP output, with minor variations.

What you also have to know to complete the picture, but confuse you completely,
is that there is also a CPP INPUT directive,

#line lineno "filename"

where "filename" is optional. No additional tokens are permitted on the
directive line after the #line directive.

(1) The intent of `line is to represent the OUTPUT of a Verilog
pre-processor/source-to-source/verilog-to-verilog translator,
such as a code coverage tool which instruments the input files,
both to deal with include files and to deal with lines added or deleted by the
translator, causing the line numbering of the output files to differ from those
of the input files.

It is assumed that the translator is intelligent and bug-free, and does not
insert nonsense into the `line directives.

'line is NOT intended to be a compiler directive manually inserted by the user.

This was not clear from 19.7 as currently worded. A sentence needs to be added
to that effect.

Note that the use of the directive is optional.


(2) All the arguments of the directive are required. This simplifies parsing.
The directive may be spread over more than one line.

However, there is an ambiguity about what follows the directive.

The LRM says that the "number parameter is the new line number of the next
line." What happens if there is code text following the directive on the same
line?

In order to prevent that ambiguity, I propose that the LRM not allow any code,
except maybe a one-line comment, following the directive on the same line.

Note that this overlaps issue #90.


(3) Small editorial improvements: in 19.7, para. 1:

- Change "reset the current line number" to "set the current line number".
- Change "file; if" to "file if".
- Change "addition or reduction of lines" to "addition or deletion of lines".
- Change "For example error messages" to "For example, error messages".


(4) In para. 3, change
"The level parameter indicates whether an include file has been entered (value is 1),
an include file is existed (value is 2), or neither has been done (value is 0)."

TO:

"The level parameter indicates the following line is the first line after an include
file has been entered (level=1), the first line after an include file has been
exited (level=2), or any other such line (level=0)."


(5) The LRM says, "The filename can be a full or relative path name."
In point of fact, the filename parameter can be any string, even nonsense.
The Verilog compiler and PLI will not know the difference unless they try to
access the file. However, the LRM is trying to explain the intention.
Recommend no change.


(6) Add a couple of examples.

From: Shalom.Bresticker@motorola.com
To: etf-bugs@boyd.com
Cc:
Subject: Re: errata/16: 19.7 `line - meaning of level parameter is unclear
Date: Fri, 6 Feb 2004 11:39:35 +0200 (IST)

This is an attempt at a new proposal for this issue (and #291 also).
It is a rewrite of the entire section. Some of the proposed text comes from
the NCV LRM, assuming that no one minds.

In a following mail, I will present some questions/problems I still have.
The proposal or some variation of it could still be passed, leaving the
questions open as a new issue.


19.7 `line

It is important for Verilog tools to keep track of the filenames of the
Verilog source files and the line numbers in the files. This information
can be used for error messages or source code debugging, and can be
accessed by the Verilog PLI.

In many cases, however, the Verilog source is preprocessed by some other
tool, and the line and file information of the original source file can
be lost because the preprocessor might add additional lines to the source
code file, combine multiple source code lines into one line, concatenate
multiple source files, and so on.

The `line compiler directive can be used to specify the original source
code line number and filename. This allows the location in an original
file to be maintained if another process modifies the source. After the
new line number and filename are specified, the compiler can correctly
refer to the original source location. However, no tool is required to
produce `line directives. These directives are not intended to be inserted
manually into the code although they can be.

The compiler shall maintain the current line number and filename
of the file being compiled. The `line directive shall set the current line
number and filename to those specified in the directive. The syntax for the
`line directive is given in Syntax 19-7.

line_compiler_directive ::=
`line number "filename" level

Syntax 19-7 Syntax for `line compiler directive

The directive can be specified anywhere within the Verilog HDL source
description. The number parameter shall be a positive integer that specifies
the new line number of the following text line. The filename parameter shall
be a string constant that is treated as the new name of the file. The filename
can also be a full or relative path name. The level parameter shall be 0, 1,
or 2. The value 1 indicates that the following line is the first line after
an include file has been entered. The value 2 indicates that the following line
is the first line after an include file has been exited. The value 0 indicates
any other line. All parameters in the `line directive are required.

Example:
`line 3 "orig.v" 2 // Next line is line 3 of orig.v after exiting include file

The results of this file are not affected by the `resetall directive. As the
compiler processes the remainder of the file and new files, the line shall be
incremented as each line is read and the name shall be updated to the new
current file being processed. The line number shall be reset to 1 at the
beginning of each file. When beginning to read include files, the current line
and filename shall be stored for restoration at the termination of the include
file. The updated line number and filename information shall be available for
PLI access. The mechanism of library searching is not affected by the effects
of the `line compiler directive.


On Sun, 12 Aug 2001 Shalom.Bresticker@motorola.com wrote:

> In 19.7 (`line): "The level parameter indicates whether an
> include file has been entered (value is 1), an include file
> is existed (value is), or neither has been done(value is 0)."
>
> This sentence is incomprehensible to me.
>
> At the very least, an example or examples must be added.

--
Shalom Bresticker Shalom.Bresticker@motorola.com
Design, Verification & Reuse Methodology Tel: +972 9 9522268
Motorola Semiconductor Israel, Ltd. Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL Cell: +972 50 441478



Fix replaced by Shalom.Bresticker@motorola.com on Mon Feb 9 04:41:18 2004
I have slightly modified the proposal I sent a few days ago.
The proposal includes issue #291 as well.

START PROPOSAL

REWRITE 19.7 as follows:

19.7 `line

It is important for Verilog tools to keep track of the filenames of the
Verilog source files and the line numbers in the files. This information
can be used for error messages or source code debugging, and can be
accessed by the Verilog PLI.

In many cases, however, the Verilog source is preprocessed by some other
tool, and the line and file information of the original source file can
be lost because the preprocessor might add additional lines to the source
code file, combine multiple source code lines into one line, concatenate
multiple source files, and so on.

The `line compiler directive can be used to specify the original source
code line number and filename. This allows the location in the original
file to be maintained if another process modifies the source. After the
new line number and filename are specified, the compiler can correctly
refer to the original source location. However, a tool is not required to
produce `line directives. These directives are not intended to be inserted
manually into the code, although they can be.

The compiler shall maintain the current line number and filename
of the file being compiled. The `line directive shall set the current line
number and filename to those specified in the directive.
The directive can be specified anywhere within the Verilog HDL source
description. All parameters in the `line directive are required.
The results of this file are not affected by the `resetall directive.

The syntax for the `line directive is given in Syntax 19-7.

line_compiler_directive ::=
`line number "filename" level

Syntax 19-7 Syntax for `line compiler directive

The number parameter shall be a positive integer that specifies
the new line number of the following text line. The filename parameter shall
be a string constant that is treated as the new name of the file. The filename
can also be a full or relative path name. The level parameter shall be 0, 1,
or 2. The value 1 indicates that the following line is the first line after
an include file has been entered. The value 2 indicates that the following line
is the first line after an include file has been exited. The value 0 indicates
any other line.

Example:
`line 3 "orig.v" 2 // Next line is line 3 of orig.v after exiting include file

As the
compiler processes the remainder of the file and new files, the line shall be
incremented as each line is read and the name shall be updated to the new
current file being processed. The line number shall be reset to 1 at the
beginning of each file. When beginning to read include files, the current line
and filename shall be stored for restoration at the termination of the include
file. The updated line number and filename information shall be available for
PLI access. The mechanism of library searching is not affected by the effects
of the `line compiler directive.

END PROPOSAL


Questions:

- Can `line be followed by more code text (besides a comment)
on the same line? What happens then? I propose to require
`line to appear on a separate line, which may not be preceded
by anything and followed on the same line only by a comment.

- What happens if a level 2 appears without a preceding level 1?
I propose not to deal with that (i.e., leave it unspecified).
There is no end to the nonsense which someone can do if he
really tries.


Fix replaced by pieper@synopsys.com on Mon May 3 09:32:07 2004
I have slightly modified the proposal I sent a few days ago.
The proposal includes issue #291 as well.

START PROPOSAL

REWRITE 19.7 as follows:

19.7 `line

It is important for Verilog tools to keep track of the filenames of the
Verilog source files and the line numbers in the files. This information
can be used for error messages or source code debugging, and can be
accessed by the Verilog PLI.

In many cases, however, the Verilog source is preprocessed by some other
tool, and the line and file information of the original source file can
be lost because the preprocessor might add additional lines to the source
code file, combine multiple source code lines into one line, concatenate
multiple source files, and so on.

The `line compiler directive can be used to specify the original source
code line number and filename. This allows the location in the original
file to be maintained if another process modifies the source. After the
new line number and filename are specified, the compiler can correctly
refer to the original source location. However, a tool is not required to
produce `line directives. These directives are not intended to be inserted
manually into the code, although they can be.

The compiler shall maintain the current line number and filename
of the file being compiled. The `line directive shall set the current line
number and filename to those specified in the directive.
The directive can be specified anywhere within the Verilog HDL source
description. All parameters in the `line directive are required.
The results of this file are not affected by the `resetall directive.

The syntax for the `line directive is given in Syntax 19-7.

line_compiler_directive ::=
`line number "filename" level

Syntax 19-7 Syntax for `line compiler directive

The number parameter shall be a positive integer that specifies
the new line number of the following text line. The filename parameter shall
be a string constant that is treated as the new name of the file. The filename
can also be a full or relative path name. The level parameter shall be 0, 1,
or 2. The value 1 indicates that the following line is the first line after
an include file has been entered. The value 2 indicates that the following line
is the first line after an include file has been exited. The value 0 indicates
any other line.

Example:
`line 3 "orig.v" 2 // Next line is line 3 of orig.v after exiting include file

As the
compiler processes the remainder of the file and new files, the line number shall be
incremented as each line is read and the name shall be updated to the new
current file being processed. The line number shall be reset to 1 at the
beginning of each file. When beginning to read include files, the current line
and filename shall be stored for restoration at the termination of the include
file. The updated line number and filename information shall be available for
PLI access. The mechanism of library searching is not affected by the effects
of the `line compiler directive.

END PROPOSAL


Questions:

- Can `line be followed by more code text (besides a comment)
on the same line? What happens then? I propose to require
`line to appear on a separate line, which may not be preceded
by anything and followed on the same line only by a comment.

- What happens if a level 2 appears without a preceding level 1?
I propose not to deal with that (i.e., leave it unspecified).
There is no end to the nonsense which someone can do if he
really tries.



Fix replaced by Shalom.Bresticker@motorola.com on Tue May 4 07:23:44 2004

REWRITE 19.7 as follows:

19.7 `line

It is important for Verilog tools to keep track of the filenames of the
Verilog source files and the line numbers in the files. This information
can be used for error messages or source code debugging, and can be
accessed by the Verilog PLI.

In many cases, however, the Verilog source is preprocessed by some other
tool, and the line and file information of the original source file can
be lost because the preprocessor might add additional lines to the source
code file, combine multiple source code lines into one line, concatenate
multiple source files, and so on.

The `line compiler directive can be used to specify the original source
code line number and filename. This allows the location in the original
file to be maintained if another process modifies the source. After the
new line number and filename are specified, the compiler can correctly
refer to the original source location. However, a tool is not required to
produce `line directives. These directives are not intended to be inserted
manually into the code, although they can be.

The compiler shall maintain the current line number and filename
of the file being compiled. The `line directive shall set the current line
number and filename to those specified in the directive.
The directive can be specified anywhere within the Verilog HDL source
description. However, only white space may appear on the
same line as the `line directive.
All parameters in the `line directive are required.
The results of this file are not affected by the `resetall directive.

The syntax for the `line directive is given in Syntax 19-7.

line_compiler_directive ::=
`line number "filename" level

Syntax 19-7 Syntax for `line compiler directive

The number parameter shall be a positive integer that specifies
the new line number of the following text line. The filename parameter shall
be a string constant that is treated as the new name of the file. The filename
can also be a full or relative path name. The level parameter shall be 0, 1,
or 2. The value 1 indicates that the following line is the first line after
an include file has been entered. The value 2 indicates that the following line
is the first line after an include file has been exited. The value 0 indicates
any other line.

Example:
`line 3 "orig.v" 2 // Next line is line 3 of orig.v after exiting include file

As the compiler processes the remainder of the file and new
files, the line number shall be incremented as each line is
read and the name shall be updated to the new current file
being processed. The line number shall be reset to 1 at the
beginning of each file. When beginning to read include files, the current line
and filename shall be stored for restoration at the termination of the include
file. The updated line number and filename information shall be available for
PLI access. The mechanism of library searching is not affected by the effects
of the `line compiler directive.


From: "James A. Markevitch" <jam@magic.com>
To: etf-bugs@boyd.com
Cc: Shalom.Bresticker@motorola.com
Subject: Re: errata/16: PROPOSAL - 19.7: `line - meaning of level parameter is unclear
Date: Tue, 4 May 2004 08:13:05 -0700 (PDT)

> REWRITE 19.7 as follows:
>
> 19.7 `line
>
> It is important for Verilog tools to keep track of the filenames of the
> Verilog source files and the line numbers in the files. This information
> can be used for error messages or source code debugging, and can be
> accessed by the Verilog PLI.
>
> In many cases, however, the Verilog source is preprocessed by some other
> tool, and the line and file information of the original source file can
> be lost because the preprocessor might add additional lines to the source
> code file, combine multiple source code lines into one line, concatenate
> multiple source files, and so on.

If a goal is to handle the case where lines are combined, then it might
be useful to have the `line directive take effect immediately (not on
the next line) and to allow it to be embedded anywhere within a line.
Thus,

always @(posedge clk) `line 4 "file" 0 begin a <= 1'b1; end

would support the case where the "begin" block was part of concatenated
lines.

Not sure whether I would support this or not, since it is counter to
what is done in preprocessors, such as C, but it is completely general
and doesn't require any "wierd" scanner behavior that was the source of
concern yesterday.

This would also probably be a change from de facto behavior today where
the `line applies to the next line.

> The `line compiler directive can be used to specify the original source
> code line number and filename. This allows the location in the original
> file to be maintained if another process modifies the source. After the
> new line number and filename are specified, the compiler can correctly
> refer to the original source location. However, a tool is not required to
> produce `line directives. These directives are not intended to be inserted
> manually into the code, although they can be.
>
> The compiler shall maintain the current line number and filename
> of the file being compiled. The `line directive shall set the current line
> number and filename to those specified in the directive.

Suggest adding a clarifying sentence, such as "The new line number and
filename apply on the next line in the source."

> The directive can be specified anywhere within the Verilog HDL source
> description. However, only white space may appear on the
> same line as the `line directive.
> All parameters in the `line directive are required.
> The results of this file are not affected by the `resetall directive.

Should this read "The results of this directive ..."?

>
> The syntax for the `line directive is given in Syntax 19-7.
>
> line_compiler_directive ::=
> `line number "filename" level
>
> Syntax 19-7 Syntax for `line compiler directive
>
> The number parameter shall be a positive integer that specifies
> the new line number of the following text line. The filename parameter shall
> be a string constant that is treated as the new name of the file. The filename
> can also be a full or relative path name. The level parameter shall be 0, 1,
> or 2. The value 1 indicates that the following line is the first line after
> an include file has been entered. The value 2 indicates that the following line
> is the first line after an include file has been exited. The value 0 indicates
> any other line.
>
> Example:
> `line 3 "orig.v" 2 // Next line is line 3 of orig.v after exiting include file

The comment is no longer legal in the example.

> As the compiler processes the remainder of the file and new
> files, the line number shall be incremented as each line is
> read and the name shall be updated to the new current file
> being processed. The line number shall be reset to 1 at the
> beginning of each file. When beginning to read include files, the current line
> and filename shall be stored for restoration at the termination of the include
> file. The updated line number and filename information shall be available for
> PLI access. The mechanism of library searching is not affected by the effects
> of the `line compiler directive.
>
> http://boydtechinc.com/cgi-bin/issueproposal.pl?cmd=view&database=default&pr=16

James Markevitch

From: Shalom.Bresticker@freescale.com
To: "James A. Markevitch" <jam@magic.com>
Cc: etf-bugs@boyd.com
Subject: Re: errata/16: PROPOSAL - 19.7: `line - meaning of level parameter
is unclear
Date: Wed, 5 May 2004 12:02:00 +0300 (IDT)

James,

> > The compiler shall maintain the current line number and filename
> > of the file being compiled. The `line directive shall set the current line
> > number and filename to those specified in the directive.
>
> Suggest adding a clarifying sentence, such as "The new line number and
> filename apply on the next line in the source."

Later on, the proposal says,
"The number parameter ... specifies the new line number of the following text line."

So we could change this introductory text to

"The `line directive shall set the line number and filename of the following line to
those specified in the directive."


> > The directive can be specified anywhere within the Verilog HDL source
> > description. However, only white space may appear on the
> > same line as the `line directive.
> > All parameters in the `line directive are required.
> > The results of this file are not affected by the `resetall directive.
>
> Should this read "The results of this directive ..."?

Yes, typo, thanks.


> > Example:
> > `line 3 "orig.v" 2 // Next line is line 3 of orig.v after exiting include file
>
> The comment is no longer legal in the example.

Also correct, thanks.

I'd also like to remind that this proposal covers issue #291 as well.

Shalom


Fix replaced by Shalom.Bresticker@freescale.com on Thu May 6 03:44:00 2004
REWRITE 19.7 as follows:

"19.7 `line

It is important for Verilog tools to keep track of the filenames of the
Verilog source files and the line numbers in the files. This information
can be used for error messages or source code debugging, and can be
accessed by the Verilog PLI.

In many cases, however, the Verilog source is preprocessed by some other
tool, and the line and file information of the original source file can
be lost because the preprocessor might add additional lines to the source
code file, combine multiple source code lines into one line, concatenate
multiple source files, and so on.

The `line compiler directive can be used to specify the original source
code line number and filename. This allows the location in the original
file to be maintained if another process modifies the source. After the
new line number and filename are specified, the compiler can correctly
refer to the original source location. However, a tool is not required to
produce `line directives. These directives are not intended to be inserted
manually into the code, although they can be.

The compiler shall maintain the current line number and filename
of the file being compiled. The `line directive shall set
the line number and filename of the following line to those
specified in the directive.
The directive can be specified anywhere within the Verilog HDL source
description. However, only white space may appear on the
same line as the `line directive.
All parameters in the `line directive are required. The
results of this directive are not affected by the `resetall
directive.

The syntax for the `line directive is given in Syntax 19-7.

line_compiler_directive ::=
`line number "filename" level

Syntax 19-7 Syntax for `line compiler directive

The number parameter shall be a positive integer that specifies
the new line number of the following text line. The filename parameter shall
be a string constant that is treated as the new name of the file. The filename
can also be a full or relative path name. The level parameter shall be 0, 1,
or 2. The value 1 indicates that the following line is the first line after
an include file has been entered. The value 2 indicates that the following line
is the first line after an include file has been exited. The value 0 indicates
any other line.

Example:
`line 3 "orig.v" 2
// This line is line 3 of orig.v after exiting include file

As the compiler processes the remainder of the file and new
files, the line number shall be incremented as each line is
read and the name shall be updated to the new current file
being processed. The line number shall be reset to 1 at the
beginning of each file. When beginning to read include files, the current line
and filename shall be stored for restoration at the termination of the include
file. The updated line number and filename information shall be available for
PLI access. The mechanism of library searching is not affected by the effects
of the `line compiler directive."


Also CLOSE errata/291 as superceded by the fix to errata/16.



Fix replaced by stefen@boyd.com on Thu Jul 8 11:45:12 2004
REWRITE 19.7 as follows:

"19.7 `line

It is important for Verilog tools to keep track of the filenames of the
Verilog source files and the line numbers in the files. This information
can be used for error messages or source code debugging, and can be
accessed by the Verilog PLI.

In many cases, however, the Verilog source is preprocessed by some other
tool, and the line and file information of the original source file can
be lost because the preprocessor might add additional lines to the source
code file, combine multiple source code lines into one line, concatenate
multiple source files, and so on.

The `line compiler directive can be used to specify the original source
code line number and filename. This allows the location in the original
file to be maintained if another process modifies the source. After the
new line number and filename are specified, the compiler can correctly
refer to the original source location. However, a tool is not required to
produce `line directives. These directives are not intended to be inserted
manually into the code, although they can be.

The compiler shall maintain the current line number and filename
of the file being compiled. The `line directive shall set
the line number and filename of the following line to those
specified in the directive.
The directive can be specified anywhere within the Verilog HDL source
description. However, only white space may appear on the
same line as the `line directive. Comments are not allowed
on the same line as a 'line directive.
All parameters in the `line directive are required. The
results of this directive are not affected by the `resetall
directive.

The syntax for the `line directive is given in Syntax 19-7.

line_compiler_directive ::=
`line number "filename" level

Syntax 19-7 Syntax for `line compiler directive

The number parameter shall be a positive integer that specifies
the new line number of the following text line. The filename parameter shall
be a string constant that is treated as the new name of the file. The filename
can also be a full or relative path name. The level parameter shall be 0, 1,
or 2. The value 1 indicates that the following line is the first line after
an include file has been entered. The value 2 indicates that the following line
is the first line after an include file has been exited. The value 0 indicates
any other line.

Example:
`line 3 "orig.v" 2
// This line is line 3 of orig.v after exiting include file

As the compiler processes the remainder of the file and new
files, the line number shall be incremented as each line is
read and the name shall be updated to the new current file
being processed. The line number shall be reset to 1 at the
beginning of each file. When beginning to read include files, the current line
and filename shall be stored for restoration at the termination of the include
file. The updated line number and filename information shall be available for
PLI access. The mechanism of library searching is not affected by the effects
of the `line compiler directive."


Also CLOSE errata/291 as superceded by the fix to errata/16.


Unformatted


Hosted by Boyd Technology