Components/IP/Command decoder

From UIT
Jump to: navigation, search

Contents

This IP can be found on the EDA Repository: svn: https://repos.hevs.ch/svn/eda/

IP

The block receives a command built out of characters ending with a CR (0Dh) or a LF (0Ah). A number of commands stored in a ROM are compared to the incoming line. A the end of the reception, the output(s) matching with the incoming commands emit a pulse lasting one clock period.

The esc (1Bh) character in the ROM matches any character in the command.

The CR (0Dh) character in the ROM ends the matching search, even if the command continues, e.g. with further parameters.

The LF (0Ah) character in the ROM ends the matching search and directly issues a command pulse, without awaiting the end of the command line.

Generics

The generic characterBitNb specifies the number of bits of the charIn input.

The generic commandNb specifies the number of commands looked for in the ROM and, as such, the number of bits of the command output.

The generic commandLength specifies the maximal length of each command. Together with commandNb, they define the required size of command ROM.

The generic commandsFile gives the specification of the ASCII file storing the content of the ROM and, as such, of the commands.

The generic caseSensitive is quite self explanatory.

The generic valueBitNb specifies the number of bits of the hexadecimal values given in the command line. This corresponds to the number of bits of the value output.

Script

The script commandDecoder.py generates the ROM data file.

Obviously, the variables command_bit_nb and command_length have to match the generics of the VHDL entity.

Examples

With the command list :

commands = [
    'version',
    'relays',
    'sampling',
    "memRead",
    "memWrite"
]

Unknown command

The command Hello world will pulse the endOfCommand signal, but with none of the command bits active.

Bare command

The command version will pulse the endOfCommand signal with bit command(1) active.

Command with a parameter

The command sampling 12C0 will pulse the endOfCommand signal with bit command(3) active and pulse valueEn with value equal to 12C0h.

Command with multiple parameters

The command memWrite 1234 5678 will pulse the endOfCommand signal with bit command(5) active and pulse valueEn twice : one with value equal to 1234h and the other with value equal to 5678h.

Command with an early end

The command memWrite 1234<lf>5678 9ABC will pulse the endOfCommand signal with bit command(5) active, but do so on the arrival of the <lf> character and not at the end of the whole command. It will pulse valueEn three times : one with value equal to 1234h, the second with value equal to 5678h and the last with value equal to 5678h. Tis allows to start multiple actions on a same command.

Personal tools
Namespaces
Variants
Actions
Navigation
Browse
Toolbox