在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

EETOP 创芯网论坛 (原名:电子顶级开发网)

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
查看: 7166|回复: 1

[求助] 用TEXTIO读取图片数据的问题

[复制链接]
发表于 2010-7-18 21:46:36 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

x
本帖最后由 xunledelang 于 2010-7-18 21:55 编辑

我在用textio读取256*256图片灰度值数据(整数类型的txt文本),为何第一个数总不对,是-2147483648,其余的都是正确的。
library ieee;
USE STD.TEXTIO.ALL;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
USE IEEE.STD_LOGIC_TEXTIO.ALL;

entity textio256 is
port(
    clk : in std_logic;
    data_out: out integer
);
end textio256;

architecture TB of textio256 is
type memory is array( 0 to 65536 ) of integer;
--type memory is array( 0 to 65535 ) of integer;
begin
    ReadData: process
    file file1 : text open read_mode is "lena_65536.txt";
    variable rom: memory;
    variable startup:BOOLEAN:=TRUE;
    variable line1 : line;
    --variable i : integer range 0 to 65536 := 0;--不用再此进行初始化
    variable i : integer;
    begin
    --if ((clk = '1') and (clk'event)) then--延后一个时钟读取数据
        if startup then
        --wait until ((clk = '1') and (clk'event));
            for i in rom'range
            loop
                --wait until ((clk = '1') and (clk'event));--放到这里,第一个数也是错的
                readline(file1,line1);
                read(line1,rom(i));
                data_out <= rom(i);--第36行
            end loop;
            startup:=false;
            --data_out <= rom(i);--放到这里不对,没有输出
        wait until ((clk = '1') and (clk'event));--放到这里,第一个数也是错的
        end if;
    end process;
end TB;
 楼主| 发表于 2010-7-22 18:32:05 | 显示全部楼层
没人知道吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐 上一条 /2 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-5-4 18:15 , Processed in 0.017447 second(s), 6 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表