Newbie question on port size matching

V

vk

Guest
Hello,

In my design there is a IP core multiplier, which takes two 16 bit
signed integers. Output of multiplier is scaled back to 16 bits. To do
that we force IP core to trim its output to 17 bit. So among them
there will be 2 sign bits and 15 meaningful bits. One sign bit then
dropped. It looks like this:

wire [15:0] m1, m2; // multipliers
wire [15:0] p; // product
wire t; // useless bit

mpy_16_16_17 mpy( .clk(clk), .a(m1), .b(m2), .q({t,p}) );

Synthesis gives a warning that 't' has been assigned a value which is
not used later. I'd like to ask community advice, what is a preferable
practice to drop bit from output and avoid warning.

Perhaps that warning is safe to ignore. But my software experience
tells me that with warning number rise really important ones might be
overlooked. So I'm trying to keep the code as clean as possible.

Thanks in advance.
 
On Apr 20, 10:19 pm, vk <v.kazmire...@gmail.com> wrote:
Hello,

In my design there is a IP core multiplier, which takes two 16 bit
signed integers. Output of multiplier is scaled back to 16 bits. To do
that we force IP core to trim its output to 17 bit. So among them
there will be 2 sign bits and 15 meaningful bits. One sign bit then
dropped. It looks like this:

wire [15:0] m1, m2;  // multipliers
wire [15:0] p;           // product
wire           t;           // useless bit

mpy_16_16_17    mpy( .clk(clk), .a(m1), .b(m2), .q({t,p}) );

Synthesis gives a warning that 't' has been assigned a value which is
not used later. I'd like to ask community advice, what is a preferable
practice to drop bit from output and avoid warning.

Perhaps that warning is safe to ignore. But my software experience
tells me that with warning number rise really important ones might be
overlooked. So I'm trying to keep the code as clean as possible.

Thanks in advance.
If you know a warning is safe to ignore, you may want to indicate
that in your source code. For example if I were coding this,
instead of the very informative wire name "t" I would use
a wire named "unused_sign". Then when your warning says that
"unused_sign" is never used, you look at it and say, yeah that's
exactly right!

As your projects become more and more complex, you will find that
attempting to remove all warnings becomes much harder. It's best
to just give up on trying and learn to make reading the report
easier by using informative signal names.

Just my 2 cents,
Gabor
 

Welcome to EDABoard.com

Sponsor

Back
Top