【问题标题】:Histogram Equalization In VHDLVHDL中的直方图均衡
【发布时间】:2016-04-29 02:05:32
【问题描述】:

此代码仅适用于 4x4 元素。 没有合成。 即使是很小的初始部分也没有模拟

     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; 

谢谢!

【问题讨论】:

  • 你的代码示例没有分析。包声明中有一个额外的保留字Package,并且缺少流程声明开始。此外,正如您在赛灵思综合技术警告中所述,该过程没有等待声明,也没有敏感度列表。在没有输入端口的情况下,敏感性列表没有任何内容,因此需要等待声明。您也永远不会为变量分配警告说明。您有具体问题吗?
  • 请缩进并格式化您的代码,以便我们阅读。

标签: arrays matrix vhdl


【解决方案1】:
  1. 为了让你分析包声明的第一行:

    包包mypackage是

变成:

package mypackage is

(请注意,您的问题中的代码格式不正确。)

  1. 您的 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 编码错误。

【讨论】:

  • 先生,我仔细阅读了您的建议。非常感谢!可以修改一下吗
  • '你能修改'什么吗?
  • 表示我需要对此进行哪些更改!你提出的一些建议我无法得到。如果可能的话,你可能会建议一个例子!谢谢你先生..
猜你喜欢
  • 1970-01-01
  • 2017-05-17
  • 1970-01-01
  • 1970-01-01
  • 2014-03-14
  • 1970-01-01
  • 2013-12-03
  • 2016-11-27
  • 1970-01-01
相关资源
最近更新 更多