UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Contributor
Contributor
6,680 Views
Registered: ‎10-11-2009

ISIM $f___ syntax

Hi! I use ISE WebPack 11.2 and ISIM 11.2, L46 and UserGuide say $fopen, $fread, $fwrite and $fclose are supported, but i cannot find syntax for this file i/o task (like other one). Can you help me with some links with more information about syntax (applicable for ISIM 11.2)? Thank you!

 

0 Kudos
4 Replies
Contributor
Contributor
6,660 Views
Registered: ‎10-11-2009

Re: ISIM $f___ syntax

ok, IEEE Std 1364-2001 is the true document. Now the problem is: I open file, successfully, and try to read from file (using file pointer, returned from $fopen), but there is no data returned - status of operation is correct (return 1 byte readed). what's wrong? $ftell and $fseek works fine, but returned data from $fread still XX.

 

 module test_TBW;

    // Inputs
    reg clk;
    reg rst;
    reg [7:0] data_in;

    // Outputs
    wire [7:0] data_out;

    // Instantiate the Unit Under Test (UUT)
    test_module uut (
        .clk(clk),
        .rst(rst),
        .data_in(data_in),
        .data_out(data_out)
    );

reg [7:0] rdata;
reg [15:0] status;
integer fd;
integer pos;

    initial begin
        // Initialize Inputs
        clk = 0;
        rst = 0;
        data_in = 0;

        // Wait 100 ns for global reset to finish
        #100;
      fd = $fopen("file_1_1.hex","rb");

        #10
        status = $fread(data_in, fd);

        #10
        status = $fseek( fd, 3, 1 );
        pos = $ftell(fd);
        
        #10
        status = $fread(data_in, fd);
        
        #10
        status = $fseek( fd, 63, 1 );
        pos = $ftell(fd);
        
        #10
        status = $fread(data_in, fd);
    
    
    end
 
always#5 clk = ~clk;
 
endmodule

0 Kudos
Contributor
Contributor
6,656 Views
Registered: ‎10-11-2009

Re: ISIM $f___ syntax

after some changes in testbench code everything work great! SOLVED :) Thank you for reading...
0 Kudos
Highlighted
Newbie adwardray
Newbie
5,674 Views
Registered: ‎07-11-2012

Re: ISIM $f___ syntax

Hi

I also have this problem, the read data is XX. May I know how you resolved this? Thank you very much.

Tags (1)
0 Kudos
Visitor zhouning523
Visitor
5,431 Views
Registered: ‎03-24-2011

Re: ISIM $f___ syntax

also have the same problem in ISIM Linux edition

both fseek and ftell works fine and pointer increments after fread operation however date is not dumped into the reg...

Can you two tell me how you fix it up?Thx!

Tags (1)
0 Kudos