|
From: Martin W. <mai...@ma...> - 2015-02-03 21:23:52
|
Cary R. wrote:
> Okay, there are still a few other issues since nested replications do not
> correctly check for a zero replication at a lower level which was why I
> thought I may have to keep the zero width check. (e.g. {{2{{0{sign}}}},
> 16'h0001} should report that a zero width (zero replication) cannot be
> replicated. A zero replication is only allowed in a
> concatenation/replication if it is also included with another non-zero
> width element. There are likely other degenerate cases (e.g. {{0{sign}},
> {0{lsb}}}, etc.) that need to be checked and reported in the compiler.
>
> And then all this needs to be check for constant and non-constant values
> being replicated. Constant-constant is done in the compiler,
> constant-variable is done in the run time. Cary
Another case that bypasses the zero replication check is a concatenation
within a concatenation, e.g. {a, b & {0{c}}}.
I'd try fixing the compiler check by using the elab_expr flags to flag
whether we are elaborating a singleton concatenation (I can have a go at this
if you don't have time).
Trying some other things, I find Icarus accepts a zero width literal number
(which isn't legal Verilog). It then gives different results for {a, 0'b0, b}
and {a, {0'b0}, b}. The first case is sensible (collapses to {a, b}), the
second case is not.
Martin
|