[Oberon] FPGA - Files.ReadBytes(), Files.WriteBytes()

Jörg joerg.straube at iaeth.ch
Mon Aug 20 12:25:13 CEST 2018


Hi Tomas

If you look at the base code of ReadByte() you see that it does some checks, if needed writes and reloads file buffers and copies only one byte.  x := r.buf.data[r.bpos]; or x := r.buf.data[0]; 

Instead of repeatingly call ReadByte() and doing the whole checks again and again, one could improve the performance of ReadBytes() by:
- taking over the base code of ReadByte
- modify it to handle multiple bytes at once
- improve the performance of copying the buffer over to parameter "x" by using SYSTEM.COPY

This effort was not spent yet.

br
Jörg


Am 20.08.18, 11:17 schrieb "Oberon im Auftrag von Tomas Kral" <oberon-bounces at lists.inf.ethz.ch im Auftrag von thomas.kral at email.cz>:

    Hi,
    
    Files.Mod has procedures for reading/writing a block of bytes, bytewise.
    
      PROCEDURE ReadBytes*(VAR r: Rider; VAR x: ARRAY OF BYTE; n: INTEGER);
        VAR i: INTEGER;
      BEGIN i := 0;  (*this implementation is to be improved*)
        WHILE i < n DO ReadByte(r, x[i]); INC(i) END
      END ReadBytes;
    
      PROCEDURE WriteBytes*(VAR r: Rider; x: ARRAY OF BYTE; n: INTEGER);
        VAR i: INTEGER;
      BEGIN i := 0; (*this implementation is to be improed*)
        WHILE i < n DO WriteByte(r, x[i]); INC(i) END
      END WriteBytes;
    
    The comment suggests improving the code further. Any hints to improve
    the code?
    Thanks
    
    -- 
    Tomas Kral <thomas.kral at email.cz>
    --
    Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
    https://lists.inf.ethz.ch/mailman/listinfo/oberon
    




More information about the Oberon mailing list