Difference between Xilinx isim and modelsim

Is it allowed to pass a member of a std_logic_vector to the rising_edge function?

When doing this, isim doen's detect all changes, while modelsim does. The code below toggles bits of a 3-bit vector. Bit 1 of the vector is checked for rising and falling edges by directly passing vec(1) to reising_edge(). Bit 1 is also assigned to a scalar signal which is also checked for edges:

library IEEE; use IEEE.STD_LOGIC_1164.ALL;

entity top is end top;

architecture Behavioral of top is signal vec : std_logic_vector(2 downto 0) := "000"; signal sig : std_logic := '0'; begin gen: process is begin vec

Reply to
guenter
Loading thread data ...

I would say that Modelsim is correct.

That's not correct. An element of a std_logic_vector is just std_logic. vec(1) is std_logic. vec(1 downto 1) is a 1 element wide std_logic_vector.

I believe it is a bug in Isim.

I'm basing this on reading section 8.1 of the VHDL 2002 standard "wait statement" where it says there is an implicit sensitivity list derived from

- A function call, apply this rule to every actual designator in every parameter association

and

? An indexed name whose prefix denotes a signal, add the longest static prefix of the name to the sensitivity set and apply this rule to all expressions in the indexed name

As you're using vec(1), the longest static prefix is behavioural.vec(1), so vec(1) should trigger the wait until whenever it changes.

regards Alan

--
Alan Fitch
Reply to
Alan Fitch

d_logic_vector to the rising_edge

top

top

/top

/top

top

top

/top

/top

ing

.

r is

om

e

I believe that is not correct. The LSP is ...vec (the whole vector). So processes that appear to be sensitive to one bit of a vector are also sensitive to other bits in the vector, but the rising_edge(vec(1)) function invoked by the wait statement is only looking at vec(1).

Nevertheless, it looks like isim has a bug.

Andy

Reply to
Andy

Hi Andy, I was (perhaps foolishly) assuming that because 1 is a constant, the slice could be statically determined - but you could well be correct, I really need to go away and read the definition of longest static prefix again

I agree,

regards

Alan

--
Alan Fitch
Reply to
Alan Fitch

Ok, here's the text from 1076-2002

"Furthermore, a name is said to be a locally static name if and only if one of the following conditions hold:

...

? The name is an indexed name whose prefix is a locally static name, and every expression that appears as part of the name is a locally static expression.

? The name is a slice name whose prefix is a locally static name and whose discrete range is a locally static discrete range.

A static signal name is a static name that denotes a signal. The longest static prefix of a signal name is the name itself, if the name is a static signal name; otherwise, it is the longest prefix of the name that is a static signal name. Similarly, a static variable name is a static name that denotes a variable, and the longest static prefix of a variable name is the name itself, if the name is a static variable name; otherwise, it is the longest prefix of the name that is a static variable name.

Examples: S(C,2) --A static name: C is a static constant. R(J to 16) --A nonstatic name: J is a signal.

--R is the longest static prefix of R(J to 16). T(n) --A static name; n is a generic constant. T(2) --A locally static name." "

So I think I was right,

regards Alan

--
Alan Fitch
Reply to
Alan Fitch

t

d from

y

atic

name

1),
d

I will have to go back and read the definition of LSP. I agree with your assessment that these are locally static names; the question is "what is the relation between a locally static name for an element or slice of an aggregate, and the longest static prefix for than element or slice?" It was my understanding that if there is a named aggregate that contains the object referred to by the locally static name, then the aggregate is still the LSP, not the locally static name. It likely has to do with whether events are tracked separately on inidividual elements of a named aggregate signal, or whether they are only tracked at the aggregate level.

And I may be entirely wrong...

Thanks for the discussion,

Andy

Reply to
Andy

The statement I noticed was

"The longest static prefix of a signal name is the name itself, if the name is a static signal name;"

and so may I :-)

That's OK, it's sort of fun! I wonder what the original poster thinks...

Alan

--
Alan Fitch
Reply to
Alan Fitch

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.