Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how can i read data from file line by line in verilog?

440 views
Skip to first unread message

Wang Yujuan

unread,
Dec 28, 2001, 4:00:51 AM12/28/01
to
hello,
i want to read a lot of binary data from a file line by line.
in fact i want to use the function
$readmemb("file_name",memory_name[,start_addr[,finish_addr]]) to read the
data ,since it put the data into a array, so i can deal with the data one by
one.i only need to wait clk and output the data, i mean one clk output one
data from the array.
but i donn't know the total number of my file, it is random,maybe only ten
numbers maybe thousand data.
so i can not define the range of my array.
so i think maybe i need to read the data line by line.
i mean i read only one data at one time then wait a clk and output it.
then read another data from file.

how can i do it ?
waiting the reply .
thx!


Srinivasan Venkataramanan

unread,
Dec 28, 2001, 6:30:57 AM12/28/01
to
Hi,
Try and use the popular File I/O PLI from Chris Spear. It is
similar to file I/O in C - which I hope you are comfortable with (even
otherwise any C book should be of use there).

Fetch it from: http://chris.spear.net/pli/fileio.htm

HTH,
Srinivasan


--
Srinivasan Venkataramanan
ASIC Design Engineer
Software & Silicon Systems India Pvt. Ltd. (An Intel company)
Bangalore, India, Visit: http://www.simputer.org)
"I don't Speak for Intel"


"Wang Yujuan" <rtp...@cwc.nus.edu.sg> wrote in message
news:191C91BDFE8ED411B844...@pfs21.ex.nus.edu.sg...

Wang Yujuan

unread,
Dec 28, 2001, 7:40:49 AM12/28/01
to
hi,
thank you for your quickly reply.
before i have also found the web that you tell me.but in the begining he
said: This code works with VCS, MTI, Verilog-XL, and NC-Verilog (see $fread
for one restriction). i will use modelsim to simulation. can these function
work in Modelsim ?
"Srinivasan Venkataramanan" <srini...@siliconsystems.co.in> wrote in
message news:a0hld2$l...@news.or.intel.com...

Srinivasan Venkataramanan

unread,
Dec 28, 2001, 8:03:40 AM12/28/01
to
Hi,


"Wang Yujuan" <rtp...@cwc.nus.edu.sg> wrote in message
news:191C91BDFE8ED411B844...@pfs21.ex.nus.edu.sg...

> hi,
> thank you for your quickly reply.
> before i have also found the web that you tell me.but in the
begining he
> said: This code works with VCS, MTI, Verilog-XL, and NC-Verilog (see
$fread
> for one restriction). i will use modelsim to simulation. can these
function
> work in Modelsim ?

MTI --> Model Tech Inc. --. Produces Modelsim! So it should work,
give it a try, good luck.

<SNIP>

Wang Yujuan

unread,
Jan 3, 2002, 1:43:36 AM1/3/02
to
hello,
i have read the article which you recomonded.
i found it is a good way to solve my question.
but i meet another problem: how can i get the GNU General Public License
along with this program?
in the artical he said the way linking with MTI as follows:
----------------------------------------------------------------------------
------------------------------------------
Create fileio.so,the shareable object:
make MTI=1 fileio.so
or :
gcc -c -g fileio.c -DMTI -ISMTI_PATH/include
ld -G -Bdynamic -o fileio.so fileio.o
Compile and run your design with:
rm -rf work
vlib work
vlog test1.v #your Verilog code here
vsim -c test1 -do "run -all"
you might have to set the environment variable LD_LIBRARY_PATH to point to
the directory where fileio.so resides.
----------------------------------------------------------------------------
------------------------------------------
i have make a email to ch...@spear.net ,but no reply.
how can i begin to use this good program?


"Srinivasan Venkataramanan" <srini...@siliconsystems.co.in> wrote in

message news:a0hqqg$m...@news.or.intel.com...

0 new messages