.. _switchDoc: .. index:: single: switch ============ Switch Block ============ Declares a **switch block** or a **switch block bundle** using the keyword ``switch``. * Declaration_ * `Shorthand Declaration`_ * `Ports Table`_ * Description_ * `Code Examples`_ .. figure:: Images/SwitchBlock.png :scale: 100% :alt: Signal Block :align: center ---- Declaration =========== :: #switch block switch LABEL { default: off reset: MasterReset meta: none } #switch block bundle switch LABEL [SIZE] { default: off | [ off, ...] reset: MasterReset meta: none } **LABEL** :definition: the label of the block **SIZE** :definition: the size of the block bundle :type: constant integer port (CIP) ---- Shorthand Declaration ===================== :: # constant block Boolean >> LABEL; # constant block bundle BooleanList >> LABEL; **LABEL** :definition: the label of the block **Boolean** :definition: :ref:`on ` or :ref:`off ` **BooleanList** :definition: a list of :ref:`on ` and :ref:`off ` ---- Ports Table =========== +------+-------------+-----------+------+------------+------------+-----------------+---------------+ | | | | | | | | | +------+-------------+-----------+------+------------+------------+-----------------+---------------+ | Port | Name | Direction | Type | Connection | Access | Default | Required | +======+=============+===========+======+============+============+=================+===============+ | 1 | input | input | CBP | single | >> LABEL | ``none`` | no :sup:`(1)` | | | | | | +------------+ | | | | | | | | assignment | | | +------+-------------+-----------+------+------------+------------+-----------------+---------------+ | 2 | output | output | CBP | multiple | LABEL >> | ``none`` | no :sup:`(1)` | | | | | | +------------+ | | | | | | | | assignment | | | +------+-------------+-----------+------+------------+------------+-----------------+---------------+ | 3 | ``default`` | input | CBP | single | property | ``off`` | yes | +------+-------------+-----------+------+------------+------------+-----------------+---------------+ | 4 | ``reset`` | input | CBP | single | property | ``MasterReset`` | yes | +------+-------------+-----------+------+------------+------------+-----------------+---------------+ | 5 | ``meta`` | input | CSP | single | property | ``none`` | no | +------+-------------+-----------+------+------------+------------+-----------------+---------------+ :CBP: constant boolean port :CSBP: control stream boolean port :CSP: constant string port :LABEL: block label :sup:`1` Warning issued during compilation if the port is left unconnected. ---- Description =========== Switches are asynchronous blocks. They propegate the rate ``none`` upstream. ---- Code Examples ============= :: switch Switch { default: off reset: MasterReset meta: 'A switch' } # Shorthand off >> Switch; :: switch SwitchBundle [2] { default: off reset: MasterReset meta: 'A switch' } # Shorthand [off, off] >> SwitchBundle;