DFCommandField¶
DFCommandField represents a single field within a DFCommand. It specifies its width and position within the field, and it can be enumerated if it takes discrete values.
As with every tag, DFCommandField inherits from DFBase, so has support for all of the core attributes (id, description, and attributes).
{
"id": "my_command_field",
"description": "Free-form description",
"attributes": { },
"lsb": 4,
"size": 2,
"reset": 0,
"signed": false,
"enum": { }
}
| Property | Usage |
|---|---|
| lsb | Least significant bit position within the field |
| size | Width of the field in bits |
| reset | Default value, or the value taken at reset |
| signed | Whether the field's value should be treated as a signed integer |
| enum | A dictionary mapping names to dumps of DFDefine values |
Python API¶
-
class
designformat.command_field.DFCommandField(id=None, lsb=None, size=None, reset=None, signed=False, description=None)¶ DesignFormat representation of a field of a command. This could be used to represent a sub-field of an instruction for a CPU, or a parameter in a microcode instruction for a DMA engine. Command fields have fixed widths, with specified LSB alignments. The field’s value can be enumerated if required, to allow specific control values to be named.
-
__init__(id=None, lsb=None, size=None, reset=None, signed=False, description=None)¶ Construct a command field object :param id: The name of the register field :param lsb: Least significant bit position within the command :param size: Width of the field in bits :param reset: Value taken at reset (or default value) :param signed: Whether the value is signed :param description: Human-readable description
-
addEnumValue(key, value, description=None)¶ Create a new named value for the register
- Parameters
key – Name of the value
value – Value to be associated
description – Human-readable description
-
check()¶ Check that the values assigned to the field are sensible
-
dumpObject(project)¶ Dump out this node so that it can be reloaded
- Parameters
project – Project definition used to calculate references
-
loadObject(obj, root)¶ Reload this node from passed in object.
- Parameters
obj – Description of this node
root – Root object in the tree
types – Map from class name to class definition
-
Javascript API¶
-
class
DFCommandField(id, lsb, size, reset, signed, description)¶ DesignFormat representation of a field of a command. This could be used to represent a sub-field of an instruction for a CPU, or a parameter in a microcode instruction for a DMA engine. Command fields have fixed widths, with specified LSB alignments. The field’s value can be enumerated if required, to allow specific control values to be named.
Construct a command field object
- Arguments
id (string) – The name of the register field
lsb (integer) – Least significant bit position within the command
size (integer) – Width of the field in bits
reset (integer) – Value taken at reset (or default value)
signed (boolean) – Whether the value is signed
description (string) – Human-readable description
-
DFCommandField.addEnumValue(key, value, description)¶ Create a new named value for the register
- Arguments
key (string) – Name of the value
value (integer) – Value to be associated
description (string) – Human-readable description
-
DFCommandField.check()¶ Check that the values assigned to the field are sensible