Coding/Naming Conventions

Why OSVVM™? Forums OSVVM Coding/Naming Conventions

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #363

    I recently downloaded the OSVVM package and was looking it over.  Something that was striking was the naming conventions in the packages which seemed, to me, somewhat inconsistent.

    For an example, I am looking at RandomPkg.vhd in the package declaration.  One observation is that VHDL is insensitive to case, so DISTTYPE is the same as DistType.  Personally, I prefer _p for packages, _t for types, but that is just a style preference.

    My main comment comes in the Rand<Type>; functions.  It seems that subprogram overloading is done above (favor_small, favor_big, normal, uniform, etc) but then there are a slew of RandReal, RandInt, RandSLV, RandUnsigned, RandSigned.  Should these functions be overloaded to just Rand with the different signatures?

    A small gripe is with the naming of functions that are comprised of different words.  Some are camelCase (InitSeed, SetRandomMode) while others have underscores (Favor_big, Favor_small).  As alluded to beforehand, I prefer underscores since VHDL doesn’t care about case and the standard libraries tend to prefer underscores, but sticking to a single convention would be nice.

    #364
    Jim Lewis
    Member

    I agree with the issue WRT favor_big and favor_small. It was an oversight from the translation from RandomDistType.  I made a note to change them to FavorBig and FavorSmall in the next revision.  Everything else that uses “_” is either a constant (and is upper case) or an externally defined type or subprogram.   

    I avoided an overloaded Rand due to ambiguity of expressions, such as the following:

    wait for RV.Rand(1,6) * TPeriod_Clk ;

    Make sure to also look at CoveragePkg as I do my first line of randomization using RandCovPoint

    As an aside about RandomDistType/SetRandomMode/SetRandomParm, I suspect they will go away in a future version. Since all of the functions that they allowed calling can now able to be called directly, I am not sure the overhead of supporting this is justified.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.