#INCLUDE "/home/amu5/users/georget/Phd/Simul/Defs/defs.inc"

#USE "/home/amu5/users/georget/Phd/Simul/library"
#USE "/home/amu5/users/georget/Phd/Simul/WrtCtrl/WrtCtrl"

PROC Process5(CHAN OF LINK.TO.LINK  to.process.2, from.process.2,
                                    to.process.4, from.process.4,
                                    to.process.3, from.process.3,
                                    to.process.7,
              VAL INT report,evaluation, preemption)



  CHAN OF BUNDLE  FAddIntA,FAdInWlx,ToAddInta,ToAddIntb,FRegBA,FWCtrlD,FWCtrlC,
                  ToWrCtrlD1,ToWrCtrlD2,FDatInta,FDatIntb,FWctrlA,ToDatIntA:

 
  [21]CHAN OF BUNDLE b.sink:
  [6]CHAN OF DEB.MESSAGE  d.sink:

  CHAN OF DEB.MESSAGE wrtctrl.monitor,from.monit.2, from.monit.3 :
  [15]CHAN OF DEB.MESSAGE screen:


  SEQ
    PAR


      WrtCtrl (ToWrCtrlD1,ToWrCtrlD2, FAddIntA,FAdInWlx,
            FRegBA,FDatInta,FDatIntb,ToAddInta,ToAddIntb,
            FWCtrlD, FWCtrlC,FWctrlA,ToDatIntA,                       
             [screen FROM 0 FOR 3] ,report, evaluation, PREEMPTION.ON)  
      monitor([screen FROM 0 FOR 3], wrtctrl.monitor, report,evaluation)

      ------------------------link 0 to/from Process2----------------------------

      --2-->5:FAddIntA,FAdInWlx
      --5-->2:ToAddInta,ToAddIntb,

      multiplexor([ToAddInta,ToAddIntb],[d.sink[0]],to.process.2)
      demultiplexor(from.process.2, [FAddIntA,FAdInWlx,b.sink[0],b.sink[1],b.sink[2],b.sink[3],b.sink[4],b.sink[5],b.sink[6]],[from.monit.2])
      -------------------------------------------------------------------------
  
      ------------------------link 1 to/from Process4----------------------------
      --4-->5:FRegBA
      --5-->4:FWCtrlD,FWCtrlC

      multiplexor([FWCtrlD,FWCtrlC], [d.sink[2]], to.process.4)
      demultiplexor(from.process.4, [FRegBA,b.sink[7],b.sink[8],b.sink[9],b.sink[10],b.sink[11],b.sink[12],b.sink[13],b.sink[14]], [d.sink[3]])
      -------------------------------------------------------------------------
  
      ------------------------link 3 to/from Process3----------------------------

      --3-->5:ToWrCtrlD1,ToWrCtrlD2,FDatInta,FDatIntb
      --5-->3:FWctrlA,ToDatIntA
 

      multiplexor([FWctrlA,ToDatIntA],[d.sink[4]],to.process.3)
      demultiplexor(from.process.3, [ToWrCtrlD1,ToWrCtrlD2,FDatInta,FDatIntb,b.sink[15],b.sink[16],b.sink[17],b.sink[18],b.sink[19]], [from.monit.3])
      -------------------------------------------------------------------------
  
      ------------------------link 2 to the outside world----------------------------
      multiplexor([b.sink[20]],[wrtctrl.monitor,from.monit.2, from.monit.3], to.process.7)
      -------------------------------------------------------------------------
:
  
