VHDL里 二维数组的赋值问题
ENTITYaaaisport(clk:instd_logic;b:instd_logic_vector(1to512));ENDSM3;ARCHITECTUREstru...
ENTITY aaa is
port ( clk:in std_logic;
b:in std_logic_vector (1 to 512) );
END SM3;
ARCHITECTURE structural of aaa is
type logicvector2 is array (natural range<>,natural range<>) of std_logic;
signal w: logicvector2 (0 to 67,1 to 32);
signal ww:logicvector2 (0 to 63,1 to 32);
begin
w(0)<=b(1 to 32); 问题在这一行
Error (10382): VHDL error at Protocol.vhd(16): index of object of array type logicvector2 must have 2 dimensions
求解答 展开
port ( clk:in std_logic;
b:in std_logic_vector (1 to 512) );
END SM3;
ARCHITECTURE structural of aaa is
type logicvector2 is array (natural range<>,natural range<>) of std_logic;
signal w: logicvector2 (0 to 67,1 to 32);
signal ww:logicvector2 (0 to 63,1 to 32);
begin
w(0)<=b(1 to 32); 问题在这一行
Error (10382): VHDL error at Protocol.vhd(16): index of object of array type logicvector2 must have 2 dimensions
求解答 展开
2个回答
展开全部
先假设你的定义正确,那么你的信号w一定是w(x,y)类型的,那你调用的时候就不能只用一个参数x,(y呢?);
其次,你的定义是相互矛盾的,本身就有问题。你想:端口b是一个标准逻辑位矢量的类型,把它赋给一个二维数组w(x,y)类型,本身就违反了同型赋值的规则,是不可能实现的;
正确的做法应该是:
定义
type logicvector2 is array (natural range<>) of std_logic_vector(0 to 31);
signal w: logicvector2 (0 to 67);
……
begin
w(0)<=b(1 to 32);
……
end arch;
其次,你的定义是相互矛盾的,本身就有问题。你想:端口b是一个标准逻辑位矢量的类型,把它赋给一个二维数组w(x,y)类型,本身就违反了同型赋值的规则,是不可能实现的;
正确的做法应该是:
定义
type logicvector2 is array (natural range<>) of std_logic_vector(0 to 31);
signal w: logicvector2 (0 to 67);
……
begin
w(0)<=b(1 to 32);
……
end arch;
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
ENTITY aaa is
port ( clk:in std_logic;
b:in std_logic_vector (1 to 512) );
END aaa;
ARCHITECTURE structural of aaa is
type logicvector2 is array (natural range<>,natural range<>) of std_logic;
signal w: logicvector2 (0 to 67,1 to 32);
signal ww:logicvector2 (0 to 63,1 to 32);
begin
w(0)<=b(1 to 32);
port ( clk:in std_logic;
b:in std_logic_vector (1 to 512) );
END aaa;
ARCHITECTURE structural of aaa is
type logicvector2 is array (natural range<>,natural range<>) of std_logic;
signal w: logicvector2 (0 to 67,1 to 32);
signal ww:logicvector2 (0 to 63,1 to 32);
begin
w(0)<=b(1 to 32);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询