Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > std_logic_vector Array Input

Reply
Thread Tools

std_logic_vector Array Input

 
 
Brad Smallridge
Guest
Posts: n/a
 
      02-22-2007
I have some modules that accept a matrix of video bits.
These are binarized windows of one bit per pixel.
Presently I input the rows of bits using a separate
std_logic_vector for each row of bits. I would like to
clean this code up and input an array of std_logic_vector's.
How do I do this?
Do I need some sort of package that declares the array?
And are there any examples where the dimensions are unspecified.

Thanks,

Brad Smallridge
Ai Vision




 
Reply With Quote
 
 
 
 
weber
Guest
Posts: n/a
 
      02-22-2007
On 22 fev, 16:49, "Brad Smallridge" <bradsmallri...@dslextreme.com>
wrote:
> I have some modules that accept a matrix of video bits.
> These are binarized windows of one bit per pixel.
> Presently I input the rows of bits using a separate
> std_logic_vector for each row of bits. I would like to
> clean this code up and input an array of std_logic_vector's.
> How do I do this?
> Do I need some sort of package that declares the array?
> And are there any examples where the dimensions are unspecified.
>
> Thanks,
>
> Brad Smallridge
> Ai Vision


Hi!
You just need to declare a new type like this. It would be interesting
to put it into your pkg.vhd so any file can use it:

type array8 is array (integer range <>) of std_logic_vector(7 downto
0);

So you see one dimension is fixed and the other you specify in the
declaration.
Maybe there is a better way that I don't know about....

Then you would declare your signals and ports normally:

port (
myvideodata : in array8(7 downto 0);
...
)

So here you have 64 bits as 8x8.
If you need to access a single bit from that array you can use (x)(y)
I guess...

Did this help you ?

Cheers,
weber

 
Reply With Quote
 
 
 
 
Torsten Landschoff
Guest
Posts: n/a
 
      02-23-2007
On Feb 22, 9:14 pm, "weber" <hug...@gmail.com> wrote:

> You just need to declare a new type like this. It would be interesting
> to put it into your pkg.vhd so any file can use it:
>
> type array8 is array (integer range <>) of std_logic_vector(7 downto
> 0);
>
> So you see one dimension is fixed and the other you specify in the
> declaration.
> Maybe there is a better way that I don't know about....


You can even define a n-dimensional array with unconstrained ranges,
like this:

type video_bits is array(integer range <>, integer range <>) of
std_logic;

Instances can be declared like this:

port ( video_data : in video_bits(7 downto 0, 7 downto 0) );

for example. Not sure if this is supported by all VHDL tools, but XST
accepts it at least.

Greetings

Torsten

 
Reply With Quote
 
Ralf Hildebrandt
Guest
Posts: n/a
 
      02-23-2007
Brad Smallridge schrieb:


> I have some modules that accept a matrix of video bits.
> These are binarized windows of one bit per pixel.
> Presently I input the rows of bits using a separate
> std_logic_vector for each row of bits. I would like to
> clean this code up and input an array of std_logic_vector's.


Using 2D-Arrays as I/O signals _may_ be a problem for some synthesis
tools. If you encounter problems, create one large std_ulogic_vector and
put all elements in a line into it.
(Every n-dimensional structure can be mapped to an (n-1)-dimensional
structure concatenating the elements.)


Ralf
 
Reply With Quote
 
KJ
Guest
Posts: n/a
 
      02-23-2007
On Feb 23, 9:41 am, Ralf Hildebrandt <Ralf-Hildebra...@gmx.de> wrote:
> Brad Smallridge schrieb:
>
> > I have some modules that accept a matrix of video bits.
> > These are binarized windows of one bit per pixel.
> > Presently I input the rows of bits using a separate
> > std_logic_vector for each row of bits. I would like to
> > clean this code up and input an array of std_logic_vector's.

>
> Using 2D-Arrays as I/O signals _may_ be a problem for some synthesis
> tools. If you encounter problems,


KJ: Open a service request to the supplier of the synthesis tool
complaining about their lack of support for two dimensional arrays.
Mention to them that both Quartus and Modelsim handle them properly
(tends to get somewhat more attention when you point out things that
their competitors are doing that they can not). Also add that you'll
consider their current lack of support for what is now a 20 year old
feature of the language when deciding whether to continue using their
parts and/or tools.

At this point, you'll have done your part to help the supplier improve
their tools but don't bother holding your breath waiting for the fix
so continue on with what Brad posted....

> create one large std_ulogic_vector and
> put all elements in a line into it.
> (Every n-dimensional structure can be mapped to an (n-1)-dimensional
> structure concatenating the elements.)
>
> Ralf



 
Reply With Quote
 
Andy
Guest
Posts: n/a
 
      02-26-2007
On Feb 23, 11:05 am, "KJ" <Kevin.Jenni...@Unisys.com> wrote:
> On Feb 23, 9:41 am, Ralf Hildebrandt <Ralf-Hildebra...@gmx.de> wrote:
>
> > Brad Smallridge schrieb:

>
> > > I have some modules that accept a matrix of video bits.
> > > These are binarized windows of one bit per pixel.
> > > Presently I input the rows of bits using a separate
> > > std_logic_vector for each row of bits. I would like to
> > > clean this code up and input an array of std_logic_vector's.

>
> > Using 2D-Arrays as I/O signals _may_ be a problem for some synthesis
> > tools. If you encounter problems,

>
> KJ: Open a service request to the supplier of the synthesis tool
> complaining about their lack of support for two dimensional arrays.
> Mention to them that both Quartus and Modelsim handle them properly
> (tends to get somewhat more attention when you point out things that
> their competitors are doing that they can not). Also add that you'll
> consider their current lack of support for what is now a 20 year old
> feature of the language when deciding whether to continue using their
> parts and/or tools.
>
> At this point, you'll have done your part to help the supplier improve
> their tools but don't bother holding your breath waiting for the fix
> so continue on with what Brad posted....
>
> > create one large std_ulogic_vector and
> > put all elements in a line into it.
> > (Every n-dimensional structure can be mapped to an (n-1)-dimensional
> > structure concatenating the elements.)

>
> > Ralf


You can declare an array of std_logic_vectors, where the number of
vectors is unconstrained, but the size of each vector must be
constrained. This method works with virtually any synthesis tool. If
these are primary IO of the FPGA, the suggestion to code it with one
long slv is probably best.

Andy

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Array of std_logic_vector Willem Oosthuizen VHDL 3 02-26-2010 12:27 AM
I can use std_logic_vector only as input signal in Xilinx? Will VHDL 1 03-10-2009 04:18 PM
inout std_logic_vector to array of std_logic_vector of generic length conversion... Thomas Rouam VHDL 6 11-09-2007 11:49 AM
generate and std_logic_vector array issue vince00001 VHDL 3 06-06-2007 03:28 AM
Array of generic width std_logic_vector in entity? Brandon VHDL 2 07-18-2005 01:25 PM



Advertisments