-- NewFIFODriver.sak -- last edited by Suzuki: 28-Nov-81 22:45:19 DIRECTORY FIFO, SakuraRT, SimIO; NewFIFODriver: MONITOR IMPORTS FIFO, SakuraRT, SimIO = { Reader: DEVICE = { IN DataAv: BOOLEAN, DataOut: CARDINAL OUT ReadReq: BOOLEAN GUARDIAN {} CONTROL { data: CARDINAL; SimIO.WF0[" Reader started.*n"]; THROUGH [0..30) DO SakuraRT.Delay[20]; UNTIL DataAv=TRUE DO SakuraRT.StandardDelay[] ENDLOOP; ReadReq _ TRUE; data _ DataOut; SimIO.WF1["%u ", @data]; SakuraRT.Delay[10]; ReadReq _ FALSE; ENDLOOP; SimIO.WF0[" Reader terminated.*n"]} }; Writer: DEVICE = { IN SpaceAv: BOOLEAN OUT WriteReq: BOOLEAN, DataIn: CARDINAL GUARDIAN {} CONTROL { i: CARDINAL; SimIO.WF0[" Writer started.*n"]; FOR i IN [0..30) DO SakuraRT.Delay[20]; UNTIL SpaceAv=TRUE DO SakuraRT.StandardDelay[] ENDLOOP; DataIn _ i; WriteReq _ TRUE; SimIO.WF1["%u- ", @i]; SakuraRT.Delay[10]; WriteReq _ FALSE; ENDLOOP; SimIO.WF0[" Writer terminated.*n"]} }; Start: DEVICE = { IN OUT Init, ReadReq, WriteReq: BOOLEAN GUARDIAN {} CONTROL { ReadReq _ FALSE; WriteReq _ FALSE; SakuraRT.Delay[10]; Init _ TRUE; SakuraRT.Delay[5]; Init _ FALSE} }; SimIO.Start[]; CIRCUIT { COMPONENTS fifo: FIFO.FIFOFunc[size: 100], reader: Reader, writer: Writer, start: Start NODES init, write, read, in, space, data, out: NODE REPRESENTATION CONNECTIONS fifo[Init: init, WriteRequest: write, ReadRequest: read, DIn: in, SpaceAv: space, DataAv: data, DOut: out], reader[DataAv: data, DataOut: out, ReadReq: read], writer[SpaceAv: space, WriteReq: write, DataIn: in], start[Init: init, ReadReq: read, WriteReq: write]}; SimIO.Stop[]; }.