the correct behavior 
Author Message
 the correct behavior

Hi,

I would like to seek opinions on what's the correct behavior for the
following testcase should be.

Thanks in advance!!!

module test;
  parameter str = " foo = %h, bar = %d.";
  integer foo, bar;
    initial begin
        foo = 15;
        bar = 15;
        $display(str,foo,bar);
    end
endmodule

Should the parameter be used as the format string ?
In other words, the output is :
 foo = 0000000f, bar =          15.

Or the output should be:

 184972087954546819921721516028280971959766180910         15         15

Thanks.



Fri, 14 Jan 2000 03:00:00 GMT  
 the correct behavior

Well Thats a good one.  I'd vote for the latter since
  a) The $display expects a string, not something that can evaluate as a
string for the optional format specifier string.
  b) A string parameter is not realy a string but a log set of bits.

The type conversion of the paramter (or any vector) to a string is
context dependant, I would say that a string is ony a string when used
with string operators.  The $display will assmue its a vector not a
string.

-- James

Quote:

> Hi,

> I would like to seek opinions on what's the correct behavior for the
> following testcase should be.

> Thanks in advance!!!

> module test;
>   parameter str = " foo = %h, bar = %d.";
>   integer foo, bar;
>     initial begin
>         foo = 15;
>         bar = 15;
>         $display(str,foo,bar);
>     end
> endmodule

> Should the parameter be used as the format string ?
> In other words, the output is :
>  foo = 0000000f, bar =          15.

> Or the output should be:

>  184972087954546819921721516028280971959766180910         15         15

> Thanks.

--
-.-. --.- -.-. --.- -.. . -. .---- -.. -.. -.- -..-. .-- -....

  Verilog Instructor        
  Author "Verilog Quickstart" ISBN 0-7923-9927-7
-.-. --.- -.-. --.- -.. . -. .---- -.. -.. -.- -..-. .-- -....


Sat, 15 Jan 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. correct behavior

2. Correct behavior for file-write-date?

3. Correct behavior for failure during __init__()

4. Correct behavior for failure during __init__()

5. Is this behavior correct?

6. correct Numeric behavior?

7. Tk4.0b: please correct the binding behavior

8. archive announcement, corrected

9. Do you prove your APL programs correct?

10. Correct way of invoking an object inside an ole object

11. Is this the correct group for 68000 assembly

12. Compuserve vs Internet 2nd (corrected) posting

 

 
Powered by phpBB® Forum Software