11. Code Documentation¶
11.1. Database Generator(dbgen)¶
11.2. Utils¶
-
class
riscof.utils.
Command
(*args, pathstyle='auto', ensure_absolute_paths=False)[source]¶ Class for command build which is supported by
suprocess
module. Supports automatic conversion ofpathlib.Path
instances to valid format forsubprocess
functions.-
__init__
(*args, pathstyle='auto', ensure_absolute_paths=False)[source]¶ Constructor.
- Parameters
pathstyle (str) – Determine the path style when adding instance of
pathlib.Path
. Path style determines the slash type which separates the path components. If pathstyle is auto, then on Windows backslashes are used and on Linux forward slashes are used. When backslashes should be prevented on all systems, the pathstyle should be posix. No other values are allowed.ensure_absolute_paths (bool) – If true, then any passed path will be converted to absolute path.
args – Initial command.
-
__iter__
()[source]¶ Support iteration so functions from
subprocess
module support Command instance.
-
__weakref__
¶ list of weak references to the object (if defined)
-
_is_shell_command
()[source]¶ Return true if current command is supposed to be executed as shell script otherwise false.
-
_path2str
(path)[source]¶ Convert
pathlib.Path
to string.The final form of the string is determined by the configuration of Command instance.
- Parameters
path – Path-like object which will be converted into string.
- Returns
String representation of path
-
append
(arg)[source]¶ Add new argument to command.
- Parameters
arg – Argument to be added. It may be list, tuple,
Command
instance or any instance which supportsstr()
.
-
run
(**kwargs)[source]¶ Execute the current command.
Uses
subprocess.Popen
to execute the command.- Returns
The return code of the process .
- Raises
subprocess.CalledProcessError – If check is set to true in kwargs and the process returns non-zero value.
-
-
riscof.utils.
absolute_path
(config_dir, entry_path)[source]¶ Create an absolute path based on the config’s file directory location and a path value from a configuration entry.
-
class
riscof.utils.
makeUtil
(makeCommand='make', makefilePath='./Makefile', clean=True)[source]¶ Utility for ease of use of make commands like make and pmake. Supports automatic addition and execution of targets. Uses the class
shellCommand
to execute commands.-
__weakref__
¶ list of weak references to the object (if defined)
-
execute_all
(cwd='./', timeout=300)[source]¶ Function to execute all the defined targets.
- Parameters
cwd (str) – The working directory to be set while executing the make command.
-
execute_target
(tname, cwd='./', timeout=300)[source]¶ Function to execute a particular target only.
- Parameters
- Raises
AssertionError – If target name is not present in the list of defined targets.
-
-
class
riscof.utils.
shellCommand
(*args, pathstyle='auto', ensure_absolute_paths=False)[source]¶ Sub Class of the command class which always executes commands as shell commands.
-
__init__
(*args, pathstyle='auto', ensure_absolute_paths=False)[source]¶ - Parameters
pathstyle (str) – Determine the path style when adding instance of
pathlib.Path
. Path style determines the slash type which separates the path components. If pathstyle is auto, then on Windows backslashes are used and on Linux forward slashes are used. When backslashes should be prevented on all systems, the pathstyle should be posix. No other values are allowed.ensure_absolute_paths (bool) – If true, then any passed path will be converted to absolute path.
args – Initial command.
-
11.3. Abstract Base Classes¶
-
class
riscof.pluginTemplate.
pluginTemplate
(*args, **kwargs)[source]¶ Metaclass for plugins as supported by
ABC
.-
__weakref__
¶ list of weak references to the object (if defined)
-
abstract
build
(isa_yaml, platform_yaml)[source]¶ Build the model as per specifications specified by DUT.
-