Skip to main content

JSON Format

Airhdl uses the JSON file format to import and export register maps to and from the web application. The airhdl command line generator, which can be purchased separately, expects register map descriptions in the same JSON format.

The listing below shows an example JSON description for a register map called map1 with the following registers:

  • control, a read-write register with a 1-bit ena field and a 1-bit self-clearing rst field
  • status, a read-only register with a 32-bit value field
  • interrupt, an interrupt register with a 1-bit timeout field
{
"jsonVersion": 2,
"registerMap": {
"name": "map1",
"description": "my first register map",
"width": 32,
"baseAddress": 0,
"addrWidthBits": 32,
"registers": [
{
"type": "Register",
"name": "control",
"description": "Control register",
"access": "READ_WRITE",
"addressOffset": 0,
"size": 32,
"fields": [
{
"name": "ena",
"description": "Enable the component",
"bitWidth": 1,
"bitOffset": 0,
"reset": 0,
"selfClear": false,
"enumValues": [
{
"name": "on",
"value": 1
},
{
"name": "off",
"value": 0
}
]
},
{
"name": "rst",
"description": "Reset the component",
"bitWidth": 1,
"bitOffset": 31,
"reset": 0,
"selfClear": true,
"enumValues": []
}
]
},
{
"type": "Register",
"name": "status",
"description": "Status register",
"access": "READ_ONLY",
"addressOffset": 8,
"size": 32,
"fields": [
{
"name": "value",
"description": "",
"bitWidth": 32,
"bitOffset": 0,
"reset": 0,
"selfClear": false,
"enumValues": []
}
]
},
{
"type": "Register",
"name": "interrupt",
"description": "Event register",
"access": "INTERRUPT",
"addressOffset": 12,
"size": 32,
"fields": [
{
"name": "timeout",
"description": "",
"bitWidth": 1,
"bitOffset": 0,
"reset": 0,
"selfClear": false,
"enumValues": []
}
]
}
],
"revision": 21,
"generateRecordPorts": false
}
}

Root Object Attributes

The root JSON object has the following attributes:

AttributeDescriptionTypeRequiredAllowed Values
jsonVersionThe version of the JSON schemaintegeryes2
registerMapThe register map object (see below)objectyes

Register Map Object Attributes

The Register Map object has the following attributes:

AttributeDescriptionTypeRequiredAllowed Values
nameThe register map's namestringyes
descriptionThe register map's descriptionstringyes
widthThe register map's data width, in bitsintegeryes32
baseAddressThe register map's base addressintegeryes
addrWidthBitsThe register map's default address with, in bitsintegerno
revisionThe register map's revisionintegeryes
generateRecordPortsWrap user-logic facing ports into VHDL record and SystemVerilog struct typesbooleanyestrue, false
generatePackedStructsGenerate packed SystemVerilog structsbooleanyestrue, false
registersThe list of register map elementsarrayyes

Register Map Elements

Register map elements can be of three different types: Register, Register Array or Memory.

Register Object Attributes

The Register object has the following attributes:

AttributeDescriptionTypeRequiredAllowed Values
typeThe register map element's typestringyesRegister
nameThe register's namestringyes
descriptionThe register's descriptionstringyes
accessThe register's access modestringyesREAD_WRITE, READ_ONLY, WRITE_ONLY, INTERRUPT
addressOffsetThe register's address offsetintegeryes
sizeThe register's width, in bitsintegeryes32
fieldsThe register fieldsarrayyes

Register Array Object Attributes

The Register Array object has the following attributes:

AttributeDescriptionTypeRequiredAllowed Values
typeThe register map element's typestringyesRegisterArray
arrayLengthThe array length, in elementsintegeryes
nameThe array's namestringyes
descriptionThe array's descriptionstringyes
accessThe array's access modestringyesREAD_WRITE, READ_ONLY, WRITE_ONLY, INTERRUPT
addressOffsetThe array's address offsetintegeryes
sizeThe array's width, in bitsintegeryes32
fieldsThe array fieldsarrayyes

Memory Object Attributes

The Memory object has the following attributes:

AttributeDescriptionTypeRequiredAllowed Values
typeThe register map element's typestringyesMemory
depthThe memory depth, in elementsintegeryes[1 .. 1073741824]
readLatencyThe memory read latency, in clock cyclesintegeryes[1 .. 5]
nameThe memory's namestringyes
descriptionThe memory's descriptionstringyes
accessThe memory's access modestringyesREAD_WRITE, READ_ONLY, WRITE_ONLY
addressOffsetThe memory's address offsetintegeryes
sizeThe memory's width, in bitsintegeryes32
fieldsThe memory fieldsarrayyes
caution

Memories do not support the INTERRUPT access mode.

Field Object Attributes

The Field object has the following attributes:

AttributeDescriptionTypeRequiredAllowed Values
nameThe field's namestringyes
descriptionThe field's descriptionstringyes
bitWidthThe field's width, in bitsintegeryes[1 .. 32]
bitOffsetThe field's bit offsetintegeryes[0 .. 31]
resetThe field's reset valueintegeryes
selfClearWhether the field is a self-clearing onebooleanyestrue, false
enumValuesThe field's enumerated values.
Must be an array of objects with name and value properties, e.g.:
arrayyes
volatileWhether the field is a volatile one (only supported in registers or arrays with read-write access).booleannotrue, false
caution

Memories do not support self-clearing fields.