#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/Decode3/Decode3"
#USE "/home/amu5/users/georget/Phd/Simul/DatInt/DatInt"


PROC Process3(CHAN OF LINK.TO.LINK to.process.1, from.process.1,
              to.process.2, from.process.2, to.process.5, from.process.5, 
              to.process.6, from.process.6,
              VAL INT report, evaluation, preemption)


  CHAN OF BUNDLE  MrrAin,MEMad, MEMd, MEMc, MemDabt0,MemDabt1,MrrDin,
                  MrrPAbtin,MEMa,ToWrCtrlD1,ToWrCtrlD2,FDatInta,FDatIntb,
                  FWctrlA,ToDatInt,FAddIntD,FAddIntC, ToAddIntA,AIDabt0,FromDec1D,
                  Dec1ToIpA,FDec3PCp,ToCPsr,ToOplatA,ToOplatB,ALUgo,ToDec1A,IpToDec1a,
                  IpToDec1b,FDatIntAc,FromCPsrA,FromOplat,Ctrl3Alx,ToDatIntA,
                  ToDatIntBw,ToDatIntMb:


  [20]CHAN OF BUNDLE b.sink:
  [7]CHAN OF DEB.MESSAGE  d.sink:


  CHAN OF DEB.MESSAGE datint.monitor, dec3.monitor:
  [15]CHAN OF DEB.MESSAGE screen:



  SEQ
    PAR
 
      Decode3 (FromDec1D,ToDec1A,MemDabt0,MemDabt1,AIDabt0,
            Ctrl3Alx,ALUgo,ToOplatA,ToOplatB,
            FromOplat,ToCPsr,FromCPsrA,ToWrCtrlD1,
            ToWrCtrlD2,FWctrlA,FDec3PCp,                       
             [screen FROM 0 FOR 8], report, evaluation, preemption)   

      DatInt (ToDatIntMb,ToDatIntBw, FDatIntAc, MrrDin, 
            MrrPAbtin, MrrAin,IpToDec1a,IpToDec1b, 
            Dec1ToIpA, FDatInta,FDatIntb, ToDatIntA, 
            FAddIntD, FAddIntC, MEMad, MEMd, MEMc, MEMa,ToAddIntA,                       
             [screen FROM 8 FOR 4], report, evaluation)

      monitor([screen FROM 0 FOR 8], dec3.monitor,report, evaluation)

      monitor([screen FROM 8 FOR 4],datint.monitor,report, evaluation)

      ------------------------link 0  to/from Process6----------------------------

      --3-->6:MrrAin,MEMad, MEMd, MEMc

      --6-->3:MemDabt0,MemDabt1,MrrDin,MrrPAbtin,MEMa

      multiplexor([MrrAin,MEMad, MEMd, MEMc], [d.sink[0]], to.process.6)
      demultiplexor(from.process.6, [MemDabt0,MemDabt1,MrrDin,MrrPAbtin,MEMa,b.sink[0],b.sink[1],b.sink[2],b.sink[3]], [d.sink[1]])
      -----------------------------------------------------------------------------
      ------------------------link 2  to/from Process5----------------------------

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

      multiplexor([ToWrCtrlD1,ToWrCtrlD2,FDatInta,FDatIntb],[dec3.monitor,datint.monitor], to.process.5)
      demultiplexor(from.process.5, [FWctrlA,ToDatIntA,b.sink[4],b.sink[5],b.sink[6],b.sink[7],b.sink[8],b.sink[9],b.sink[10]], [d.sink[2]])
      -----------------------------------------------------------------------------
      ------------------------link  3 to/from Process2----------------------------

      --2-->3:FAddIntD,FAddIntC,
      --3-->2:ToAddIntA,AIDabt0,

      multiplexor([ToAddIntA,AIDabt0], [d.sink[3]], to.process.2)
      demultiplexor(from.process.2, [FAddIntD,FAddIntC,b.sink[11],b.sink[12],b.sink[13],b.sink[14],b.sink[15],b.sink[16],b.sink[17]], [d.sink[4]])
      -----------------------------------------------------------------------------
      ------------------------link 1 to/from Process1----------------------------

      --1-->3 :FromDec1D,Dec1ToIpA,ToCPsr,ToOplatA,ToOplatB,
      --         ToDatIntBw,ToDatIntMb
      --3-->1 :ALUgo,ToDec1A,IpToDec1a,IpToDec1b,FDatIntAc,FromCPsrA,
      --         FromOplat,Ctrl3Alx

      multiplexor([ALUgo,ToDec1A,IpToDec1a,IpToDec1b,FDatIntAc,FromCPsrA,
               FromOplat,Ctrl3Alx,FDec3PCp], [d.sink[5]], to.process.1)
      demultiplexor(from.process.1, [FromDec1D,Dec1ToIpA,ToCPsr,ToOplatA,ToOplatB,
               ToDatIntBw,ToDatIntMb, b.sink[18],b.sink[19]], [d.sink[6]])
      -----------------------------------------------------------------------------
:


    


