OSVVM / OSVVM-Scripts

OSVVM project simulation scripts. Scripts are tedious. These scripts simplify the steps to compile your project for simulation
Other
8 stars 13 forks source link

ONE output folder #25

Closed riedel-ferringer closed 2 years ago

riedel-ferringer commented 2 years ago

I would very much prefer to put ALL the output in a dedicated folder. This is a first proposal (in combination with a matching PR for the OSVVM repo).

Should you be willing to consider this change, I think that OutputDirectory should be moved to someplace else (OsvvmScriptDefaults.tcl?)

HTML output is a problem because the links don't work any more. I don't use HTML, so I ignored it for the time being.

Please notice that this is my current "minimally invasive" implementation, so that future merges are easy. Should you consider this PR, I can integrate it more tightly.

JimLewis commented 2 years ago

We need to talk about this.

My goal is to maximize configuration and minimize what it takes to change things. This issue here is that either the VHDL code, the scripts, or both (in the case of OsvvmRun.yml) write to files.

Until recently we had a problem with Active-HDL wanting to write new files to its private source directory under its library directory. With Aldec's help, I finally found the proper settings. With this change, we can finally write to the current simulation directory reliably.

OSVVM currently does not have a mechanism to pass directory names to the VHDL code, so the easy path for VHDL code is to create files in known directories. With the ActiveHDL fix, that directory could be ".".

If we had VHDL writing to "." and then had the scripts move the files to the user requested directories, that would make everything easy - except if the simulator scripts crashes while running - then it litters.

One of the things that running OSVVM tests require is that that outputs get organized under the test suite name. This has not been implemented yet, but is important as we use different test harness to create variations in the tests (such as testing the Axi4Manager vs Aix4ManagerVti) where the test case (architecture of TestCtrl) is identical. For systems that need "configurations" to implement different properties of the system (test case using a large memory vs a small memory, ...), this is important as it avoids configuration explosions at the small expense of having multiple similar test harnesses.

WRT user settings, the plan is that OsvvmProjectScripts.pro sets the defaults and the user uses LocalScriptDefaults.tcl (not in the OSVVM library) to change the defaults. Note that StartUp.tcl currently calls LocalScriptDefaults.tcl if it exists. The thought here is that user customizations stay with the project even when OSVVM is updated by someone who has limited understanding of git.

JimLewis commented 2 years ago

I am refactoring.

I have moved the variable settings to OsvvmScriptDefaults in my local copy.
This is part of other refactoring so that StartUp.tcl and StartVCS.tcl share more in common.

The file OsvvmRun.yml is written to by both the scripts and VHDL code. Other files are created solely by VHDL during the call to EndOfTestReports and they are created in the simulation directory.

I would like the pattern to be VHDL always puts things in the current directory and the scripts move them to the users preferred directories. When we get a mechanism to pass stuff to the VHDL tests, we can consider having the files somewhere else.

The only time the files may not be moved already is if something fails. Since we are adding error catching, we can add code that moves the files if they are still in the wrong place.

Does this sound ok?

JimLewis commented 2 years ago

Please see the updated scripts in dev. Variables have been refactored into OsvvmDefaultSettings with overrides in LocalScriptDefaults.

JimLewis commented 2 years ago

Addressed on Dev. OutputDirectory renamed to OutputBaseDirectory. Each separate directory can be renamed.

I tested the settings wiht:

# set TestNum "Test1" 

namespace eval ::osvvm {
  # Directory and Results file management

  if {![info exists TestNum]} {
    variable DefaultLibraryParentDirectory  "C:/tools/sim_temp"
    variable VhdlLibraryDirectory           ""  ; # only uses VhdlLibrarySubdirectory
    if {$simulator eq "GHDL"} {
      variable OutputBaseDirectory      "OSVVM"  ; # Create Subdirectory for GHDL
    } 

  } elseif {$TestNum eq "Test1"} {
    # Default

  } elseif {$TestNum eq "Test2"} {
    # OutOnly
    variable OutputBaseDirectory        "t2"  
    variable DefaultLibraryParentDirectory  "C:/tools/sim_temp/t2"

  } elseif {$TestNum eq "Test3"} {
    # OutPlusOthers

    variable OutputBaseDirectory        "t3"  
    variable LogSubdirectory            "Log"
    variable ReportsSubdirectory        ""  ; # Directory scripts put reports into.
    variable ResultsSubdirectory        ""  ; # Directory for files opened by TranscriptOpen
    variable CoverageSubdirectory       "FunCov"
    variable VhdlLibraryDirectory       "Libs"
    variable DefaultLibraryParentDirectory  "C:/tools/sim_temp/t3"

  } elseif {$TestNum eq "Test4"} {
    # Just Others

    variable LogSubdirectory            "Log"
    variable ReportsSubdirectory        "results"  ; # Directory scripts put reports into.
#    variable ResultsSubdirectory        "results"  ; # Directory for files opened by TranscriptOpen
    variable CoverageSubdirectory       "FunCov"
    variable VhdlLibraryDirectory       ""
    variable DefaultLibraryParentDirectory  "C:/tools/sim_temp/t4"
  }
}
JimLewis commented 2 years ago

I think the updates cover this, so I am closing it.