Re: [sv-bc] A question about type casting

From: Greg Jaxon <Greg.Jaxon@synopsys.com>
Date: Wed Mar 17 2004 - 18:14:39 PST

And to the second part of Dan's question (regarding bit-stream casting):
it seems that "size" for the purposes of bitstreaming refers to the actual
number of bits. ($bits())

This means that the example Dan gave IS indeed an illegal cast, though
it would be a legal assignment.

Conversely there are legal casts that are illegal assignments, such as
this variation on Dan's example.

typedef logic [0:0] src_type [1:0];
typedef logic [1:0] trg_type [0:0];
src_type src;
trg_type trg;

always_comb trg = trg_type'(src); // legal cast !
always_comb trg = src; // illegal assignment.

The divergence from casting in C++ is jarring at first.
Reviewers did not flinch, however.

Greg Jaxon
Received on Wed Mar 17 18:18:41 2004

This archive was generated by hypermail 2.1.8 : Wed Mar 17 2004 - 18:19:03 PST