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.

How to convert C++ code to VHDL?

Status
Not open for further replies.

555lin

Junior Member level 3
Joined
Aug 19, 2005
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,638
I need to transfer the c++ code to make a VHDL program in
Xilinx ISE environment.Xilinx ISE doesn't support multidimension arrays. How can I adapt the code of the c++
program where a 2D array is used and many 32 cycles are required?
 

gliss

Advanced Member level 2
Joined
Apr 22, 2005
Messages
692
Helped
75
Reputation
150
Reaction score
16
Trophy points
1,298
Activity points
5,892
vhdl quetion

In VHDL convert it to a 2D memory array.
 

avimit

Banned
Joined
Nov 16, 2005
Messages
413
Helped
91
Reputation
182
Reaction score
23
Trophy points
1,298
Location
Fleet, UK
Activity points
0
array port vhdl

Firstly its hard to believe that ISE does not support multi-dim array. So pls double check.
And if it is true, then you will have to flatten your 2D arrays into a 1D array.
For example a 2D array say of n elements which contains say m element each should be flatten into a mxn 1D array.
Kr,
Avi
https://www.vlsiip.com
 

vomit

Full Member level 2
Joined
Jun 14, 2002
Messages
148
Helped
14
Reputation
28
Reaction score
4
Trophy points
1,298
Activity points
1,527
vhdl 2d array port

There are 2 kinds of multidimensional arrays in VHDL: the real multi-dimensional array

type myarraytype is array(dimension1, dimension2) of elementtype;

and the array composed of another array

type arrayofarraytype is array(dimension1) of arraytype;

Does ISE only reject the multidimensional array? Perhaps you can work around it using an array-of-array?
 

    555lin

    Points: 2
    Helpful Answer Positive Rating

555lin

Junior Member level 3
Joined
Aug 19, 2005
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,638
vhdl array port

please show the correct syntax for example for
a [16,32] array
 

vomit

Full Member level 2
Joined
Jun 14, 2002
Messages
148
Helped
14
Reputation
28
Reaction score
4
Trophy points
1,298
Activity points
1,527
vhdl port array

a [16,32] array of what type of element? Let's call the it "elementtype" for the moment.

in C, the last dimension is contiguous in memory. So let's try to simulate that:

type t_myarray is array(0 to 31) of elementtype;
type t_my2darray is array(0 to 15) of t_myarray;

If elementtype is "std_logic" then you can replace t_myarray by

subtype t_myarray is std_logic_vector(0 to 31);

By the way: to read an element from
signal myarraysig : t_myarray;
you must write 2 sets of parentheses:
myarraysig(13)(24)
 

    555lin

    Points: 2
    Helpful Answer Positive Rating

wangkaust

Newbie level 6
Joined
Sep 23, 2007
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,331
port array in vhdl

In VHDL, you can use 2D array in the port.
Just manually expend them into 1D array.
To use it internally, I think it is OK with ISE.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top