佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1401|回复: 4

VHDL Looping 问题

[复制链接]
发表于 22-3-2008 12:32 AM | 显示全部楼层 |阅读模式
Here's the scenario, typical camera have vsync,href,pclk and 8-bits data.
vsync represents new frame
href represents new line
pclk represents new pixel

I would like to capture the first 50x50 pixels of the frame and another frame after the 60th frame.

All I need is two frames.

I'm getting this error
Error (10519): VHDL Type or Variable Declaration error at camera.vhd(44): bounds of type or variable range must have same type

Error (10515): VHDL type mismatch error at camera.vhd(44): integer type does not match string literal


Here my code:
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

ENTITY camera IS

        PORT
        (
                start        : IN         STD_LOGIC;
                pixel        : IN        STD_LOGIC_VECTOR(7 DOWNTO 0);
                clk                : IN        STD_LOGIC;
                vsync        : IN        STD_LOGIC;
                href                : IN        STD_LOGIC;
                pclk                : IN        STD_LOGIC;
               
                pixel_out        : OUT         STD_LOGIC_VECTOR(7 DOWNTO 0);
                reference        : OUT        STD_LOGIC
        );
       
END camera;

ARCHITECTURE behave OF camera IS

SIGNAL        frame_count        : STD_LOGIC_VECTOR(6 DOWNTO 0);
SIGNAL        line_count        : STD_LOGIC_VECTOR(6 DOWNTO 0);
SIGNAL        pixel_count        : STD_LOGIC_VECTOR(6 DOWNTO 0);

BEGIN



        PROCESS (vsync, href, pclk)
        BEGIN
       
        IF start='1' THEN--------------------------------------------STARTS THE CAPTURING SEQUENCE
       
        frame_count <= (OTHERS => '0');
        line_count <= (OTHERS => '0');
        pixel_count <= (OTHERS => '0');
       
        IF(vsync'EVENT AND vsync = '1' )  THEN
        FOR frame_count IN "0000000" TO "111100" LOOP
                        frame_count <= frame_count + "0000001"; -------------COUNTS FRAME UNTIL 60
                               
                        IF(href'EVENT AND href = '1' ) THEN
                        FOR line_count IN "0000000" TO "110010" LOOP
                                        line_count  <= line_count  + "0000001";---------COUNTS LINE UNTIL 50
                       
                                IF(pclk'EVENT AND pclk = '1' ) THEN
                                FOR pixel_count IN "0000000" TO "110010" LOOP
                                                pixel_count  <= pixel_count  + "0000001"; --COUNTS PIXEL UNTIL 50
                               
                                                pixel_out<=pixel;-----------------------------OUTPUTS THE PIXEL DATA
                                                reference<='1';------------------------------FOR SAVING THE DATA INTO RAM PURPOSES
                                                END LOOP;

                        END IF;
                        END LOOP;
                        END IF;
                        END LOOP;
                        END IF;
                        ELSE
                                               
                                                null;
                        END IF;

                       
        END PROCESS;
               
END behave;
回复

使用道具 举报


ADVERTISEMENT

发表于 22-3-2008 07:01 AM | 显示全部楼层

回复 1# syyang85 的帖子

楼主, 这是你发的第一个帖, 但为什么不用中文发表呢?
或有谁愿意帮他翻译?
回复

使用道具 举报

发表于 22-3-2008 06:35 PM | 显示全部楼层
翻译

Here's the scenario, typical camera have vsync,href,pclk and8-bits data.
假设这是以下的例子,普通的相机有vsync,href,pclk 8- bitsdata,

vsync represents new frame
vsync 代表新的结构

href represents new line
href 代表新的一行

pclk represents new pixel
pclk 代表新的橡素

I would like to capture the first 50x50 pixels of the frameand another frame after the 60th frame.
(这一行我不清楚楼主想表达什么)

'm getting this error
这是我拿到的错误(error)

Error (10519): VHDL Type or Variable Declaration error at camera.vhd(44): bounds of type or variable range must have same type


Error (10515): VHDL type mismatch error at camera.vhd(44): integer type does not match string literal


Here my code:
这是我程序的源码:

LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;

ENTITY camera IS

        PORT
        (
                start        : IN         STD_LOGIC;
                pixel        : IN        STD_LOGIC_VECTOR(7 DOWNTO 0);
                clk                : IN        STD_LOGIC;
                vsync        : IN        STD_LOGIC;
                href                : IN        STD_LOGIC;
                pclk                : IN        STD_LOGIC;
               
                pixel_out        : OUT         STD_LOGIC_VECTOR(7 DOWNTO 0);
                reference        : OUT        STD_LOGIC
        );
        
END camera;

ARCHITECTURE behave OF camera IS

SIGNAL        frame_count        : STD_LOGIC_VECTOR(6 DOWNTO 0);
SIGNAL        line_count        : STD_LOGIC_VECTOR(6 DOWNTO 0);
SIGNAL        pixel_count        : STD_LOGIC_VECTOR(6 DOWNTO 0);

BEGIN



        PROCESS (vsync, href, pclk)
        BEGIN
        
        IF start='1' THEN--------------------------------------------STARTS THE CAPTURING SEQUENCE
        
        frame_count <= (OTHERS => '0');
        line_count <= (OTHERS => '0');
        pixel_count <= (OTHERS => '0');
        
        IF(vsync'EVENT AND vsync = '1' )  THEN
        FOR frame_count IN "0000000" TO "111100" LOOP
                        frame_count <= frame_count + "0000001"; -------------COUNTS FRAME UNTIL 60
                                
                        IF(href'EVENT AND href = '1' ) THEN
                        FOR line_count IN "0000000" TO "110010" LOOP
                                        line_count  <= line_count  + "0000001";---------COUNTS LINE UNTIL 50
                        
                                IF(pclk'EVENT AND pclk = '1' ) THEN
                                FOR pixel_count IN "0000000" TO "110010" LOOP
                                                pixel_count  <= pixel_count  + "0000001"; --COUNTS PIXEL UNTIL 50
                                
                                                pixel_out<=pixel;-----------------------------OUTPUTS THE PIXEL DATA
                                               reference<='1';------------------------------FOR SAVING THE DATAINTO RAM PURPOSES
                                                END LOOP;

                        END IF;
                        END LOOP;
                        END IF;
                        END LOOP;
                        END IF;
                        ELSE
                                                
                                                null;
                        END IF;

                        
        END PROCESS;
               
END behave;

[ 本帖最后由 jason86 于 22-3-2008 06:38 PM 编辑 ]

评分

参与人数 1积分 +20 收起 理由
pic + 20 翻译有功。

查看全部评分

回复

使用道具 举报

发表于 23-3-2008 05:18 PM | 显示全部楼层
I would like to capture the first 50x50 pixels of the frameand another frame after the 60th frame.

意思是说,楼主想要捉下50X50 像素的画面,相隔60张画面捉下新的一张。

评分

参与人数 1积分 +15 收起 理由
pic + 15 翻译奖励。

查看全部评分

回复

使用道具 举报

发表于 25-3-2008 10:04 AM | 显示全部楼层
我觉得你的FOR loop的range有问题。去看看参考书吧。
自己的assignment最好自己去完成…………
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 1-2-2025 01:05 PM , Processed in 0.151218 second(s), 34 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表