SpinalHDL
1 / 1
View past submissionsLeaderboard

Description

The Reactor Is Not Our Product

A surplus dealer stripped the cooling computer from your reactor, then claimed it was "never included in the product." The pumps, evacuation siren, and four-state temperature sensor still work. Build the controller that lets the facility switch on the reactor without cooking everyone inside.

The cooling controller receives one temperature classification per cycle:

  • 0: cold
  • 1: normal
  • 2: warm
  • 3: critical

The cooling system starts off. A warm sample turns cooling on, a cold sample turns it off, and a normal sample leaves it unchanged. A critical sample turns cooling on and permanently latches the evacuation alarm for the remainder of the stream.

Hardware I/O Encoding

  • temperature is a stream of unsigned 2-bit values with at most 64 elements
  • each output element is (cooling, evacuate)
  • both output fields are unsigned 1-bit values
  • the output reflects the state after processing the corresponding sample

Example

Input [0, 2, 1, 0, 3, 0] produces [(0, 0), (1, 0), (1, 0), (0, 0), (1, 1), (0, 1)].

Input

temperature

Stream of 2-bit Unsigned Integer (up to 64 elements)
Temperature class: cold, normal, warm, or critical.

Output

Stream of 1-bit Unsigned Integer Pair
Cooling and latched evacuation states after each sample.