Results 1 to 5 of 5

Thread: Output file in Verilog

  1. #1
    Gianpredator Guest

    Unhappy Output file in Verilog

    Hi there
    I need your help!! I have to write test-bench results in an output file in verilog. I'm a beginner so I heve no idea how to do this.

    thanks in advance


    GP

  2. #2
    Join Date
    Nov 2009
    Posts
    984
    Rep Power
    1

  3. #3
    Gianpredator Guest

    Default Re: Output file in Verilog

    yeah, I can search on internet too, but I need someone who explain me ( with some example) how to use correctly commands such as $fopen, $fwrite etc..

  4. #4
    Join Date
    Jul 2010
    Location
    Bangalore
    Posts
    4
    Rep Power
    1

    Default Re: Output file in Verilog

    Ok ....it goes like this....

    Syntax:

    $fopen("file_name","file_open_mode");

    Different fopen Modes
    "r" or "rb"

    Open for reading

    "w" or "wb"

    Truncate to zero length or create for writing

    "a" or "ab"

    Append (open for writing at end of file)

    "r+", "r+b", or "rb+"

    Open for update (reading and writing)

    "w+", "w+b", or "wb+"

    Truncate or create for update

    "a+", "a+b", or "ab+"

    Append; Open or create for update at end-of-file



    eg:
    integer op_file;
    op_file = $fopen("DATA_OUTPUT_FILE.txt","w");
    $fwrite(op_file,"%h\n",FILE_DATA); //FILE_DATA represents the DATA to be written into the file
    $fclose(op_file); //to release the memory allocated, If the opened files are not closed properly u may end up with wrong results. This shuld be done only after completely writing required data into the output file.

    Hope this helps u....feel free to contact

    Regards
    PKPM

  5. #5
    Gianpredator Guest

    Default Re: Output file in Verilog

    Thank you

Similar Threads

  1. verilog module output to NULL
    By sonaj in forum General Altera Discussion
    Replies: 2
    Last Post: October 30th, 2013, 08:10 AM
  2. verilog no warning when input wired to submodule output?
    By jwagnerhki in forum Quartus II and EDA Tools Discussion
    Replies: 2
    Last Post: February 17th, 2010, 10:49 PM
  3. Control how symbel (.bsf) file is created from verilog (.v) file in Quartus II
    By gl888 in forum Quartus II and EDA Tools Discussion
    Replies: 1
    Last Post: September 29th, 2009, 12:15 PM
  4. Verilog Package File
    By vlsi_freak in forum General Altera Discussion
    Replies: 3
    Last Post: June 17th, 2009, 07:07 PM
  5. writing output to a file
    By katamaneni in forum Quartus II and EDA Tools Discussion
    Replies: 1
    Last Post: April 18th, 2008, 04:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •