What should be the behavior of the following test case

P

parag

Guest
parameter integer p[0:5] = '{0,1,2,3,4,5};
parameter int var3[] = int'(p);
//parameter integer var3[6] = p;
endmodule


What should be the behavior of the above test case
 
On May 25, 1:02 am, parag <parag.p...@gmail.com> wrote:
= '{0,1,2,3,4,5};
parameter int var3[] = int'(p);
//parameter integer var3[6] = p;
endmodule

What should be the behavior of the above test case
I think static casting (int' expression) tries to cast static array of
6 integers to one int and then assign it to var3[] dynamic array.
It is complicated to predict expected behavior - probably compilation
error.

Direct array assignment in this case in invalid because two arrays
must be of compatible types.

Alex
 
On Sun, 24 May 2009 15:02:55 -0700 (PDT), parag wrote:

= '{0,1,2,3,4,5};
parameter int var3[] = int'(p);
//parameter integer var3[6] = p;

What should be the behavior of the above test case
It's illegal.

The declaration of p[] is fine.

The cast
int'(p)
is an illegal bit-stream cast, because the source
expression (p) has 128 bits but the target type (int)
has only 32 bits.

So, let's rewrite the parameter declaration so that
the cast becomes legal:

parameter logic [7:0] p[0:3] = '{0,1,2,3}; // 32 bits
parameter int var3[] = int'(p);

The result of int'(p) is now the int value 32'h00010203.
But it is illegal to try to copy that into a dynamic array.

What's the real problem you're trying to solve?
--
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.
 

Welcome to EDABoard.com

Sponsor

Back
Top