Expression
Component Type: Program
Status: Implemented
Overview
CProgExpression applies a configurable arithmetic operation to a single input with a constant operand, writing the result to an output IO.
Supported operations:
Op code |
Behaviour |
|---|---|
|
|
|
|
|
|
|
|
|
|
Implementation
Callback-driven (CProgProcess-based), no thread.
The operation and constant are configured as a 2-word array
[op_type, constant].
Configuration
Kconfig
CONFIG_DAWN_PROG_EXPRESSION: enables the program.
YAML
programs:
# Compute 1 << p1 (constant left-shift, used to select an LED):
- id: expr_led_select
type: expression
config:
sources: [virt_p1]
outputs: [expr_out]
op: [2, 1] # OP_CONST_LEFT_SHIFT, constant = 1
Brainstorming & Future Ideas
Two-input variant: accept two runtime values and apply the operation between them (e.g.
a << bwhere bothaandbcome from separate inputs).