Guest
I had assumed Verilog would collapse constants, but I wonder if that
is
always trued/allowed?
If I have something like
reg [7:0] sig1, sig2, sig3;
always @ *
sig3 = 1 + 2 + 3 + sig1 + sig2 + 4;
There must be at least 2 adders. Is Verilog required to produce 3
adders?
The code can easily be collapsed to
sig3 = 6 + sig1 + sig2 + 4;
Verilog evaluates left to right, so this becomes
sig3 = ( (6 + sig1) + sig2) + 4;
This requires 3 adders. Is it legal for Verilog to compile the
original code to:
sig3 = 10 + sig1 + sig2;
Thoughts?
Thanks!
John Providenza
is
always trued/allowed?
If I have something like
reg [7:0] sig1, sig2, sig3;
always @ *
sig3 = 1 + 2 + 3 + sig1 + sig2 + 4;
There must be at least 2 adders. Is Verilog required to produce 3
adders?
The code can easily be collapsed to
sig3 = 6 + sig1 + sig2 + 4;
Verilog evaluates left to right, so this becomes
sig3 = ( (6 + sig1) + sig2) + 4;
This requires 3 adders. Is it legal for Verilog to compile the
original code to:
sig3 = 10 + sig1 + sig2;
Thoughts?
Thanks!
John Providenza