Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
-- All array elements are intended to be DFFs
----- Entity generics -----
PIXEL_WIDTH : positive := 8 ;
PIXELS_PER_ROW : positive := 16 ;
ROWS_PER_FRAME : positive := 9 ;
------------------------------
----- The custom types -----
type generic_pixel is std_logic_vector ( PIXEL_WIDTH - 1 downto 0 ) ;
type generic_row is array ( 0 to PIXELS_PER_ROW - 1 ) of generic_pixel ;
type generic_frame is array ( 0 to ROWS_PER_FRAME - 1 ) of generic_row ;
------------------------------
----- Signals declartion of custom type -----
signal pixel : generic_pixel ;
signal row : generic_row ;
signal frame : generic_frame ;
------------------------------
Yes. According to the respective HDL capabilities.Do modern FPGA synthesis tools ( Vivado / Quartus Prime ) support 3D (or higher dimension) arrays ?
My next step.Whats stopping you from running a small design through synthesis to get a result?
Can you please post a short example?I was using a 2D (real 2d, not 1D of 1D like you example)
type filter_array_t is array(-1 to 1, -1 to 1) of sfixed(9 downto -8);
type generic_3d_array is array( 0 to 15 , 0 to 31 ) of x ( 7 downto 0 );
generic_3d_array ( 5 ) ( 3 ) <= "01110000" ;
So how would you define a true 3d array?
Will it be like this?
type generic_3d_array is array( 0 to 15 , 0 to 31 , 7 downto 0)
So how would you define a true 3d array?
Will it be like this?
type generic_3d_array is array( 0 to 15 , 0 to 31 , 7 downto 0)
type filter_array_t is array(-1 to 1, -1 to 1) of sfixed(9 downto -8);
type colors is (red, green, blue, yellow, white, orange);
type rubiks is array(1 to 3, 1 to 3, 1 to 3) of colors;
IN_FRAME : generic_3d_array ( 0 to ROWS_PER_FRAME ) - 1 , 0 to PIXELS_PER_ROW - 1 , BITS_PER_PIXEL - 1 downto 0 ) ;
signal row : generic_2d_array ( 0 to PIXELS_PER_ROW - 1 , BITS_PER_PIXEL - 1 downto 0 ) ;
signal pixel : std_logic_vector ( BITS_PER_PIXEL - 1 downto 0 ) ;
signal row : generic_2d_array ( 0 to PIXELS_PER_ROW - 1 , BITS_PER_PIXEL - 1 downto 0 ) ;
row(1,4)
"IN_FRAME" is an entity input. defined as follows:
Code:IN_FRAME : generic_3d_array ( 0 to ROWS_PER_FRAME ) - 1 , 0 to PIXELS_PER_ROW - 1 , BITS_PER_PIXEL - 1 downto 0 ) ;
"row" is a signal that's defined as follows:
Code:signal row : generic_2d_array ( 0 to PIXELS_PER_ROW - 1 , BITS_PER_PIXEL - 1 downto 0 ) ;
"pixel" is a signal that's defined as follows:
I want to do 2 things:Code:signal pixel : std_logic_vector ( BITS_PER_PIXEL - 1 downto 0 ) ;
1. Assign a row element from "IN_FRAME" into signal "row" - Is this the correct syntax to do so?
row <= IN_FRAME ( some_row_number ) ;
2. Assign a pixel element from "IN_FRAME" into signal "pixel" - Is this the correct syntax?
pixel <= IN_FRAME ( some_row_number , some_pixel_number ) ;
row <= Get_Row(IN_FRAME, some_row_number) ;
pixel <= Get_Pixel(IN_FRAME, some_row_number , some_pixel_number ) ;
ads-ee,see this confuses me to no end...
Neither assignment is correct because you have left off the second and/or third index for IN_FRAME.
?Just so that you know - slicing Nd arrays is illegal
IN_FRAME : generic_3d_array ( 0 to ROWS_PER_FRAME - 1 , 0 to PIXELS_PER_ROW - 1 , BITS_PER_PIXEL - 1 downto 0 ) ;
SOME_SIGNAL <= IN_FRAME(0 to 3, 0 to 1, 7 downto 0); -- illegal
Assume the following code:Neither assignment is correct because you have left off the second and/or third index for IN_FRAME.
signal x is array ( 0 to 2 ) of std_logic_vector ( 7 downto 0 ) ;
signal y : std_logic_vector ( 7 downto 0 ) ;
y <= x ( 1 ) ;
row <= IN_FRAME ( some_row_number ) ;
K-J,
In #15 you wrote:
Assume the following code:
Code:signal x is array ( 0 to 2 ) of std_logic_vector ( 7 downto 0 ) ; signal y : std_logic_vector ( 7 downto 0 ) ; y <= x ( 1 ) ;
Despite the fact that I left off the second boundary of x - the above will be legal.
How is it any different than:
?Code:row <= IN_FRAME ( some_row_number ) ;