25 Threads found on edaboard.com: Readline Vhdl
Thanks for the reply. Here is the code I used for reading values from file into an array. This process is similar to an example from Designer's guide to vhdl (By Peter Ashenden). I'm not sure as to where the problem is.Please help me out with this.
type Y_array is array (1 to 2,1 to 2) of integer;
ASIC Design Methodologies and Tools (Digital) :: 21.05.2004 04:06 :: vomit :: Replies: 7 :: Views: 3379
I use modelsim in vhdl design. I want to call data from fetalint.txt. my code is
file infile: text is in "fetalint.txt";
variable ip1: integer range -4096 to 4095;
variable buf: line;
while not(endfile(infile)) loop
wait until falling_edge(W_clock
PLD, SPLD, GAL, CPLD, FPGA Design :: 01.04.2006 10:27 :: coo848 :: Replies: 1 :: Views: 596
Textio is d keyword.. :)
TEXTIO is a package of vhdl functions that read and write text make the package visible:
text - a file of character strings
line - one string from a text file
file Prog: text is in "file_name"; --text file "file_name"
variable L: line
PLD, SPLD, GAL, CPLD, FPGA Design :: 19.01.2007 11:51 :: tut :: Replies: 3 :: Views: 7799
in vhdl every thing is in binary, you cannot have a data type which can store hex. so when you will read from a file using something like
variable l1 : line;
variable var1 : std_logic_vector(7 downto 0);
readline(f1,l1); --read a line from a file f1 which contains hex words example FE
hread(var1,l1); -- read into var1, a hex val
PLD, SPLD, GAL, CPLD, FPGA Design :: 29.11.2007 17:05 :: avimit :: Replies: 13 :: Views: 13406
i assume that you want to use this for a testbench or some simulation purpose only.
add the textio package from synopsis into your project directory from the path i told you before. compile it .
to understand how to use these hread, hwrite etc procedure in your code you can simply open the package file and understand its input and output
PLD, SPLD, GAL, CPLD, FPGA Design :: 05.04.2008 06:40 :: kvingle :: Replies: 6 :: Views: 8450
i think u have missed the "readline" function before read function...
Check the below link
PLD, SPLD, GAL, CPLD, FPGA Design :: 28.07.2009 01:56 :: shanmugaveld :: Replies: 12 :: Views: 6885
-- extra packages:
-- file declaration (vhdl 93 syntax) in architecture:
file fin : text open read_mode is "c:/temp/input_file.txt";
-- read file contents somewhere in process:
variable inp_line : line;
while not endfile (fin) loop
PLD, SPLD, GAL, CPLD, FPGA Design :: 12.01.2010 02:53 :: devas :: Replies: 7 :: Views: 3407
Is the below code snippet for file reading is fine. I am not able to open this file, so please correct the code. I am newbie to vhdl.
procedure PrepareInput is
VARIABLE inLine : LINE;
VARIABLE dataRead : REAL;
VARIABLE index : integer:= 0;
file file_in : text open read_mode is "lena_64_64.txt";
ASIC Design Methodologies and Tools (Digital) :: 13.02.2010 08:29 :: raghava :: Replies: 0 :: Views: 467
I am facing problems with file reading in vhdl. I am newbie to vhdl.
I am expecting answers.
Here is the code and error message I have got.
procedure PrepareInput is
variable inLIne: line;
variable int_text : integer:= 0;
variable index : integer:= 0;
--file file_in : text open read_
ASIC Design Methodologies and Tools (Digital) :: 17.02.2010 08:18 :: raghava :: Replies: 6 :: Views: 2016
How to read a 24 bit bmp file in vhdl. This is the code I have written.
Here also exit when endfile is needed na????
procedure bmp_read is
variable inline: line;
type char_file is file of char
ASIC Design Methodologies and Tools (Digital) :: 18.02.2010 03:48 :: raghava :: Replies: 4 :: Views: 2529
in the below i have this runtime error :
no digits found in abstract literal
textio procedure READ(INTEGER): can not get value from "?" (? shows some unkhon character)
and then equal to the 16*16 times generate this error:
textio procedure READ(INTEGER) :parameter L designate an empty string
what does it mean?
for i in 0 to 15
PLD, SPLD, GAL, CPLD, FPGA Design :: 20.07.2010 02:29 :: MOOMOO_KAMP81 :: Replies: 17 :: Views: 2401
architecture xxxx of yyyy is
file fin : text open read_mode is "";
variable rdline : line
variable hex : std_logic_vector(3 downto 0);
while not endfile(fin) loop
PLD, SPLD, GAL, CPLD, FPGA Design :: 05.08.2010 02:56 :: devas :: Replies: 6 :: Views: 2529
I've only been using vhdl for a few months now, and i'm currently working on a RAM module in which the contents of the memory are initially loaded from a file. The module has 5 address lines, 8-birectional data lines, an active low enable, and a read/write select input.
At the moment, i've got to a stage were some sort of value seems to b
PLD, SPLD, GAL, CPLD, FPGA Design :: 30.04.2011 06:19 :: MRLL :: Replies: 3 :: Views: 1556
Does Xilinx XST support vhdl textio library for synthesized code? Most likely not.
P.S.: If it's for a simulation test bench, the sequence would be
for i in ar'range loop
PLD, SPLD, GAL, CPLD, FPGA Design :: 04.06.2011 14:13 :: FvM :: Replies: 13 :: Views: 2241
hi i want to know how many characters does a readline command reads.
is it full one line or is there any limitation for it.?????????
PLD, SPLD, GAL, CPLD, FPGA Design :: 06.06.2011 12:48 :: chitra ranganath :: Replies: 2 :: Views: 448
there is no way to do this easily in vhdl. vhdl is not set up to do File io nicely other than text.
What file are you trying to read? For every file you can use the ENDFILE() function to see if you have reached the end of a file:
while not ENDFILE(my_file) loop
You could use this lo
PLD, SPLD, GAL, CPLD, FPGA Design :: 17.06.2011 10:33 :: TrickyDicky :: Replies: 2 :: Views: 936
A few days ago I had the exact same problem. I also used my code in a process:
if rising_edge(CLK) then
if write_en <= '1' then
while not((endfile(Datafile))) loop
TXTRAM(i) <= mem_data;
i <= i +1;
PLD, SPLD, GAL, CPLD, FPGA Design :: 30.12.2011 04:06 :: 153rd :: Replies: 8 :: Views: 2282
Here's an example that reads a single stimulus vector (representing an analog waveform) line by line. You can easily extend it to read additional values and possibly write output data to a second file.
file IN_DAT : text open read_mode is "scope.txt";
variable LI: line;
variable MV: integer;
PLD, SPLD, GAL, CPLD, FPGA Design :: 30.07.2012 11:10 :: FvM :: Replies: 15 :: Views: 844
I want to read two integer values from a .txt file named "entry.txt", which is located in the project folder, with all of the .vhd files.
variable inline : line;
file inputFile : text open read_mode is "entry.txt";
variable mynum: integer;
variable stdmynum: std_logic_vector (N-1 downto 0);
PLD, SPLD, GAL, CPLD, FPGA Design :: 22.09.2012 04:37 :: vtomic85 :: Replies: 1 :: Views: 611
Well for a testbench, you're not using the correct package, you should be using textio - it already has a file type, Text, declared for you and assosiated read/write and readline/writeline procedures. There are numerous tutorials around the web, so use google.
For actually doing it in an FPGA, why would you do that? you would need a file handler s
PLD, SPLD, GAL, CPLD, FPGA Design :: 21.01.2013 10:15 :: TrickyDicky :: Replies: 7 :: Views: 248
file master_file : TEXT is in "E:\??\??\??";
variable Lbuf : Line;
ASIC Design Methodologies and Tools (Digital) :: 18.06.2004 00:37 :: roger :: Replies: 4 :: Views: 1364
Hi,All,I wrote a testbench , and simulated it in modelsim,but there is an error about textio read, the error information is :
# Fatal error at F:/123/duc_design_restored/duc/test_complex_tb.vhd line 121
--the vhdl code of the section:
file f_bdata : text open read_mode is "test.txt";
variable l_bdata : line;
PLD, SPLD, GAL, CPLD, FPGA Design :: 22.10.2008 02:27 :: Fergu :: Replies: 2 :: Views: 850
HI vhdl experts,
I am newbie to vhdl. This task is eating away my time.
I want to read a text file(which consist raster data of an image) and store in memory pixelImage as shown below.
The code is not working.
Please correct it.
Here two for loops are not needed I think. And how to read each pixel. By reading each line then each string
ASIC Design Methodologies and Tools (Digital) :: 03.02.2010 01:00 :: raghava :: Replies: 0 :: Views: 387
file my_file : datafile open READ_MODE is "C:\Users\gleam\Documents\MATLAB\u2.jpeg";
first => there is no data type as datafile...
second => you cant use read function directly first you have to use readline function to read data from file to a line variable.
You can use read function directly if you are feeding input from console.
PLD, SPLD, GAL, CPLD, FPGA Design :: 26.05.2010 00:55 :: kvingle :: Replies: 1 :: Views: 570
when you open a file, the readline function reads the next line from the file into a line type. You can make as many calls to readline as there are lines in the file.
The same goes for read. It reads for as many things are on the line (separated by whitespace).
So usually its best just to stick things in a loop and have 1 inline variable
PLD, SPLD, GAL, CPLD, FPGA Design :: 15.07.2011 03:28 :: TrickyDicky :: Replies: 3 :: Views: 516