O
Olaf
Guest
Hi,
I decode a command opcode on upper byte and the target id on lower byte
of the command like this:
architecture behavioral of marshall is
procedure set_signal (
variable id : in std_ulogic_vector(7 downto 0);
signal sig : out std_ulogic;
constant value : in std_ulogic) is
variable n : integer range 1 to 8;
begin
n := to_integer(unsigned(id));
sig <= value; -- XXX
end procedure;
begin
decode: process (clk, command, reset) is
variable cmd_ub : std_ulogic_vector(7 downto 0); -- upper byte
variable cmd_lb : std_ulogic_vector(7 downto 0); -- lower byte
begin
cmd_ub := command(15 downto 8); -- operation
cmd_lb := command(7 downto 0); -- target
if (reset = RESET_ACTIVE) then
...
elsif rising_edge(clk) then
case cmd_ub is
...
when x"C0" => set_signal(cmd_lb, set_bit_value, '1');
when x"C1" => set_signal(cmd_lb, set_bit_mask, '1');
...
when others => null;
end case;
end if;
end process;
...
Unfortunately I get an error: "Prefix of indexed name must be an array"
at the assigning line: sig <= value;
Isn't it an array?? Where is my mistake and how to fix it? By using this
procedure I want to omit the nested case switches.
Thanks a lot again
Olaf
I decode a command opcode on upper byte and the target id on lower byte
of the command like this:
architecture behavioral of marshall is
procedure set_signal (
variable id : in std_ulogic_vector(7 downto 0);
signal sig : out std_ulogic;
constant value : in std_ulogic) is
variable n : integer range 1 to 8;
begin
n := to_integer(unsigned(id));
sig <= value; -- XXX
end procedure;
begin
decode: process (clk, command, reset) is
variable cmd_ub : std_ulogic_vector(7 downto 0); -- upper byte
variable cmd_lb : std_ulogic_vector(7 downto 0); -- lower byte
begin
cmd_ub := command(15 downto 8); -- operation
cmd_lb := command(7 downto 0); -- target
if (reset = RESET_ACTIVE) then
...
elsif rising_edge(clk) then
case cmd_ub is
...
when x"C0" => set_signal(cmd_lb, set_bit_value, '1');
when x"C1" => set_signal(cmd_lb, set_bit_mask, '1');
...
when others => null;
end case;
end if;
end process;
...
Unfortunately I get an error: "Prefix of indexed name must be an array"
at the assigning line: sig <= value;
Isn't it an array?? Where is my mistake and how to fix it? By using this
procedure I want to omit the nested case switches.
Thanks a lot again
Olaf