Reply To: Merging coverage databases

Why OSVVM™? Forums OSVVM Merging coverage databases Reply To: Merging coverage databases

Jim Lewis

Hi Lyle,

One use model is to write out the coverage database file from separate simulation runs into separate files.  And hence, at the end of test1 we do:

UartRx_RxCov.WriteCovDb("Test1_CovDb.txt") ;

Likewise for test2 and so on:

UartRx_RxCov.WriteCovDb("Test2_CovDb.txt") ;

Then accumulate the coverage using a separate VHDL program:

UartRx_RxCov.ReadCovDb("Test1_CovDb.txt") ;
for i in 2 to NUM_TESTS_TO_MERGE loop 
  UartRx_RxCov.ReadCovDb("Test" & to_string(i) & "_CovDb.txt", MERGE =>TRUE) ;
end loop ;
... -- do stuff with the merged database

With the current implementation, there is no practical usage of having multiple databases written to the same file.  The append_mode was added to WriteCovDb for symmetry with WriteBin (with very little thought about its application – which is unfortunate and in your case misleading). Your use model of allowing ReadCovDb to merge a set of databases from the same file is interesting – it just was not implemented that way in this version.  I just looked at ReadCovDb, I don’t think it would take too much to modify it to make your use model work. It may be:

    procedure ReadCovDb (FileName : string; Merge : boolean := FALSE) is
      file CovDbFile         : text open READ_MODE is FileName ;
      ReadCovDb(CovDbFile, Merge) ;
      if Merge then
        while not EndFile(CovDbFile) loop
          ReadCovDb(CovDbFile, Merge) ;
        end loop ;
      end if; 
    end procedure ReadCovDb ;

I have not tried this, so there may be subtle issues. Let me know if you try it.