Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - Cumbersome Signal Assignment

 
Thread Tools Search this Thread
Old 10-28-2004, 08:35 PM   #1
Default Cumbersome Signal Assignment


Hi,

I have been unable to work out how to use a user-defined type in an
entities port description. Is this possible?

I'd like to access the port signals as an array of std_logic_vector
instead of one large std_logic_vector. The way I do this at present is
a little cumbersome and I just wanted to check there isn't a better
way of achieving it. Here is what I do right now:

I use a std_logic_vector for the port description and a signal array
of std_logic_vectors inside the architecture. A for loop then ties the
two sets of signals together. So, say we implement twelve 3 bit
counters inside the entity it might look something like this:

entity counters is
port(Clock : in std_logic;
counter3port : out std_logic_vector (35 downto 0)
-- etc.
);
end counters;

architecture structure of counters is
type counter3array is array (0 to 11) of std_logic_vector (2 downto
0);
signal counter3 : counter3array;
begin
-- Translate between the userdefined type and the port type
process (counter3) begin
for i in 12 downto 1 loop
counter3port((i*3)-1 downto (i*3)-3)<=counter3(i-1);
end loop;
end process;

-- Implement the 12 three bit counters etc. here

end structure;

Is there a simpler way of accessing the port signals as an array?

Eric.


Eric
  Reply With Quote
Old 10-28-2004, 11:09 PM   #2
mike_treseler
 
Posts: n/a
Default Re: Cumbersome Signal Assignment
If you really need all the counts in the top entity
then the way you've done it can't be simplified much.
If the counts are used internally but not directly output
to pins, I would make them process variables.

-- Mike Treseler




mike_treseler
  Reply With Quote
Old 10-29-2004, 05:06 PM   #3
Eric
 
Posts: n/a
Default Re: Cumbersome Signal Assignment
"mike_treseler" <tres@fl_ke.com> wrote:
> If you really need all the counts in the top entity
> then the way you've done it can't be simplified much.
> If the counts are used internally but not directly output
> to pins, I would make them process variables.


Thanks for your reply. As I suspected it turns out you can simplify
it.

In my package definition I include the type declaration:

type COUNT3_ARRAY is array (11 downto 0) of STD_LOGIC_VECTOR(2 downto
0);

The entity declaration now looks something like this:

entity counters is
port(Clock : in std_logic;
counter3port : count3_array;
-- etc.
);
end counters;

I no longer have to manually translate between std_logic_vector and an
array of std_logic_vectors each time I go through an entity interface.

Eric.


Eric
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
I am having trouble editing a signal in a sub program. Haai Hardware 0 08-28-2007 02:58 PM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
Need help on a Modelsim VHDL Syntax? ASAP:) kaji Software 0 03-14-2007 10:43 PM
Need Help on a Modelsim VHDL Syntax....ASAP:) kaji Hardware 0 03-14-2007 10:41 PM
IMHO, Digital SECAM video is better than Analog NTSC video Radium DVD Video 167 10-25-2006 04:16 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46