Department of Physics

Documentation Status

Modules

helper/arguments.py

LICENSE © 2018-2019 Science and Technology Facilities Council & contributors

arguments.py is a helper module provided to define and configure the argument passing and parsing for the main modules.

class arguments.Arguments[source]

Creates arguments for passing files and configuration data to the script.

A Class which configures and retrieves Arguments for use by a python script. Dictionaries retrieved from YAML files are added as attributes to this class with no sub-processing. Information including the filename of each YAML file parsed is also added as an attribute.

See Arguments

Attributes:

helper/bus_definitions.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

bus_definitions.py is a helper module provided to define bus definitions for generated AXI4-Lite connections.

helper/customlogging.py

LICENSE © 2018-2019 Science and Technology Facilities Council & contributors

customlogging.py is a helper module provided to define and configure consistent logging. The logging configuration is handled via ../logging.yml YAML file and uses colorlog for console output. A rolling system is used for outputting to files.

class customlogging.LogLevelsConsts[source]

Logger level equivalent strings as constants, used to pass log level to helper functions.

DEBUG

String matching DEBUG logger level.

Type:str
INFO

String matching INFO logger level.

Type:str
WARNING

String matching WARNING logger level.

Type:str
CRITICAL

String matching CRITICAL logger level.

Type:str
ERROR

String matching ERROR logger level.

Type:str
customlogging.config_logger(name, class_name=None)[source]

Allows a logger to be set up and/or configured in all modules/module classes

Parameters:
  • name (str) – Name of the logger.
  • class_name (str, optional) – Name of the class to which the logger is associated. Default value: None
Returns:

A configured logger object.

Return type:

logging (obj)

customlogging.constant(f)[source]

setters and getters for constants used throughout

Prevents setting of existing objects. Raises a TypeError.

Returns:property
Raises:TypeError – On setter.
customlogging.errorexit(logr)[source]

Inserts a exit on error message in the logger output and performs a sys.exit(-1)

Parameters:logr (obj) – A logger object to pass the exit on error message to.
Returns:None
customlogging.mand_missing(obj, field)[source]

Inserts a mandatory field missing error message in the logger output and calls errorexit()

Parameters:
  • logr (obj) – A logger object to pass the error message to.
  • field (str) – field to report in the error message.
Returns:

None

customlogging.path_missing(obj, name, path)[source]

Inserts a path missing error message in the logger output and calls errorexit()

Parameters:
  • logr (obj) – A logger object to pass the error message to.
  • name (str) – Name of processing element which caused the error message.
  • path (str) – Missing Path which caused the error message.
Returns:

None

customlogging.sect_break(logr, level=<property object>)[source]

Inserts a section break in the logger output.

Parameters:
  • logr (obj) – A logger object to pass the section break to.
  • level (attr of LogLevelsConsts obj, optional) – Logger level of the section break. Default value: LogLevelsConsts.INFO
Returns:

None

customlogging.setup_logging(logr_settings='../logging.yml', default_level=20)[source]

Setup logging configuration from a YAML file

Parameters:
  • logr_settings (str, optional) – Defines the relative location of the logging configuration file,
  • the root module. Default value (from) – logging.yml
  • default_level (logging attr, optional) – Sets the default logging level. Default value: logging.INFO
Returns:

None

helper/help.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

help.py is a helper module provided to version and help information.

helper/reserved_words.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

reserved_words.py is a helper module providing a list of reserved VHDL keywords, which should not be used as identifiers in XML files used to generate the VHDL.

setup.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

helper/slave.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

slave.py is a helper module providing methods and classes used to generate slave components from XML

class slave.Slave(data_bus_size=32, size_indicate_bytes=0)[source]

Creates a AXI4-Lite Slave

check_address_requirement()[source]

OB check that the size of the slave is smaller than absolute offset

Returns:None
check_bitfield()[source]

OB check for clashing bit-field

Returns:None
check_offset()[source]

OB check for clashing addresses

Returns:None
check_reserved_words()[source]

OB check for reserved words occurrence

Returns:None
compute_decoder_mask()[source]
Returns:None
default_permission()[source]

OB write default permission where it is not specified

Returns:None
default_reset()[source]

OB write default reset where it is not specified

Returns:None
fill_absolute_offset()[source]

OB fill absolute offset field walking from current node to root and accumulating offset

Returns:None
fill_addressable()[source]

OB fill addressable field

An object is addressable if it is:

  • block
  • register_with_bitfield
  • register_without_bitfield
  • bitfield
Returns:None
fill_child()[source]

OB fill child/parent fields

Returns:None
fill_complete_id()[source]

OB fill complete id field

Returns:None
fill_decoder_mask()[source]

OB fill decoder mask field

Returns:None
fill_type()[source]

OB fill type field

Returns:None
get_atomicity()[source]
Returns:
Return type:(???)
get_max_id_len()[source]

Return maximum addressable_id length

Returns:Length
Return type:(int)
get_nof_not_ignored_blocks()[source]

OB return number of blocks

Returns:
Return type:(int)
get_nof_not_ignored_registers()[source]

OB return number of registers

Returns:
Return type:(int)
get_object(object_type_list, include_ignored=True)[source]

Return a list of requested objects with specified type

Specific types are:

  • block
  • register_without_bitfield
  • bitfield
Parameters:
  • object_type_list (list of str) –
  • include_ignored (bool, optional) – Default value is True
Returns:

Sorted list of requested object types

Return type:

(list)

get_range_from_mask(mask, split='0')[source]

Return range from mask

Parameters:
  • mask
  • split
Returns:

Return type:

(???)

get_reset_generics()[source]

OB create generics resets dictionary

Returns:None
get_size()[source]
Returns:Size
Return type:(int)
get_size_normalizer()[source]
Returns:
Return type:(???)
get_split_splice(node_dict)[source]
Parameters:node_dict (dict) –
Returns:
Return type:(???)
is_split_register(node_dict)[source]
Parameters:node_dict (dict) –
Returns:
Return type:(???)
is_wide_register(node_dict)[source]
Parameters:node_dict (dict) –
Returns:
Return type:(???)
populate_dict(root_node)[source]

Populate the dictionary

Parameters:root_node
Returns:
Return type:(???)
populate_node_dictionary(xml_node, xml_parent_node, hier_level)[source]

Populate the node dictionary

Parameters:
  • xml_node
  • xml_parent_node
  • hier_level
Returns:

Return type:

(???)

populate_subnodes(node, target_level, current_level)[source]

# populate all subnodes of a node of hierarchical level defined by target_level

Parameters:
  • node
  • target_level
  • current_level
Returns:

Return type:

(???)

propagate_reset_value()[source]

OB propagate reset value to child nodes

Returns:None
reset()[source]

Reset the slave

Returns:None
slave.dec_check_bit(add_list, bit)[source]

Return position of first not-equal bit among addresses in add_list

Parameters:
  • add_list (list) –
  • bit
Returns:

first not-equal bit among addresses in add_list or -1 if there are not different bits

Return type:

(???)

slave.dec_get_last_bit(bit_path)[source]
Parameters:bit_path
Returns:
Return type:(???)
slave.dec_route_add(tree_dict)[source]
Parameters:tree_dict
Returns:
Return type:(???)
slave.reverse_key_order(input_dict)[source]

Return a reversed ordered list of keys

Parameters:input_dict (dict) –
Returns:Reversed list of keys on input_dict
Return type:(list)

helper/string_io.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

string_io.py is a helper module providing methods and classes for handling string IO consistently.

helper/version.py

BSD © 2018-2019 Science and Technology Facilities Council & contributors

version.py is a helper module provided to handle public version numbering which follows the PEP440 guidelines.

Note

The __version__ uses the version.Version (defined in this module), therefore is used towards the end of this module.

class version.Version(major, minor, micro, prerelease='', svn_rev='', disable_svn_logging=False)[source]

Creates a Class with methods to construct and fetch PEP440 Public Version Numbering

Creates an initial PEP440 Public Version Identifier from the supplied parameters after validating the prerelease parameter,

Parameters:
  • major (int) – Representing the Major Version Number (changes affecting execution method)
  • minor (int) – Representing the Minor Version Number (bugfixes)
  • micro (int) – Representing the Micro Version Number (correction of typos/release notes)
  • prerelease (int, optional) – Addition Pre-Release Indicator. Valid values: a, b, rc, where: a = alpha; b = beta; and rc = release candidate
  • svn_rev (str, optional) – SVN Revision Number
  • disable_svn_logging (bool) – Do not include SVN output in logs. Default value: False
get_version()[source]

Method to get the string representation of the version number.

Returns:String of Version Number
set_version(major, minor, micro, pre)[source]

Method to set the string representation of a Version Number.

Parameters:
  • major – Integer Value Representing the Major Version Number (changes affecting execution method)
  • minor – Integer Value Representing the Minor Version Number (bugfixes)
  • micro – Integer Value Representing the Micro Version Number (correction of typos/release notes)
  • pre – Optional Addition Pre-Release Indicator… a = alpha b = beta rc = release candidate
Returns:

string

version.about(modname, ver, revision)[source]

Method to Create an About String, to display Method Name and Version/Rev

Parameters:
  • modname (str) – Module Name
  • ver (str) – Version Number, in the form: MAJOR.MINOR.MICRO
  • revision (str) – SVN Revision Number
Returns:

Return type:

str

xml2htmltables.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

xml2htmltables.py is a module provided to automatically generate HTML tables from generated AXI4-Lite Memory-Maps which can be embedded into documentation.

Todo

  • error checking
  • documentation
  • regression test

xml2ic.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

xml2ic.py is a module provided to automatically generate AXI4-Lite Memory Mapped locations from XML descriptions, and is responsible for generating inter-connect (IC) blocks.

Todo

  • error checking
  • documentation
  • regression test
class xml2ic.Xml2Ic(options, args)[source]
xml2ic.check_offset(root)[source]
Parameters:root
Returns:None
xml2ic.check_offset_requirement(root)[source]
Parameters:root
Returns:None
xml2ic.dec_check_bit(add_list, bit)[source]
Parameters:
  • add_list (list of ???) –
  • bit
Returns:

position of not-equal bit among addresses in add_list, returns -1 if there are not different bits

Return type:

(int)

xml2ic.dec_get_last_bit(bit_path)[source]
Parameters:bit_path (str) –
Returns:
Return type:(int)
xml2ic.dec_route_add(tree_dict)[source]
Parameters:tree_dict (dict) –
Returns:
tuple containing:
  • int: 1 to indicate done complete.
  • dict:
Return type:tuple
xml2ic.depth(node)[source]
Parameters:node (obj) –
Returns:
Return type:(int)
xml2ic.get_absolute_id(node, excluded_levels=[])[source]
Parameters:
  • node (obj) –
  • excluded_levels (list of ???) –
Returns:

Return type:

(???)

xml2ic.get_absolute_offset(node)[source]
Parameters:node (obj) –
Returns:None
xml2ic.get_byte_size(node)[source]
Parameters:node (obj) –
Returns:
Return type:(int)
xml2ic.get_decoder_mask(address_list)[source]
Parameters:address_list (list of int) –
Returns:
Return type:(dict)
xml2ic.get_node_size(node)[source]

Return the node total size

Parameters:node (obj) –
Returns:
Return type:(int)
xml2ic.get_xml_file(link, path_list)[source]
Parameters:
  • link
  • path_list (list of str) –
Returns:

Return type:

(???)

xml2ic.ignore_check_offset(node_x, node_y)[source]
Parameters:
  • node_x
  • node_y
Returns:

Return type:

(???)

xml2ic.is_leaf(node)[source]
Parameters:node (obj) –
Returns:
Return type:(bool)

xml2slave.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

xml2slave.py is a module provided to automatically generate AXI4-Lite Memory Mapped locations from XML descriptions, and is responsible for generating slaves.

Todo

  • reset record value
  • error checking
  • documentation
  • regression test

helper/xml_gen.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

xml_gen.py is a helper module providing methods for generating XML output files.

helper/xml_utils.py

GNU General Public License v3 © 2015-2019 University of Oxford & contributors

xml_utils.py is a helper module providing methods and classes for handling XML files.

class xml_utils.XmlMemoryMap(input_file_name, data_bus_size=32, size_indicate_bytes=0)[source]
check_wide_blocks()[source]

OB check for blocks that are wider than data bus and resize them

Returns:None
exclude_hw_ignore()[source]

Exclude node with “hw_ignore” attribute set

Returns:None
resolve_command_line_parameters(command_line_constant)[source]

Resolve command line parameters

Parameters:command_line_constant
Returns:None

Resolve links

Iterate through nodes till there are no links to be resolved

Parameters:path_list (list of str) –
Returns:None
split_wide_registers()[source]

Split wide register in multiple registers

Returns:
Return type:None
unroll_arrays()[source]

Unroll arrays

Returns:None
write_ram_init_abs_path(input_file_name, path_list, relocate_path)[source]

write absolute path in ram init file attribute

Parameters:
  • input_file_name (str) –
  • path_list (list of str) –
  • relocate_path (str) –
Returns:

None

xml_utils.get_parameters_dict(constants)[source]

create command line parameters dictionary

Parameters:constants
Returns:
Return type:(dict)