FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-03-2007, 09:38 PM
Olaf
Guest
 
Posts: n/a
Default Prefix of indexed name must be an array.

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?? 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
Reply With Quote
  #2 (permalink)  
Old 05-03-2007, 09:51 PM
Jonathan Bromley
Guest
 
Posts: n/a
Default Re: Prefix of indexed name must be an array.

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.
Reply With Quote
  #3 (permalink)  
Old 05-04-2007, 07:44 AM
Olaf
Guest
 
Posts: n/a
Default Re: Prefix of indexed name must be an array.

>> 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?


Yes, I mean this - obviously it was to late in the evening yesterday.
Maybe there is an unconstrained way? I start to use attributes more than
before, so I'm learning to use it slowly. Same to switch from std_logic
to std_ulogic, which seems to be the preferred way.

> 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


Yes, id is a vector of 8 bits width, where only a slice is used. Maybe I
should call these function width this slice, isn't?

> 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.


any improvements to make it more robust / non-ambiguous?

> 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?


emacs's vhdl-mode did it, vcom doesn't complain it (or vcom nedded it, I
can't remember and haven't modelsim at hand at moment).

> - What kind of beast are the signals 'set_bit_value', 'set_bit_mask'?


entity out by type std_ulogic, these are encoded signals to enforce some
actions outside this entity.

> More clues requested :-)


Thanks for your answer,
Olaf
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
'EVENT (or rising_edge) static prefix requirement.... Paul FPGA 5 05-11-2007 03:31 PM
ISE 6.3i error : unable to find flow prefix Nisheeth VHDL 0 03-08-2005 06:57 PM
MAX+plus II error:Can't interpret indexed name Aliki VHDL 3 09-24-2004 04:50 AM
Verilog 2001 indexed part select in XST 6.1.3? Allan Herriman FPGA 2 02-02-2004 08:29 PM


All times are GMT +1. The time now is 02:37 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved