音影先锋亚洲天堂网|电影世界尽头的爱完整版播放|国产 熟女 91|高清无码免费观看欧美日韩|韩国一区二区三区黄色录像|美女亚洲加勒比在线|亚洲综合网 开心五月|7x成人在线入口|成人网站免费日韩毛片区|国产黄片?一级?二级?三级

登錄 免費注冊 首頁 | 行業(yè)黑名單 | 幫助
維庫電子市場網(wǎng)
技術交流 | 電路欣賞 | 工控天地 | 數(shù)字廣電 | 通信技術 | 電源技術 | 測控之家 | EMC技術 | ARM技術 | EDA技術 | PCB技術 | 嵌入式系統(tǒng)
驅(qū)動編程 | 集成電路 | 器件替換 | 模擬技術 | 新手園地 | 單 片 機 | DSP技術 | MCU技術 | IC 設計 | IC 產(chǎn)業(yè) | CAN-bus/DeviceNe

請問std_logic變量相加時報錯是什么原因?

作者:zhang_44 欄目:EDA技術
請問std_logic變量相加時報錯是什么原因?
將a定義為std_logic_vector(3 downto 0),然后在計算相關時各位求和,即sum = a(0)+a(1)+a(2)+a(3),但是編譯時總是報錯,說+運算沒有定義,即
Error: VHDL error at xiangguan1.vhd(30): can't determine definition of operator ""+"" -- found 0 possible definitions,
應該怎么處理?多謝。

* - 本貼最后修改時間:2005-12-10 21:19:36 修改者:zhang_44

2樓: >>參與討論
picklas
re
你的sum信號是什么類型呢?把你的部分代碼貼出來!!

3樓: >>參與討論
zhang_44
re
sum 也是std_logic_vector類型,用于求和后輸出與門限比較。
程序如下,請多指教,謝謝。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
USE ieee.std_logic_arith.all;


entity xiangguan is
PORT(
    clk:in std_logic;
    input1,input2:in std_logic_vector(3 downto 0);
    OUTPUT:out std_logic_vector(2 downto 0);
    OUTPUT_TEMP:out std_logic_vector(3 downto 0)
    );
end xiangguan;

architecture behavior of xiangguan is
    signal TEMP:std_logic_vector(3 downto 0);
    signal result:std_logic_vector(2 downto 0):="000";
    --signal i:integer;
begin
    PROCESS(clk)
        --variable i:integer;
    begin
        if clk'EVENT and clk = '1' then
            TEMP(0) <= input1(0) and input2(0);
            TEMP(1) <= input1(1) and input2(1);
            TEMP(2) <= input1(2) and input2(2);
            TEMP(3) <= input1(3) and input2(3);
            --i := 0;
            result <= TEMP(0) + TEMP(1) + TEMP(2) + TEMP(3);
        end if;
    end PROCESS;
    OUTPUT_TEMP <= TEMP;
    OUTPUT <= result;
end behavior;

4樓: >>參與討論
picklas
re
你的問題可能在于你的加法運算,編譯器不能很好的理解。
signal result:std_logic_vector(2 downto 0):="000";
result <= TEMP(0) + TEMP(1) + TEMP(2) + TEMP(3);
之間是有“矛盾”的,他們之間的進位關系對于語言來說,沒有很好的體現(xiàn);
解決辦法。
1 把加法拆開,變成三角結構的運算。
2 用加法的IP核。
3 直接生成LUT。。。
試一下不行再說。

5樓: >>參與討論
zhang_44
re
我用了個case語句,倒是解決了,可是要是不能這么直接相加的話位數(shù)比較多的情況如何解決呢?lut占用得也太大了吧?

6樓: >>參與討論
oaipoaip
TEMP(0)是std_logic類型,沒有定義+運算符
result <= ("00" & TEMP(0)) + ("00" & TEMP(1)) + ("00" & TEMP(2)) + ("00" & TEMP(3));


參與討論
昵稱:
討論內(nèi)容:
 
 
相關帖子
跪求數(shù);旌戏抡嬷袛(shù)字模型在hspice中的建立
EP1C6的PLL如何使用?
本科生CADENCE入門問題。
大家看看,實現(xiàn)如下功能用什么方案處理可以節(jié)約CPLD的資源
哪個硬件描術語言的應用范圍最大
免費注冊為維庫電子開發(fā)網(wǎng)會員,參與電子工程師社區(qū)討論,點此進入


Copyright © 1998-2006 m.58mhw.cn 浙ICP證030469號