完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
嗨,我有一个实用程序vhdl文件,我用它在modelsim中进行模拟。
我做了一些代码来从文本文件中读取一个整数,它的工作原理。 然后我试着将它变成我的实用程序文件中的一个函数,我得到“子程序没有可行的条目”read_integer_from_file“”。 有谁能解释一下? 这是代码: - 宣言 不纯函数read_integer_from_file(file fp:char_file)返回整数; - 包体 不纯的功能read_integer_from_file(文件FP:char_file)返回整数isvariable I:整数:= 0;可变DATA_C:字符:='“;可变data_i:整数:= 0;可变output_temp:整数:= 0; beginwhile DATA_C / = LF loopread (FP,DATA_C);如果DATA_C / = CR和DATA_C / = LF thendata_i:= char_to_integer(DATA_C);如果I / = 0 thenfor J用0至i-1 loopoutput_temp:= output_temp * 10;结束循环; END IF; i:= i + 1; output_temp:= output_temp + data_i; end if; end loop; return(output_temp); end read_integer_from_file; - 在我的modelsim测试平台上,我有: TB:PROCESS类型char_file是字符的文件;文件fp_in:char_file;可变file_data_c:字符:='“;可变file_data_i:整数:= 0;可变file_data:整数:= 0;可变file_index:整数:= 0; 开始 RST FILE_OPEN(fp_in, “d:用户 MCV FPGA NFIR NFIR_3.0_mcv 公用事业 ADMXRC_Memory_Arch_Demo TEMP.TXT”,READ_MODE);等待100纳秒; RST等到falling_edge(CLK); file_data:= read_integer_from_file (fp_in); 以上来自于谷歌翻译 以下为原文 Hi, I have a utility vhdl file that I use for doing simulations in modelsim. I made a some code to read an integer from a text file and it works. then I tried to make it into a function inside my utility file and I get the "No feasible entries for subprogram "read_integer_from_file" ". can anyone explain? here is the code: --declaration impure function read_integer_from_file(file fp: char_file) return integer; --in package body impure function read_integer_from_file(file fp: char_file) return integer is variable i :integer := 0; variable data_c : character := ' '; variable data_i : integer := 0; variable output_temp : integer := 0; begin while data_c /= lf loop read(fp,data_c); if data_c /= cr and data_c /= lf then data_i := char_to_integer(data_c); if i /= 0 then for j in 0 to i-1 loop output_temp := output_temp*10; end loop; end if; i := i + 1; output_temp := output_temp + data_i; end if; end loop; return(output_temp); end read_integer_from_file; --in my modelsim testbench, I have: tb : PROCESS type char_file is file of character; file fp_in: char_file; variable file_data_c : character := ' '; variable file_data_i : integer := 0; variable file_data : integer := 0; variable file_index : integer := 0; BEGIN rst <= '1'; file_open(fp_in, "D:UsersmcvFPGANFIRNFIR_3.0_mcvUtilitiesADMXRC_Memory_Arch_Demotemp.txt", READ_MODE); wait for 100 ns; rst <= '0'; wait until falling_edge(clk); file_data := read_integer_from_file(fp_in); |
|
相关推荐
2个回答
|
|
嗨,
char_file的类型定义可能存在问题。 尝试在包文件中对char_file进行类型定义。 问候, 马蒂亚斯 以上来自于谷歌翻译 以下为原文 Hi, there could be a problem with the type defination of char_file. Try to do the type defination of char_file in the Package File too. regards, Matthias |
|
|
|
我做了,它与函数声明在同一区域。
以上来自于谷歌翻译 以下为原文 I did, it's in the same area as the function declaration. |
|
|
|
只有小组成员才能发言,加入小组>>
2179 浏览 7 评论
2617 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2090 浏览 9 评论
3156 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
2212 浏览 15 评论
有输入,但是LVDS_25的FPGA内部接收不到数据,为什么?
450浏览 1评论
1540浏览 1评论
在使用xc5vsx95T时JTAG扫片不成功,测量TDO无信号输出
2184浏览 0评论
516浏览 0评论
1658浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-5-14 08:46 , Processed in 1.094938 second(s), Total 81, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号