EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

Is this an LRM thing, or Modelsim Bug?

Ask a question - edaboard.com

elektroda.net NewsGroups Forum Index - VHDL Language - Is this an LRM thing, or Modelsim Bug?

Tricky
Guest

Tue Sep 06, 2011 4:01 pm   



Ive got this code:

library ieee;
use ieee.std_logic_1164.all;

entity play_TB is
generic (
DEBUG : boolean := true
);


end entity;

architecture rtl of play_TB is
signal test : std_logic;
begin


process
begin
if DEBUG then
test <= '0';
end if;

wait;
end process;

test <= '1';

end rtl;

This quite correctly has test set to 'X' when the simulation runs.

But if DEBUG is false, test remains at 'U'.

So is this an LRM thing, or is it a modelsim bug?

Jonathan Bromley
Guest

Tue Sep 06, 2011 4:01 pm   



On Tue, 6 Sep 2011 07:01:14 -0700 (PDT), Tricky <trickyhead_at_gmail.com>
wrote:

Quote:
Ive got this code:

library ieee;
use ieee.std_logic_1164.all;

entity play_TB is
generic (
DEBUG : boolean := true
);


end entity;

architecture rtl of play_TB is
signal test : std_logic;
begin


process
begin
if DEBUG then
test <= '0';
end if;

wait;
end process;

test <= '1';

end rtl;

This quite correctly has test set to 'X' when the simulation runs.

But if DEBUG is false, test remains at 'U'.

So is this an LRM thing, or is it a modelsim bug?

I'm sure that's correct per LRM. Your process represents a
driver on 'test'. If you choose, at runtime, not to write
to 'test' then the driver will stay at its default value
of 'U'.

If you use generic DEBUG to if-generate the process, then
of course the driver will disappear completely if DEBUG
is false.

You could also consider initializing 'test' to 'Z' somewhere;
perhaps in its declaration (so *all* drivers start at 'Z')
or at the start of the process, independent of the value
of DEBUG (in which case the driver will be 'U' for the first
delta cycle).
--
Jonathan Bromley

Martin Thompson
Guest

Wed Sep 07, 2011 10:38 am   



Tricky <trickyhead_at_gmail.com> writes:

Quote:
Ive got this code:

process
begin
if DEBUG then
test <= '0';
end if;

wait;
end process;

This process has a driver in it. When DEBUG is false, that driver
doesn't get any assignments to change it from its default state of 'U'.

You could either initialise the signal, or provide a default driver (maybe
to 'Z') in the process, or if..generate the whole process (which removes
the driver as well)

Cheers,
Martin

--
martin.j.thompson_at_trw.com
TRW Conekt - Consultancy in Engineering, Knowledge and Technology
http://www.conekt.co.uk/capabilities/39-electronic-hardware

elektroda.net NewsGroups Forum Index - VHDL Language - Is this an LRM thing, or Modelsim Bug?

Ask a question - edaboard.com

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony