module Indicator title 'Indicator' "Version 3: This module provides a fixed-length pulse on its ON output" "in response to a single pulse on its FLASH input. After the first pulse" "on FLASH, the module provides an ON pulse that is exactly two CK periods" "long, unless FLASH occurs again during the ON pulse, in which case the" "pulse is aborted and the process starts again. The delay between the" "FLASH pulse and the start of the ON pulse is less than one CK period." "Inputs and Outputs" "------------------" declarations CK pin; "The ON pulse will endure for one period of this clock." FLASH pin; "A pulse on this input will cause the lamp to flash." ON pin istype 'com'; "The output to an LED or a transistor." equations "Workings" "--------" declarations C0..C1 node istype 'reg'; "Counter Bits" counter = [C1..C0]; equations "The counter counts down to zero after it is preset." counter.clk = CK; counter.ap = FLASH; when (counter > 0) then counter := counter-1; else counter := 0; "The ON pulse endured while counter is 2 or 1, which is for two" "cycles of CK." ON = (counter == 1); end