File IO / Textio updates

Proposal Editing Information

  • Who Updates: JimLewis, YourName>, ...
  • Date Proposed: 2012-08-18
  • Date Last Updated: 2013-09-20
  • Priority:
  • Complexity:
  • Focus: Testbench

Requirement Summary

Updates for textio procedures

Related and/or Competing Issues: NONE

Proposal

Decimal for std_logic_vector family

Decimal read, write, and to_string for std_logic_vector, unsigned, signed, ufixed, sfixed, float,

procedure DREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR; GOOD : out BOOLEAN);
procedure DREAD (L : inout LINE; VALUE : out STD_ULOGIC_VECTOR);

procedure DWRITE (L : inout LINE; VALUE : in STD_ULOGIC_VECTOR; 
                  JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);

function to_dstring(VALUE : in STD_ULOGIC_VECTOR) return string ; 

Hexadecimal, Octal, and Binary for integer and real

procedure HREAD (L : inout LINE; VALUE : out INTEGER; GOOD : out BOOLEAN);
procedure HREAD (L : inout LINE; VALUE : out INTEGER);
procedure OREAD (L : inout LINE; VALUE : out INTEGER; GOOD : out BOOLEAN);
procedure OREAD (L : inout LINE; VALUE : out INTEGER);
procedure BREAD (L : inout LINE; VALUE : out INTEGER; GOOD : out BOOLEAN);
procedure BREAD (L : inout LINE; VALUE : out INTEGER);
procedure DREAD (L : inout LINE; VALUE : out INTEGER; GOOD : out BOOLEAN); -- Default
procedure DREAD (L : inout LINE; VALUE : out INTEGER);

procedure HWRITE (L : inout LINE; VALUE : in INTEGER; 
                  JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
procedure OWRITE (L : inout LINE; VALUE : in INTEGER; 
                  JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
procedure BWRITE (L : inout LINE; VALUE : in INTEGER; 
                  JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
procedure DWRITE (L : inout LINE; VALUE : in INTEGER;  
                  JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);  -- Default

function to_hstring(L : integer) return string ;
function to_ostring(L : integer) return string ; 
function to_bstring(L : integer) return string ; 
function to_dstring(L : integer) return string ; 

SKIP_WHITESPACE

Make the SKIP_WHITESPACE procedure in std.textio visible.

procedure skip_whitespace ( L : inout LINE ) is
    variable readOk : BOOLEAN;
    variable c : CHARACTER;
begin
    while L /= null and L.all'length /= 0 loop
        if (L.all(1) = ' ' or L.all(1) = NBSP or L.all(1) = HT) then
            read (l, c, readOk);
        else
            exit;
        end if;
    end loop;
end procedure skip_whitespace;

"EndLine"

Return true if line is empty. Note this requires the proposal Allow access type parameters on Function Interfaces

function EndLine (
    variable L : inout Line
) return boolean is
    variable Valid : boolean ;
    variable Char : character ;
begin
    return L = null or L.all'length = 0 ;
end function EndLine ;

"CommentLine"

Leave Out:

Return true if line is a comment line. Note this requires the proposal Allow access type parameters on Function Interfaces

function CommentLine (
    variable L     : inout Line 
  ) return boolean is
    variable Valid : boolean ;
    variable Char  : character ;
  begin
    -- return Empty TRUE if line is null or 0 in length
    if L = null or L.all'length = 0 then
      return FALSE ;
    elsif L.all'length = 1  then
      return L.all(1) = '#' ;
    else 
      return L.all(1) = '#' or (L.all(1) = '-' and L.all(2) = '-') ;
    end if ;
end function CommentLine ;

Consider adding other comments: //, /*, ;, (

writeline - write directly to OUTPUT

Write directly to file std.textio.OUTPUT.

--?? procedure writeline(L : inout LINE); 

Add all stuff from TranscriptPkg?

FILE_REWIND (or REWIND)

Move a read file pointer back to the beginning of the file.

procedure FILE_REWIND (file F: FT); 

FILE_SEEK (or SEEK)

Move a read file pointer back to the beginning of the file.

procedure FILE_SEEK (file F: FT; OFFSET : INTEGER; ORIGIN : ORIGIN_TYPE); 
type ORIGIN_TYPE is (BEGINNING, CURRENT, END) ; 

For a text file, it would be nice to do a separate seek for lines (needs to parse the file).

FILE_COPY_HANDLE (or COPY_HANDLE)

Create a 2nd copy of a handle pointing to the current read location:

procedure FILE_COPY_HANDLE (file F1, F2: FT);

Directory handling and Information

Directory listing, date stamp, ....

Perhaps some of this can be accessed through the DPI capability? http://www.eda.org/twiki/bin/view.cgi/P1076/DpiProposal

Use Models

Questions

General Comments

Supporters

-- MartinThompson - 2013-09-26

Add your signature here to indicate your support for the proposal


This topic: P1076 > WebHome > Vhdl2019CollectedRequirements > FileIo
Topic revision: r7 - 2020-02-17 - 15:34:31 - JimLewis
 
Copyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback