From help-request at octave dot org Tue Jan 18 07:56:51 2005 Subject: Re: Verilog - x and z values with octave load From: mavram at bezeqint dot net To: Luke Darnell Cc: help-octave at bevo dot che dot wisc dot edu Date: Tue, 18 Jan 2005 16:01:43 +0200 On Tue, Jan 18, 2005 at 04:27:23PM +1100, Luke Darnell wrote: > Hi, > > I am trying to load some data from a verilog simulation. > My verilog simulation dumps each variable I am interested in, to a file > of the same name. > I am then using the octave command "load variable_name" to load the > required variable_name. > I am running into problems the when variable file has undefined values, > "x", or high impedance values "z". > "load" doesn't seem to like "x" or "z" values. > Is there a way I can change "load" to read in "x" and "z"?? > Or does anyone have a better way of reading in values from a > verilog/vhdl simulation?? > > regards, > > Luke Darnell > > > > ------------------------------------------------------------- > Octave is freely available under the terms of the GNU GPL. > > Octave's home on the web: http://www.octave.org > How to fund new projects: http://www.octave.org/funding.html > Subscription information: http://www.octave.org/archive.html > ------------------------------------------------------------- Hi, If you are on a Unix/linux system, the easiest way is to filter your input through sed, for example, replacing any instance of x or z by NaN. Load will accept that: system("cat f_name | sed 's/z/NaN/g' | sed 's/x/NaN/g'>fakename"); f_name=load fakename; (I assume, following your letter that the literal values appear as isolated characters in the f_name file. Otherwise, the way to go is to use the c-like input functions: fopen, fscanf or fgetl and fclose. I cannot give a more definte answer without seeing a sample input file -with scanf there is the potential difficulty that files containing x/z will load shorter arrays, with fgetl you need some trick when converting the strings to numbers... Good luck, Avraham ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------