Basic question #3

M

m

Guest
....don't know why I am numbering my questions, but I'm on a roll, so
I'll keep it that way.

Just ran into this:

signal A: std_logic_vector(5 downto 0);
....
later on in a conditional statement it is used this way:
.........A(5 downto 7).......

What does that mean? There isn't a seventh element to this vector.
Also, wouldn't "downto" require the second index to be less than or
equal to the first?

Similarly, elsewhere in the code I found:

.....ext("0", (3 - 2))...

Of course "(3-2)" is actually an expression that results in these
numbers. I'm simplifying here.
Now, from what I gather, if the SIZE portion of "ext" is < 0 it is
interpreted as 0. Presumably, then, this would simply return "0".

I think I got the second one right. The first one I can't figure
out. The three books on my desk don't seem to help either.

Thanks,

-Martin
 
On 30 Sep., 08:08, m <martin.use...@gmail.com> wrote:
...don't know why I am numbering my questions, but I'm on a roll, so
I'll keep it that way.

Just ran into this:

signal A: std_logic_vector(5 downto 0);
...
later on in a conditional statement it is used this way:
........A(5 downto 7).......
What does that mean? There isn't a seventh element to this vector.
Also, wouldn't "downto" require the second index to be less than or
equal to the first?
I guess this is a typo. (5 downto 7) is not allowed, but it might be
interpreted as (5 downto 5) by some (wrong) programs.

bye Thomas
 
On 30 Sep, 08:06, Thomas Stanka <usenet_nospam_va...@stanka-web.de>
wrote:
On 30 Sep., 08:08, m <martin.use...@gmail.com> wrote:

...don't know why I am numbering my questions, but I'm on a roll, so
I'll keep it that way.

Just ran into this:

signal A: std_logic_vector(5 downto 0);
...
later on in a conditional statement it is used this way:
........A(5 downto 7).......
What does that mean?  There isn't a seventh element to this vector.
Also, wouldn't "downto" require the second index to be less than or
equal to the first?

I guess this is a typo. (5 downto 7) is not allowed, but it might be
interpreted as (5 downto 5) by some (wrong) programs.

bye Thomas
(5 downto 7) IS allowed, it just returns a null array. It will compile
ok, not sure what exactly it would do in simulation though. A
synthesiser will probably either throw it away or just complain and
stop.

These null arrays are declared in numeric_std:
-- null range array constants

constant NAU: UNSIGNED(0 downto 1) := (others => '0');
constant NAS: SIGNED(0 downto 1) := (others => '0');
 
(5 downto 7) IS allowed, it just returns a null array. It will compile
ok, not sure what exactly it would do in simulation though. A
synthesiser will probably either throw it away or just complain and
stop.

These null arrays are declared in numeric_std:
  -- null range array constants

  constant NAU: UNSIGNED(0 downto 1) := (others => '0');
  constant NAS: SIGNED(0 downto 1) := (others => '0');
When I recently tried a null array (of natural) as an input to a
generic, ISE 10.1 turned it into either (0 downto 0) or (1 downto 0),
which in turn generated some hardware where the intention was to
generate nothing, so null arrays don't seem to work with Brand X. The
workaround ended up being passing in a specific one element array (0
=> natural'high) and detecting the natural'high in the entity, in
which case no hardware was generated. Thank you, natural'high!
 
On 30 Sep., 10:17, Tricky <Trickyh...@gmail.com> wrote:
On 30 Sep, 08:06, Thomas Stanka <usenet_nospam_va...@stanka-web.de
wrote:



On 30 Sep., 08:08, m <martin.use...@gmail.com> wrote:

...don't know why I am numbering my questions, but I'm on a roll, so
I'll keep it that way.

Just ran into this:

signal A: std_logic_vector(5 downto 0);
...
later on in a conditional statement it is used this way:
........A(5 downto 7).......
What does that mean? There isn't a seventh element to this vector.
Also, wouldn't "downto" require the second index to be less than or
equal to the first?

I guess this is a typo. (5 downto 7) is not allowed, but it might be
interpreted as (5 downto 5) by some (wrong) programs.

bye Thomas

(5 downto 7) IS allowed, it just returns a null array. It will compile
ok, not sure what exactly it would do in simulation though. A
synthesiser will probably either throw it away or just complain and
stop.
Seems I need to take a look in the lrm instead of arguing with
practical gained knowledge *g*.

regards Thomas
 
On 30 Sep, 18:01, jens <ro...@rochester.rr.com> wrote:
(5 downto 7) IS allowed, it just returns a null array. It will compile
ok, not sure what exactly it would do in simulation though. A
synthesiser will probably either throw it away or just complain and
stop.

These null arrays are declared in numeric_std:
  -- null range array constants

  constant NAU: UNSIGNED(0 downto 1) := (others => '0');
  constant NAS: SIGNED(0 downto 1) := (others => '0');

When I recently tried a null array (of natural) as an input to a
generic, ISE 10.1 turned it into either (0 downto 0) or (1 downto 0),
which in turn generated some hardware where the intention was to
generate nothing, so null arrays don't seem to work with Brand X.  The
workaround ended up being passing in a specific one element array (0
=> natural'high) and detecting the natural'high in the entity, in
which case no hardware was generated.  Thank you, natural'high!
having just experiemented, Quartus appears to recognise null ranged
vectors and gives a warning before throwing them away.
 

Welcome to EDABoard.com

Sponsor

Back
Top