RE: %s format question in $display

From: Michael McNamara (mac@verisity.com)
Date: Mon Feb 23 2004 - 18:57:03 PST

  • Next message: Michael McNamara: "RE: %s format question in $display"

    It is my personal view that the standard is clear on this, and that
    the customer should decide whether to insist that their vendor comply
    with the standard.

    Note that this forum (etf@boyd.com) does not pass judgement on the
    adhereance to the standard of any implementation.

    If you (or anyone else) would like to propose a change in the standard
    because you feel the standard is in error, this would be the place to
    send in your request. If your proposal is an enhancement, than
    btf@boyd.com would likely be the place.

    -mac

    -- On Feb 23 2004 at 15:15, Ryan, Ray sent a message:
    > To: etf@boyd.com
    > Subject: "%s format question in $display"
    >
    > We have received a customer question about differences between
    > the 1364 LRM and verilog simulators.
    >
    > The LRM seems to specify that leading 0's in a string should not
    > be printed (using %s in $display), however the major simulators
    > convert leading 0's to blanks and then print these blanks.
    >
    > Is there an errata on this? (I can't find one).
    >
    > Further info:
    >
    > The 1364 LRM, 2.6.2 String Manipulation, contains the following
    > example:
    >
    > module string_test;
    > reg [8*14:1] stringvar;
    > initial begin
    > stringvar = "Hello world";
    > $display("%s is stored as %h", stringvar,stringvar);
    > stringvar = {stringvar,"!!!"};
    > $display("%s is stored as %h", stringvar,stringvar);
    > end
    > endmodule
    >
    > For which the expected output is listed as:
    >
    > Hello world is stored as 00000048656c6c6f20776f726c64
    > Hello world!!! is stored as 48656c6c6f20776f726c64212121
    >
    > The leading 0's of 'stringvar' in the first call to
    > $display are NOT printed (also not convered to blanks).
    >
    > However, the simulation result seen is:
    > Hello world is stored as 00000048656c6c6f20776f726c64
    > Hello world!!! is stored as 48656c6c6f20776f726c64212121
    >
    >
    > Also in 17.1.1.7 String format, at the end of the section it
    > state:
    > "... No termination character or value is required at the end
    > of a string, and leading zeros are never printed."
    >
    >
    > Help in identifying the correct behavior would be appreciated.
    >
    > Thanks,
    > Ray Ryan



    This archive was generated by hypermail 2.1.4 : Mon Feb 23 2004 - 18:42:29 PST and
    sponsored by Boyd Technology, Inc.