Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Is this an LRM thing, or Modelsim Bug?

Reply
Thread Tools

Is this an LRM thing, or Modelsim Bug?

 
 
Tricky
Guest
Posts: n/a
 
      09-06-2011
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?
 
Reply With Quote
 
 
 
 
Jonathan Bromley
Guest
Posts: n/a
 
      09-06-2011
On Tue, 6 Sep 2011 07:01:14 -0700 (PDT), Tricky <(E-Mail Removed)>
wrote:

>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
 
Reply With Quote
 
 
 
 
Martin Thompson
Guest
Posts: n/a
 
      09-07-2011
Tricky <(E-Mail Removed)> writes:

> 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

--
http://www.velocityreviews.com/forums/(E-Mail Removed)
TRW Conekt - Consultancy in Engineering, Knowledge and Technology
http://www.conekt.co.uk/capabilities...ronic-hardware
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[ot] Just for LRM JaR MCSE 21 02-01-2006 07:15 PM
OT: LRM #49 PC LOAD LETTER MCSE 127 11-28-2005 09:27 AM
Need help finding LRM Draft Colby L. Canutt VHDL 0 09-03-2004 05:42 AM
LRM guru question Jonathan Bromley VHDL 3 10-31-2003 11:57 PM
for you LRM gurus jamesu VHDL 1 10-24-2003 12:10 PM



Advertisments