V
valtih1978
Guest
--- begin code ---
architecture ARCH of TOP is
type int_vector is array (integer range<>
of integer;
function driver_counter( values : int_vector ) return integer is
variable result : integer := 0;
variable l: line;
begin
for index in values'range loop
if values(index) /= 0 then
result := result + 1;
write (l, integer'image(values(index)) & ",");
end if;
end loop;
report l.all & " count resolved => " & integer'image(result);
return result;
end function;
signal S1: driver_counter integer := 6;
begin
-- s1 <= 1;
end architecture;
-- end code ---
In Modelsim, the driver_counter does not print any reports, which means
that resolution is not executed on S1, despite it is resolved and
Ashenden says
--- begin quote ---
The resolution function for a resolved signal is also invoked to
initialize the signal. At the start of a simulation, the drivers for the
signal are initialized to the expression included in the signal
declaration, or to the default initial value for the signal type if no
initialization expression is given. The resolution function is then
invoked using these driver values to determine the initial value for the
signal. In this way, the signal always has a properly resolved value,
right from the start of the simulation.
--- end quote ---
If, however, I uncomment the last line, assignment s1 <= 1, the
driver_counter is executed twice, reporting that there is only one driver.
Is everything ok? Why the resolution is not invoked when drivers are
disconnected?
architecture ARCH of TOP is
type int_vector is array (integer range<>
function driver_counter( values : int_vector ) return integer is
variable result : integer := 0;
variable l: line;
begin
for index in values'range loop
if values(index) /= 0 then
result := result + 1;
write (l, integer'image(values(index)) & ",");
end if;
end loop;
report l.all & " count resolved => " & integer'image(result);
return result;
end function;
signal S1: driver_counter integer := 6;
begin
-- s1 <= 1;
end architecture;
-- end code ---
In Modelsim, the driver_counter does not print any reports, which means
that resolution is not executed on S1, despite it is resolved and
Ashenden says
--- begin quote ---
The resolution function for a resolved signal is also invoked to
initialize the signal. At the start of a simulation, the drivers for the
signal are initialized to the expression included in the signal
declaration, or to the default initial value for the signal type if no
initialization expression is given. The resolution function is then
invoked using these driver values to determine the initial value for the
signal. In this way, the signal always has a properly resolved value,
right from the start of the simulation.
--- end quote ---
If, however, I uncomment the last line, assignment s1 <= 1, the
driver_counter is executed twice, reporting that there is only one driver.
Is everything ok? Why the resolution is not invoked when drivers are
disconnected?