我需要使用多维数组来表示我的设计中的矩阵。我已经尝试了两个可用的选项:
声明数组数组
type t11 is array (0 to c1_r2) of std_logic_vector(31 downto 0);
type t1 is array (0 to r1) of t11; --r1*c1_r2 matrix
Run Code Online (Sandbox Code Playgroud)多维数组。
type matrix is array (natural range <>, natural range <>)
of std_logic_vector(31 downto 0);
Run Code Online (Sandbox Code Playgroud)但是,在这两种情况下,我在 xilinx 中的后期综合模拟都给了我错误“切片名称仅允许在一维数组上使用”。在可综合 vhdl 设计中使用多维数组的正确方法是什么?欢迎任何意见。
我正在使用 Xilinx ISE 附带的 XST 合成器。我正在索引 i 和 j,因为我的矩阵维度是 m * n * 32。
我在实体中的净 a_in
a_in: in matrix (0 to size - 1, 0 to size - 1);
Run Code Online (Sandbox Code Playgroud)
被修改为
a_in : in STD_LOGIC_VECTOR3 ( 1 …Run Code Online (Sandbox Code Playgroud) 我在我的C程序中有一个动态声明的2D数组,我想将其内容传输到CUDA内核以进行进一步处理.处理完毕后,我想用CUDA处理的数据填充C代码中动态声明的2D数组.我能够使用静态2D C数组执行此操作,但不能使用动态声明的C数组执行此操作.欢迎任何投入!
我的意思是动态数组的动态数组.我写的测试代码如下.
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <stdlib.h>
const int nItt = 10;
const int nP = 5;
__device__ int d_nItt = 10;
__device__ int d_nP = 5;
__global__ void arr_chk(float *d_x_k, float *d_w_k, int row_num)
{
int index = (blockIdx.x * blockDim.x) + threadIdx.x;
int index1 = (row_num * d_nP) + index;
if ( (index1 >= row_num * d_nP) && (index1 < ((row_num +1)*d_nP))) //Modifying only one row data pertaining to one …Run Code Online (Sandbox Code Playgroud)