module Generator title 'Generator' "Version 1: This code mimics a Message Decoder. It generates messages rapidly" "so we can test the transfer of messages between the Message Detector and the" "Message Router." "Based upon P3007C07." "Inputs" Q pin; "Demodulator Output" CNT pin; "Continute" CK pin; "Clock, 40 MHz" RST pin; "Reset" S pin; "Shift" "Outputs" RDY pin istype 'com,keep'; "Message is Ready" M pin istype 'com'; "Serial Message Bit" declarations RVS4..RVS0 node istype 'reg'; "Receiver State" rvs=[RVS4..RVS0]; RVD19..RVD0 node istype 'reg'; "Receiver Data" rvd=[RVD19..RVD0]; equations declarations generator_id = 3; equations rvs.clk = CK; rvs.aclr = RST; when (rvs<=30) then rvs:=rvs+1; when (rvs==31) then { when CNT then rvs:=0 else rvs:=31; } rvd.clk = CK; rvd.aclr = RST; when (rvs == 0) then { [RVD19..RVD16] := generator_id; [RVD15..RVD0] := [RVD15..RVD0] + 1; } when (rvs>=1) & (rvs<=30) then { rvd := rvd; } when (rvs == 31) then { when S then rvd:=[RVD18..RVD0,RVD19] else rvd := rvd; } RDY = (rvs == 31); M = RVD19; end