A
Andy Peters
Guest
Here's a weird one. I have a boolean generic, say FOO, that is
determines how some logic is generated. When analyzing with ModelSim
XE 6.3c, I get a warning that says, "non-resolved signal 'bar' may
have multiple sources."
The idea is that I have a terminal count value, bar, of type natural.
Depending on the value of FOO, bar is assigned either a constant, or
the contents of a register which the user can change. The thinking is
I can save a few gates by making bar a constant in one circumstance.
Here's the skeleton, which gives the idea.
signal bar : natural range 0 to 127;
signal loadthis : natural range 0 to 127;
constant bletch : natural range 0 to 127 := 127;
FOO_Is_True : if (FOO) generate
begin
bar <= bletch;
end generate FOO_Is_True;
FOO_Is_False : if (not FOO) generate
begin
bar <= loadthis;
end generate FOO_Is_False;
I've done this sort of thing before, although with std_logic and not
natural. So obviously bar (of type natural) is not a resolved type
whereas std_logic is, which is why I've never seen this warning
before.
So I guess my question is: is ModelSim right to be this picky? I
suppose it is. When synthesized (or at least elaborated), the generic
(which has a default) will select the right case, and as long as I'm
smart enough not to actually do a multiple assignment, all is well.
Is there a better way to do this?
-a
determines how some logic is generated. When analyzing with ModelSim
XE 6.3c, I get a warning that says, "non-resolved signal 'bar' may
have multiple sources."
The idea is that I have a terminal count value, bar, of type natural.
Depending on the value of FOO, bar is assigned either a constant, or
the contents of a register which the user can change. The thinking is
I can save a few gates by making bar a constant in one circumstance.
Here's the skeleton, which gives the idea.
signal bar : natural range 0 to 127;
signal loadthis : natural range 0 to 127;
constant bletch : natural range 0 to 127 := 127;
FOO_Is_True : if (FOO) generate
begin
bar <= bletch;
end generate FOO_Is_True;
FOO_Is_False : if (not FOO) generate
begin
bar <= loadthis;
end generate FOO_Is_False;
I've done this sort of thing before, although with std_logic and not
natural. So obviously bar (of type natural) is not a resolved type
whereas std_logic is, which is why I've never seen this warning
before.
So I guess my question is: is ModelSim right to be this picky? I
suppose it is. When synthesized (or at least elaborated), the generic
(which has a default) will select the right case, and as long as I'm
smart enough not to actually do a multiple assignment, all is well.
Is there a better way to do this?
-a