完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
大家好 !
我已经制作了一个程序来读取指定位置的文本文件, 我想把它存储一个数组..我不知道怎么做...请 帮我.. 这是我读取文件的代码.. LIBRARY ieee; 使用ieee.std_logic_1164.ALL; 使用STD.textio.all; ENTITY read_file IS END read_file; 架构表现为read_file IS signal bin_value:std_logic_vector(3 downto 0):=“0000”; 开始 - 阅读过程 处理 file file_pointer:text; variable line_content:string(1到4); 变量line_num:line; 变量j:整数:= 0; 变量char:character:='0'; 开始 FILE_OPEN(file_pointer, “C: read.txt”,READ_MODE); 而不是endfile(file_pointer)循环 readline(file_pointer,line_num); READ(line_num,line_content); 对于j在1到4循环中 char:= line_content(j); if(char ='0')然后 bin_value(4-j)'0'; 其他 bin_value(4-j)'1'; 万一; 结束循环; 等待10 ns; 结束循环; file_close(file_pointer); 等待; 结束过程; 最终行为; 以上来自于谷歌翻译 以下为原文 hi all ! i have made a program to read a text file from a specified location , and i want to store it an array .. i don't know how to do this...please help me.. here is my code for reading a file.. LIBRARY ieee; USE ieee.std_logic_1164.ALL; use STD.textio.all; ENTITY read_file IS END read_file; ARCHITECTURE beha OF read_file IS signal bin_value : std_logic_vector(3 downto 0):="0000"; BEGIN --Read process process file file_pointer : text; variable line_content : string(1 to 4); variable line_num : line; variable j : integer := 0; variable char : character:='0'; begin file_open(file_pointer,"C:read.txt",READ_MODE); while not endfile(file_pointer) loop readline (file_pointer,line_num); READ (line_num,line_content); for j in 1 to 4 loop char := line_content(j); if(char = '0') then bin_value(4-j) <= '0'; else bin_value(4-j) <= '1'; end if; end loop; wait for 10 ns; end loop; file_close(file_pointer); wait; end process; end beha; |
|
相关推荐
3个回答
|
|
|
您要做的是将PC的硬盘上的文本文件发送到某种开发板上的FPGA,该开发板通过某种接口连接到PC?
------------------------------------------“如果它不起作用 模拟,它不会在板上工作。“ 以上来自于谷歌翻译 以下为原文 Is what you are trying to do is send a text file from the hard-disk of your PC to an FPGA on some sort of development board that is connected to the PC by some sort of interface? ------------------------------------------ "If it don't work in simulation, it won't work on the board." |
|
|
|
|
|
我想从该文件中获取内容将其存储在一个数组中,并在模拟窗口中查看存储数据的结果。
以上来自于谷歌翻译 以下为原文 i want to take the contents from that file store it in an array and see the reult of stored data in the simulation window. |
|
|
|
|
|
那么,在模拟它时,上述代码不起作用的是什么?
------------------------------------------“如果它不起作用 模拟,它不会在板上工作。“ 以上来自于谷歌翻译 以下为原文 So, what doesn't work with the above code when you simulate it? ------------------------------------------ "If it don't work in simulation, it won't work on the board." |
|
|
|
|
只有小组成员才能发言,加入小组>>
3148 浏览 7 评论
3437 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2899 浏览 9 评论
4100 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
3083 浏览 15 评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
1363浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
1201浏览 1评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-14 15:56 , Processed in 0.736248 second(s), Total 78, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
5491
