for time more than 2^32 + , how do we show them in $display

  • Thread starter parag_paul@hotmail.com
  • Start date
P

parag_paul@hotmail.com

Guest
module top;
reg a;

initial
begin
#4294967297

$display($time,,a);
end
endmodule

I am seeing 1 x
which is 2^32 + 1,
-Parag
 
On Oct 11, 10:27 am, "parag_p...@hotmail.com" <parag_p...@hotmail.com>
wrote:
module top;
reg a;

initial
begin
#4294967297

$display($time,,a);
end
endmodule
I don't think you have a display problem. You have expressed your
delay with an "unsized" decimal literal, which actually has a fixed
implementation-dependent size, usually 32 bits. The value of your
literal does not fit into 32 bits (in fact, since decimal literals are
signed, it isn't even close to fitting). After it overflows, the
remainder is presumably 1. So this is acting as if you had written
#1. I am surprised that your tool did not inform you that your
literal value overflowed its width.

You can fix this by using a sized literal, such as 64'd4294967297.
 
On Thu, 11 Oct 2007 07:27:12 -0700, "parag_paul@hotmail.com"
<parag_paul@hotmail.com> wrote:

module top;
reg a;

initial
begin
#4294967297

$display($time,,a);
end
endmodule

I am seeing 1 x
which is 2^32 + 1,
-Parag
$display uses %d by default. Find out about %t
and $timeformat().
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
@sh
Yes did complain.
but now there must be ways to get across this.
Since $time is a call with prototype for 64 bit output. I also tried
on a 64 bit machine. Does not help. It must be the fixed size of the
literal.
 
<parag_paul@hotmail.com> wrote in message
news:1192112832.768516.12430@o3g2000hsb.googlegroups.com...
module top;
reg a;

initial
begin
#4294967297

$display($time,,a);
end
endmodule

I am seeing 1 x
which is 2^32 + 1,
-Parag
How about using "%t" formatting for the time variable?
 
On Thu, 11 Oct 2007 16:06:17 +0100,
Jonathan Bromley <jonathan.bromley@MYCOMPANY.com> wrote:

$display uses %d by default.
Whoops, brain fade. This is true, but of course the
result of $time is a 64-bit value which would $display() as
a 64-bit (22-digit??) decimal number.

Steven Sharp spotted the correct diagnosis, as usual.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
parag_paul@hotmail.com wrote:
Actually 64'd12112
does not work either
What problem are you seeing? Note that for a delay that is not a
simple unbased decimal literal, the delay expression must be enclosed
in parentheses.
 
What problem are you seeing? Note that for a delay that is not a
simple unbased decimal literal, the delay expression must be enclosed
in parentheses.
What is the meaning of unbased decimal literal.

The error message was.

Parsing design file 'p2.v'
Warning-[TMBIN] Too many bits in number with width
expected 32 bits, got more in number 113121423412342212123421
"p2.v", 5

So I guess you are correct about the unbased decimal thing , but can
you please explain what an unbased decimal is
 
On Oct 22, 5:39 am, "parag_p...@hotmail.com" <parag_p...@hotmail.com>
wrote:
What problem are you seeing? Note that for a delay that is not a
simple unbased decimal literal, the delay expression must be enclosed
in parentheses.

What is the meaning of unbased decimal literal.
A Verilog literal number consists of 3 parts: a bit-width, a base
specifier (e.g. 'd for decimal), and a value. If you leave off the
bit width, you get a so-called unsized literal, which will be treated
as 32 bits in most implementations. If you leave off the bit-width
and the base specifier, it will be treated as an unsized decimal
number, which will again be treated as 32 bits in most
implementations. You got a warning telling you that your number was
too big for 32 bits. You need to specify a size and base in your
literal. And when you do that, you will have to put parentheses
around the delay expression.
 

Welcome to EDABoard.com

Sponsor

Back
Top