def get_cmd_word(cmd, d_width, d_length):
    """Build the command word.

    Note
    ----
    The returned command word has the following format:
    Bit [0]     : valid bit.
    Bit [2:1]   : command data width.
    Bit [3]     : command type (read or write).
    Bit [15:8]  : command burst length.
    Bit [31:16] : unused.

    Parameters
    ----------        
    cmd : int
        Either 1 (read processor register) or 0 (write processor register).
    d_width : int
        Command data width.
    d_length : int
        Command burst length (currently only supporting d_length 1).

    Returns
    -------
    int
        The command word following a specific format.

    """
    word = 1
    word = word | d_width - 1 << 1
    word = word | cmd << 3
    word = word | d_length << 8
    word = word | 0 << 16
    return word
