Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
language:langs:chp [2023/04/09 23:28] – [Arrays: dynamic v/s non-dynamic indices] rajit | language:langs:chp [2025/05/01 17:04] (current) – [Debugging during simulation] rajit | ||
---|---|---|---|
Line 156: | Line 156: | ||
===== Advanced expression syntax ===== | ===== Advanced expression syntax ===== | ||
+ | |||
+ | ==== Bitslice assignment ==== | ||
+ | |||
+ | For integer-valued variables, one can assign to some of the bits. The syntax for this is: | ||
+ | |||
+ | <code act> | ||
+ | | ||
+ | ... | ||
+ | chp { | ||
+ | ... | ||
+ | x{4..2} := 4; | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | This will update three bits of '' | ||
+ | |||
+ | |||
==== Channels in expressions ==== | ==== Channels in expressions ==== | ||
Line 313: | Line 330: | ||
</ | </ | ||
where '' | where '' | ||
+ | |||
+ | ===== Debugging and other support functions for simulation ===== | ||
+ | |||
+ | When running CHP simulations, | ||
+ | |||
+ | <code act> | ||
+ | ... | ||
+ | chp { | ||
+ | ... | ||
+ | log (" | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | The statement above will display '' | ||
+ | |||
+ | <code act> | ||
+ | int x; | ||
+ | ... | ||
+ | chp { | ||
+ | ... | ||
+ | log (" | ||
+ | log ("%x This is hex: ", x+3); | ||
+ | log ("%b This is binary", | ||
+ | ... | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Booleans are displayed as integers, with '' | ||
+ | |||
+ | Other support functions of this type are: | ||
+ | * '' | ||
+ | * '' | ||
+ | * In the standard '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | |||
====== The chp-txt sublanguage ====== | ====== The chp-txt sublanguage ====== |