2016-04-29 163 views
-6

此代碼僅適用於4x4元素。 沒有合成。 即使是很小的初始部分不模擬VHDL中的直方圖均衡化

 library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
--use IEEE.STD_LOGIC_ARITH.ALL; 
use IEEE.STD_LOGIC_UNSIGNED.ALL; 
use IEEE.numeric_std.ALL; 
use work.mypackage.ALL; 

entity histo_two is 
port(H_c: out hist_array); 
end histo_two; 
architecture Behavioral of histo_two is 

constant my_hist:hist_array:=((0,1,2,3), (0, 2, 2, 0), (3, 3, 1, 3), (2, 3, 0, 2)); 

begin 
p0: process 
variable h: h_vector:= (0,0,0,0); 
variable gp: integer; 
variable temp: integer; 
variable H_c: h_vector; 
variable A: integer; 
variable T: h_vector; 

for i in my_hist'left(1) to my_hist'right(1) loop 
for j in my_hist'left(2) to my_hist'right(2) loop 
gp := my_hist(i,j); 

temp:= h(gp) + 1; 
h(gp) := temp; 
end loop; 
end loop; 
-- Form the cumulative image histogram Hc: 
H_c(0) := H(0); 
for p in h'left(1)+1 to h'right(1) loop 
A := H_c(p-1) + H(p); 
H_c(p) := A; 
end loop; 

end process; 
end behavioral; 

這些都是我的警告。這是我大模塊的一部分。

輸出應該是H:4,2,5,5(這是內部信號值)和H_c:(4,6,11,16)

No sensitivity list and no wait in the process 
WARNING:Xst:1306 - Output <H_c<1>> is never assigned. 
WARNING:Xst:1306 - Output <H_c<2>> is never assigned. 
WARNING:Xst:1306 - Output <H_c<3>> is never assigned. 
WARNING:Xst:1306 - Output <H_c<0>> is never assigned. 

包文件

library IEEE; 
use IEEE.STD_LOGIC_1164.all; 

包 包mypackage的是

  type hist_array is array (0 to 3,0 to 3) of integer; 
      type h_vector is array (0 to 3) of integer;  


    end mypackage; 

謝謝!

+4

你是代碼示例不分析。包聲明中有一個額外的保留字「Package」,並且缺少一個進程聲明。同樣如您在Xilinx綜合技術警告中所述,該過程沒有等待語句,也沒有靈敏度列表。沒有輸入端口,靈敏度列表沒有任何內容,因此等待語句是按順序排列的。您也從不將變量分配給警告提示。你有具體的問題嗎? – user1155120

+0

請縮進並格式化您的代碼,以便我們可以閱讀它。 – Paebbels

回答

2
  1. 爲了讓您的分析包聲明的第一行:

    套餐包mypackage的是

變爲:

package mypackage is 

(請注意你的代碼ISN在你的問題中格式不正確。)

  • 你P0過程缺少begin
  • 第一順序語句(第一for循環):

    p0: process 
    variable h: h_vector:= (0,0,0,0); 
    variable gp: integer; 
    variable temp: integer; 
    variable H_c: h_vector; 
    variable A: integer; 
    variable T: h_vector; 
    
    for i in my_hist'left(1) to my_hist'right(1) loop 
    for j in my_hist'left(2) to my_hist'right(2) loop 
    

    應由begin前面:

    p0: 
        process 
         variable h: h_vector:= (0,0,0,0); 
         variable gp: integer; 
         variable temp: integer; 
         variable H_c: h_vector; 
         variable A: integer; 
         variable T: h_vector; 
        begin 
         for i in my_hist'left(1) to my_hist'right(1) loop 
          for j in my_hist'left(2) to my_hist'right(2) loop 
    

    等待狀態被添加以允許進程掛起,模擬時間提前到time'HIGH並且模擬完成:

    end process; 
    end behavioral; 
    

    新增wait

     wait; 
        end process; 
    end behavioral; 
    

    添加添加等待語句之前兩個報表報表模擬時給

    ghdl -r histo_two
    histo_two.vhdl:45:9:@ 0ms :(報告註釋):h =(4,2,5,5)
    histo_two.vhdl:50:9:0ms :(報告註釋):H_c =(4,6,11,16)

    因此,您所缺少的是進程開始,進程中的等待語句以及程序包的正確代碼示例。

    標準(IEEE Std 1076-2008)描述了4.7封裝聲明中的封裝聲明。

    11.3過程語句中的過程語句,BNF中的要求begin(在附錄C以外是規範性的)。基於靈敏度列表,請參見第4段的隱式等待語句。

    進程掛起並在等待語句中恢復,否則它們將在模擬期間捕獲線程執行。一些VHDL模擬器可能會反對進程而沒有顯式或隱式的等待語句。

    如何從敏感列表構造等待語句以及等待語句的功能在10.2等待語句中以及它如何影響14.7.5模型執行中的仿真。

    報表聲明在10.4報表聲明中進行了描述,並且通常在知道屬性用法的情況下變得有用(請參閱16.2預定義屬性)。

    這三個錯誤中的兩個是基本的語法問題(兩個Package package保留字是問題格式錯誤),缺失的begin純粹是一個語法錯誤。缺乏靈敏度列表或等待語句是VHDL創作錯誤。

    這些是基本的VHDL編碼錯誤。

    +0

    先生,我經歷了你的建議。非常感謝!你可以修改 – Raj

    +0

    '你可以修改'什麼? – user1155120

    +0

    意味着我需要做出什麼改變!你提出的一些建議我無法得到。如果可能的話,你可以建議一個例子謝謝你,先生。 – Raj