Components/IP/Command decoder
(→Script) |
(→Examples) |
||
(5 intermediate revisions by one user not shown) | |||
Line 17: | Line 17: | ||
The <code>LF (0A<sub>h</sub>)</code> character in the ROM ends the matching search and directly issues a command pulse, | The <code>LF (0A<sub>h</sub>)</code> character in the ROM ends the matching search and directly issues a command pulse, | ||
without awaiting the end of the command line. | without awaiting the end of the command line. | ||
+ | |||
+ | == Generics == | ||
+ | |||
+ | The generic <code>characterBitNb</code> specifies the number of bits of the <code>charIn</code> input. | ||
+ | |||
+ | The generic <code>commandNb</code> specifies the number of commands looked for in the ROM | ||
+ | and, as such, the number of bits of the <code>command</code> output. | ||
+ | |||
+ | The generic <code>commandLength</code> specifies the maximal length of each command. | ||
+ | Together with <code>commandNb</code>, they define the required size of command ROM. | ||
+ | |||
+ | The generic <code>commandsFile</code> gives the specification of the ASCII file storing the content of the ROM | ||
+ | and, as such, of the commands. | ||
+ | |||
+ | The generic <code>caseSensitive</code> is quite self explanatory. | ||
+ | |||
+ | The generic <code>valueBitNb</code> specifies the number of bits of the hexadecimal values given in the command line. | ||
+ | This corresponds to the number of bits of the <code>value</code> output. | ||
= Script = | = Script = | ||
The script <code>commandDecoder.py</code> generates the ROM data file. | The script <code>commandDecoder.py</code> generates the ROM data file. | ||
+ | |||
+ | Obviously, the variables <code>command_bit_nb</code> and <code>command_length</code> have to match the generics of the VHDL entity. | ||
= Examples = | = Examples = | ||
Line 27: | Line 47: | ||
commands = [ | commands = [ | ||
'version', | 'version', | ||
− | 'relays | + | 'relays', |
− | 'sampling | + | 'sampling', |
− | "memRead | + | "memRead", |
− | "memWrite | + | "memWrite" |
] | ] | ||
Line 40: | Line 60: | ||
The command <code>version</code> will pulse the <code>endOfCommand</code> signal with bit <code>command(1)</code> active. | The command <code>version</code> will pulse the <code>endOfCommand</code> signal with bit <code>command(1)</code> active. | ||
+ | |||
+ | == Command with a parameter == | ||
+ | |||
+ | The command <code>sampling 12C0</code> will pulse the <code>endOfCommand</code> signal with bit <code>command(3)</code> active | ||
+ | and pulse <code>valueEn</code> with <code>value</code> equal to 12C0<sub>h</sub>. | ||
+ | |||
+ | == Command with multiple parameters == | ||
+ | |||
+ | The command <code>memWrite 1234 5678</code> will pulse the <code>endOfCommand</code> signal with bit <code>command(5)</code> active | ||
+ | and pulse <code>valueEn</code> twice : one with <code>value</code> equal to 1234<sub>h</sub> | ||
+ | and the other with <code>value</code> equal to 5678<sub>h</sub>. | ||
+ | |||
+ | == Command with an early end == | ||
+ | |||
+ | The command <code>memWrite 1234<lf>5678 9ABC</code> will pulse the <code>endOfCommand</code> signal with bit <code>command(5)</code> active, | ||
+ | but do so on the arrival of the <code><lf></code> character and not at the end of the whole command. | ||
+ | It will pulse <code>valueEn</code> three times : one with <code>value</code> equal to 1234<sub>h</sub>, | ||
+ | the second with <code>value</code> equal to 5678<sub>h</sub> | ||
+ | and the last with <code>value</code> equal to 5678<sub>h</sub>. | ||
+ | Tis allows to start multiple actions on a same command. | ||
[[Category:Components]] [[Category:Designs]] [[Category:VHDL]] [[Category:IP]] | [[Category:Components]] [[Category:Designs]] [[Category:VHDL]] [[Category:IP]] |
Latest revision as of 16:45, 17 November 2021
|
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.