首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

求助,编译报错

求助,编译报错

编译报错如下: sum of the widths of these concatenate operands is not equal to the width of the result 请问是何原因? 谢谢 源程序如下: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity a1 is port(clk : in std_logic; n : in std_logic; x : in std_logic_vector(11 downto 0); y1 : out std_logic_vector(11 downto 0); y2 : out std_logic_vector(11 downto 0)); end a1; architecture dd1 of a1 is signal p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12:std_logic_vector(11 downto 0); begin a: process(n) variable s: integer range 0 to 14; begin if (n'event and n='1') then case s is when 0=> p0<=not x(11)&x(10 downto 0); s:=s+1; when 1=> p1<=not x(11)&x(10 downto 0); s:=s+1; when 2=> p2<=not x(11)&x(10 downto 0); s:=s+1; when 3=> p3<=not x(11)&x(10 downto 0); s:=s+1; when 4=> p4<=not x(11)&x(10 downto 0); s:=s+1; when 5=> p5<=not x(11)&x(10 downto 0); s:=s+1; when 6=> p6<=not x(11)&x(10 downto 0); s:=s+1; when 7=> p7<=not x(11)&x(10 downto 0); s:=s+1; when 8=> p8<=not x(11)&x(10 downto 0); s:=s+1; when 9=> p9<=not x(11)&x(10 downto 0); s:=s+1; when 10=> p10<=not x(11)&x(10 downto 0); s:=s+1; when 11=> p11<=not x(11)&x(10 downto 0); s:=s+1; when 12=> p12<=not x(11)&x(10 downto 0); s:=s+1; when others => null; end case; end if; end process a; b1:process(clk) variable q0,q1,q2,q3,q4,q5,q6,q7,q8,q9,q10,q11,q12:std_logic_vector(11 downto 0); variable ta1,ta2,ta22,ta3,tb1,tb2,tb22,tb3,ya,yb:std_logic_vector(11 downto 0); begin if (clk'event and clk='1') then q0:=p0; q1:=p1; q2:=p2; q3:=p3; q4:=p4; q5:=p5; q6:=p6; q7:=p7; q8:=p8; q9:=p9; q10:=p10; q11:=p11; q12:=p12; ta1:=q0+q12; ta1:=ta1-q6; ta2:=q1+q11; ta2:=ta2-q5; ta2:=ta2-q7; ta22:=ta2(11)&ta2(11 downto 1); ta22:=ta22+ta2(11)&ta2(11)&ta2(11 downto 2); ta22:=ta22+ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11 downto 4); ta22:=ta22+ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11 downto 5); ta22:=ta22+ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11 downto 6); ta22:=ta22+ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11 downto 8); ta22:=ta22+ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11)&ta2(11 downto 9); ta3:=q2+q10; ta3:=ta3-q4; ta3:=ta3-q8; ta3:=ta3(11)&ta3(11 downto 1); ya:=ta1+ta22; ya:=ya+ta3; y1<=ya; tb1:=q1+q5; tb1:=tb1-q7; tb1:=tb1-q11; tb1:=tb1(11)&tb1(11 downto 1); tb2:=q2+q4; tb2:=tb2-q8; tb2:=tb2-q10; tb22:=tb2(11)&tb2(11 downto 1); tb22:=tb22+tb2(11)&tb2(11)&tb2(11 downto 2); tb22:=tb22+tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11 downto 4); tb22:=tb22+tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11 downto 5); tb22:=tb22+tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11 downto 6); tb22:=tb22+tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11 downto 8); tb22:=tb22+tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11)&tb2(11 downto 9); tb3:=q3-q9; yb:=tb1+tb22; yb:=yb+tb3; y2<=yb; end if; end process b1; end dd1;
返回列表