A
a s
Guest
Hello,
I wrote the following helper function to decode a chip select for
addressing a particular register in custom processor peripherals.
function CE_decode(CE_bit,CE_width : integer) return
std_logic_vector is
variable v_tmp : std_logic_vector(0 to CE_width-1) := (others =>
'0');
begin
v_tmp(CE_bit) := '1';
return v_tmp;
end function CE_decode;
The problem is that Xilinx XST returns a warning:
WARNING:HDLParsers:817 Choice CE_decode is not a locally static
expression.
I confirmed that the warning is actually redundant but I would still
like to get rid of it.
I am using the function in a context like this:
C_NUM_REG : integer := 4;
p_slv_reg_write : process(Bus2IP_Clk) is
begin
if rising_edge(Bus2IP_Clk) then
case slv_reg_write_sel is
when CE_decode(0, C_NUM_REG) =>
slv_reg0 <= Bus2IP_Data;
when CE_decode(1, C_NUM_REG) =>
slv_reg1 <= Bus2IP_Data;
when CE_decode(2, C_NUM_REG) =>
slv_reg2 <= Bus2IP_Data;
when CE_decode(3, C_NUM_REG) =>
slv_reg3 <= Bus2IP_Data;
when others => null;
end case;
end if;
end process p_slv_reg_write;
Instead of using the CE_decode function I can of course just write a
static expression,
but this gets hard to maintain and needs modification each time the
number of registers
in the peripheral changes. And it is hard to spot a mistake if there
are 32 registers
which CE is actually being decoded, e.g.
"00000000000000000010000000000000".
Can somebody please suggest how to work around the warning or suggest
a better way
in place of CE_decode function?
Thank you!
I wrote the following helper function to decode a chip select for
addressing a particular register in custom processor peripherals.
function CE_decode(CE_bit,CE_width : integer) return
std_logic_vector is
variable v_tmp : std_logic_vector(0 to CE_width-1) := (others =>
'0');
begin
v_tmp(CE_bit) := '1';
return v_tmp;
end function CE_decode;
The problem is that Xilinx XST returns a warning:
WARNING:HDLParsers:817 Choice CE_decode is not a locally static
expression.
I confirmed that the warning is actually redundant but I would still
like to get rid of it.
I am using the function in a context like this:
C_NUM_REG : integer := 4;
p_slv_reg_write : process(Bus2IP_Clk) is
begin
if rising_edge(Bus2IP_Clk) then
case slv_reg_write_sel is
when CE_decode(0, C_NUM_REG) =>
slv_reg0 <= Bus2IP_Data;
when CE_decode(1, C_NUM_REG) =>
slv_reg1 <= Bus2IP_Data;
when CE_decode(2, C_NUM_REG) =>
slv_reg2 <= Bus2IP_Data;
when CE_decode(3, C_NUM_REG) =>
slv_reg3 <= Bus2IP_Data;
when others => null;
end case;
end if;
end process p_slv_reg_write;
Instead of using the CE_decode function I can of course just write a
static expression,
but this gets hard to maintain and needs modification each time the
number of registers
in the peripheral changes. And it is hard to spot a mistake if there
are 32 registers
which CE is actually being decoded, e.g.
"00000000000000000010000000000000".
Can somebody please suggest how to work around the warning or suggest
a better way
in place of CE_decode function?
Thank you!