A
a1_nocrap_exh
I am in a situation where I have to increase an address bus width in
bit of re-usable code.
In a package there is a list of constants which are used in the address
decode
constant abus_width : natural := 5;
constant REGISTER_A : std_logic_vector(abus_width-1 downto 0) :=
"00001";
constant REGISTER_B : std_logic_vector(abus_width-1 downto 0) :=
"00010";
etc.
I've now increased abus_width by 2 and now all the constant literals
need updating because they are the wrong width.
I thought I would try to work out a way of specifying the constants so
that they would grow with abus_width so that if we ever had to do this
again it would automatically work e.g.
library ieee;
use ieee.std_logic_arith.all;
constant abus_width : natural := 7;
constant REGISTER_A : std_logic_vector(abus_width-1 downto 0) :=
conv_std_logic_vector(16#01#,abus_width);
constant REGISTER_B : std_logic_vector(abus_width-1 downto 0) :=
conv_std_logic_vector(16#02#,abus_width);
However I now get the following warning "Case choice must be a locally
static expression." in the Case statements which use these constants.
But it IS locally static isnt it? It's a constant, it's in a package,
that package is referenced...
Anyone ever done anything like this before or got a better technique?
Regards
Alex Holland
bit of re-usable code.
In a package there is a list of constants which are used in the address
decode
constant abus_width : natural := 5;
constant REGISTER_A : std_logic_vector(abus_width-1 downto 0) :=
"00001";
constant REGISTER_B : std_logic_vector(abus_width-1 downto 0) :=
"00010";
etc.
I've now increased abus_width by 2 and now all the constant literals
need updating because they are the wrong width.
I thought I would try to work out a way of specifying the constants so
that they would grow with abus_width so that if we ever had to do this
again it would automatically work e.g.
library ieee;
use ieee.std_logic_arith.all;
constant abus_width : natural := 7;
constant REGISTER_A : std_logic_vector(abus_width-1 downto 0) :=
conv_std_logic_vector(16#01#,abus_width);
constant REGISTER_B : std_logic_vector(abus_width-1 downto 0) :=
conv_std_logic_vector(16#02#,abus_width);
However I now get the following warning "Case choice must be a locally
static expression." in the Case statements which use these constants.
But it IS locally static isnt it? It's a constant, it's in a package,
that package is referenced...
Anyone ever done anything like this before or got a better technique?
Regards
Alex Holland