R
Rick Jackson
Guest
Can anyone tell me why this type conversion:
C(25 downto 0) := A & std_logic_vector(B(22 downto -1));
isn't working (test prog below)? ModelSim reports
**Error: test.vhd(17): value -1 is out of range 0 to 2147483647".
ModelSim appears to be checking that the indexes of std_logic_vector
and B have the same type, rather than being closely related. Does the
fact that 'std_logic_vector' doesn't have a range mean that the two
arrays aren't closely related?
This code did, I think, compile correctly on an older ModelSim which I
no longer have access to (~1999); I'm trying to get it to run with a
more current version. I've cut out various bits, but hopefully nothing
relevant.
Thanks!
Rick
------
Library IEEE;
Use IEEE.Std_logic_1164.all;
entity E is
end entity E;
architecture A of E is
subtype WordType is std_logic_vector(31 downto 0);
type logic_vector is array(integer range <> of std_logic;
begin
process is
variable A : std_logic_vector(1 downto 0);
variable B : logic_vector(23 downto -4);
variable C : WordType;
begin
C(25 downto 0) := A & std_logic_vector(B(22 downto -1)); -- error
wait;
end process;
end architecture A;
C(25 downto 0) := A & std_logic_vector(B(22 downto -1));
isn't working (test prog below)? ModelSim reports
**Error: test.vhd(17): value -1 is out of range 0 to 2147483647".
ModelSim appears to be checking that the indexes of std_logic_vector
and B have the same type, rather than being closely related. Does the
fact that 'std_logic_vector' doesn't have a range mean that the two
arrays aren't closely related?
This code did, I think, compile correctly on an older ModelSim which I
no longer have access to (~1999); I'm trying to get it to run with a
more current version. I've cut out various bits, but hopefully nothing
relevant.
Thanks!
Rick
------
Library IEEE;
Use IEEE.Std_logic_1164.all;
entity E is
end entity E;
architecture A of E is
subtype WordType is std_logic_vector(31 downto 0);
type logic_vector is array(integer range <> of std_logic;
begin
process is
variable A : std_logic_vector(1 downto 0);
variable B : logic_vector(23 downto -4);
variable C : WordType;
begin
C(25 downto 0) := A & std_logic_vector(B(22 downto -1)); -- error
wait;
end process;
end architecture A;