Snowmaking Monitor
A ski resort's snow cannons only pay off below a cutoff temperature, so the slope station works in signed whole °C. The forecast unit supplies the expected drift over the next hour. Your monitor predicts the next reading, measures how far the slope sits from the cutoff, and raises two flags. None of these results may ever wrap, whatever the inputs.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
temp_i | in | 8-bit signed | Measured slope temperature |
rise_i | in | 8-bit signed | Forecast drift for the next hour (may be negative) |
ref_i | in | 8-bit signed | Snowmaking cutoff temperature |
next_o | out | 9-bit signed | Predicted temperature: temp_i + rise_i |
dev_o | out | 9-bit signed | Distance from the cutoff: temp_i − ref_i |
warm_o | out | 1 bit | High when temp_i is strictly above ref_i: pause the cannons |
thaw_o | out | 1 bit | High when next_o is at or above 0 °C: the slope starts thawing |
Behavior
next_ois the full 9-bit sum oftemp_iandrise_i; extreme pairs like 100 + 90 or −100 + −90 must come out exact, never wrappeddev_ois the full 9-bit differencetemp_i−ref_i; extremes like 120 − (−120) = 240 must come out exactwarm_ois high exactly whentemp_i>ref_i; attemp_i=ref_iit stays lowthaw_ois high exactly whennext_o≥ 0; a predicted 0 °C already counts as thawing- All comparisons are signed: −1 is below 0, not above 255. The testbench includes pairs that expose an unsigned misreading
Constraints
OPERATORS: only
+,-, and relational operators; widen withresize.
- One assignment outside a procedural block per output; no procedural blocks
- Route each comparison with the
'1' when ... else '0'recipe
Loading editor...
Click Run to execute your code. Output will appear here.