reading file using $fscanf

N

ndesi

Guest
Hello,
How i can read file using $fscanf that look like below
--------------
1 1 1 1 1 1 1
1 0 0 1 0 1 0
etc.
--------------
I am able to read file that has all bits together without
space between them

Thanks
 
You can use $fscanf either with "%d" or "%s" specifier
till eof encountered.

- Pooja

ndesi wrote:

Hello,
How i can read file using $fscanf that look like below
--------------
1 1 1 1 1 1 1
1 0 0 1 0 1 0
etc.
--------------
I am able to read file that has all bits together without
space between them

Thanks
 
Hi Ndesi,
I think you are trying to read a test vector file.
You can also use "_" - 'underscore' between the numbers and read it as
a single hex value or binary value.

Satya

Pooja Maheshwari <mpooja@agere.com> wrote in message news:<40AD91F1.9AFC4C98@agere.com>...
You can use $fscanf either with "%d" or "%s" specifier
till eof encountered.

- Pooja

ndesi wrote:

Hello,
How i can read file using $fscanf that look like below
--------------
1 1 1 1 1 1 1
1 0 0 1 0 1 0
etc.
--------------
I am able to read file that has all bits together without
space between them

Thanks
 
ndesi@talk21.com (ndesi) wrote in message news:<cf531019.0405201505.3d2daecd@posting.google.com>...
How i can read file using $fscanf that look like below
--------------
1 1 1 1 1 1 1
1 0 0 1 0 1 0
etc.
--------------
I am able to read file that has all bits together without
space between them
If the file has the bit values separated by white space, then
you will have to read each as a separate number with a separate
format descriptor. If these are supposed to be bits of a vector,
the obvious way to do it is with a loop:

for (i = MSB; i >= LSB; i = i - 1)
code = $fscanf("%b", vector);

Or you could write a script to remove the spaces from the
file before you try to read it.
 
sharp@cadence.com (Steven Sharp) writes:

Or you could write a script to remove the spaces from the file
before you try to read it.
Personally I find this easier. I usually write some code in a high
level language (Common Lisp in my case) to convert the data into
something which can be processed by $readmem.

Petter
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
 

Welcome to EDABoard.com

Sponsor

Back
Top