On Thu, 03 May 2007 21:38:50 +0200, Olaf <
[email protected]> wrote:
>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(n) <= 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(n) <= value;
>Isn't it an array??
No, it's a std_ulogic (in the procedure header). Maybe you meant it
to be a std_ulogic_vector?
But in any case I'm quite confused. 'id' can take values in the
range 0 to 255, but you're somehow assuming that it's in the range
1 to 8. And then you're using that number to index into a vector
that seems to be indexed from 0 to 7. It may well be that there
is hidden knowledge in this design that I can't see, but right
now it looks very fragile to me.
Other oddities:
- your clocked process template is strange; not all synthesis tools
will buy it. Why do you need "command" in the sensitivity list?
Why are the variable assignments outside the clocked logic?
- What kind of beast are the signals 'set_bit_value', 'set_bit_mask'?
More clues requested :-)
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
[email protected]
http://www.MYCOMPANY.com
The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.