DFCommand

DFCommand can be used to represent an instruction or microcode command used by a block’s architecture. Commands contain a collection of DFCommandFields, which represent the different arguments. Commands have a flexible width, from as little as 1 bit wide, and can be broken into as many fields as required providing each field contains at least one bit. Fields are allowed to overlap, to give some support for overloading.

As with every tag, DFCommand inherits from DFBase, so has support for all of the core attributes (id, description, and attributes).

{
    "id": "my_command",
    "description": "Free-form description",
    "attributes": { },
    "width": 24,
    "fields": [ ]
}
Property Usage
width Specifies the full bit width of the command, fields do not have to fill the entire command
fields A list of DFCommandField objects.

Python API

class designformat.command.DFCommand(id=None, width=None, description=None)

DesignFormat representation of a command. This could be used to represent an instruction set for a CPU, or microcode for a DMA engine. Commands can have arbitrary width, and fields can be positioned anywhere in the bitmap. Fields can overlap if necessary (for commands with multiple parameter options).

__getattribute__(key)

By overriding __getattribute__ we can expose all fields as if they were first class attributes of this object. Note true first-class properties are prioritised over child fields.

__init__(id=None, width=None, description=None)

Construct a command object

Parameters
  • id – Name of the command

  • width – Bit width of the command

  • description – Human-readable description

addField(field)

Add a field to the command store and sort the field store by LSB

Parameters

field – The field to add

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

sortFields()

Ensures fields are in ascending LSB order.

Javascript API

class DFCommand(id, width, description)

DesignFormat representation of a command. This could be used to represent an instruction set for a CPU, or microcode for a DMA engine. Commands can have arbitrary width, and fields can be positioned anywhere in the bitmap. Fields can overlap if necessary (for commands with multiple parameter options).

Construct a command object

Arguments
  • id (string) – Name of the command

  • width (integer) – Bit width of the command

  • description (string) – Human-readable description

DFCommand.addField(field)

Add a field to the command store and sort the field store by LSB

Arguments
DFCommand.dumpObject(project)

Dump out this node so that it can be reloaded

Arguments
  • project (DFProject) – Project definition used to calculate references

DFCommand.loadObject(obj, root, types)

Reload this node from passed in object.

Arguments
  • obj (object) – Description of this node

  • root (DFBase) – Root object in the tree

  • types (object) – Map from class name to class definition

DFCommand.sortFields()

Ensures fields are in ascending LSB order.