Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Attribute init, using on part of an array

Status
Not open for further replies.

AndyDesigner

Newbie level 4
Joined
Jun 19, 2006
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,314
Hello,

I want to set initial values into part of a 2D array as follows, but ISE doesnt appear to alllow it.

Here is what im doing:

subtype T1 is Std_logic_vector (7 down to 0);
type T1_ARRAY is arr....... of T1;



attribute init: string;
attritute init of T1_ARRAY(0) is "S";

The porlbem appears to be that ISE doesnt allow only part of the array to be setup. IE this works ok:

attritute init of T1_ARRAY is "S";

any ideas on the best way to get around this?

Andy
 

bigdogguru

Administrator
Joined
Mar 12, 2010
Messages
9,831
Helped
2,349
Reputation
4,692
Reaction score
2,275
Trophy points
1,413
Location
Southwest, USA
Activity points
62,384
Where to begin?

I'm not exactly sure what your goals are here, but is sounds as if you want to initialize part of an array of ASCII characters. It looks like you want a 1Dx1D array, not a 2D array. You may want to try something along these lines:

Code:
TYPE Chars IS ARRAY (0 TO 9) OF STD_LOGIC_VECTOR(0 TO 7);

SIGNAL x: Chars;

x(0) <= CONV_STD_LOGIC_VECTOR(character'pos('P'),8);

This creates an array of ten ascii codes, which you can initialize individually with a character to ASCII conversion.

Beware of passing around nonstandard dataypes, such as character, in your vhdl code, you can simulate the code, but you will not be able to implement it. Using a conversion to standard logic is alright because it takes place at compile time, not during implemenation.

Of course there are several other ways of accomplishing the same feat.

If you are really looking for a 2D array then try this code:

Code:
TYPE Chars IS ARRAY (0 TO 9, 9 DOWNTO 0) OF STD_LOGIC_VECTOR(0 TO 7);

SIGNAL x: Chars;

x(0,0) <= CONV_STD_LOGIC_VECTOR(character'pos('P'),8);

This forms a 10x10 array of 1 Byte for your ASCII codes, enough for one hundred characters to be stored as ASCII.

Both these examples compile fine and can be implemented.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top