#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/Dec1/Dec1"
#USE "/home/amu5/users/georget/Phd/Simul/Decode2/Decode2"
#USE "/home/amu5/users/georget/Phd/Simul/IMMPipe/IMMPipe"

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

  CHAN OF BUNDLE  ToImmD,Dec1NG, FromImmA, NGDec1A, Dec1Dec2,
                  Dec2Dec1A, FromDec1D, FromImm,ToImm,Dec1ToIpA,FDec3PCp,
                  ToCPsr,ToOplatA,ToOplatB,ToDatIntBw,ToDatIntMb,ALUgo,ToDec1A,IpToDec1a,
                  IpToDec1b, FDatIntAc, FromCPsrA, FromOplat,Ctrl3Alx,Dec1toXPD, 
                  ToAddIntD, Dec1PCA, Dec1XLA, ToApipe, XPtoDec1A, FrAddIntA,
                  PCToDec1, XLtoDec1D, FromApipe,ToRegBI,ToRegBPC,ToRegack,
                  FromRGA,FromRegA,FromRegB:

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


  CHAN OF DEB.MESSAGE dec1.monitor, dec2.monitor:
  [20]CHAN OF DEB.MESSAGE screen:
 

  SEQ

    PAR

      Dec1 (ToRegBI,ToRegBPC,FromRGA,ToImmD,Dec1toXPD,
           Dec1NG,FromImmA,XPtoDec1A,NGDec1A,ALUgo,
           ToAddIntD,FrAddIntA,Dec1Dec2,Dec2Dec1A,FromDec1D,ToDec1A,
           IpToDec1a,IpToDec1b,Dec1ToIpA,PCToDec1,Dec1PCA,
           XLtoDec1D,Dec1XLA,FDec3PCp,                       
           [screen FROM 0 FOR 6], report, evaluation,preemption)  
    
      Decode2 (FromRegA,FromRegB,FromApipe,FDatIntAc,FromCPsrA,
             FromOplat,FromImm,ToApipe,ToDatIntBw,ToDatIntMb,ToCPsr,
             ToOplatB, ToOplatA,ToRegack,ToImm,Dec1NG,Dec1Dec2,
             NGDec1A,Dec2Dec1A,Ctrl3Alx,                       
             [screen FROM 6 FOR 10], report, evaluation) 

      IMMPipe( ToImmD, FromImm, FromImmA,ToImm )

      monitor([screen FROM 0 FOR 6],dec1.monitor, report, evaluation)   --monitor process for Dec1
   
      monitor([screen FROM 6 FOR 10], dec2.monitor, report, evaluation)   --monitor process for Decode2

      ------------------------link 0 to/from Process3----------------------------

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

      multiplexor([FromDec1D,Dec1ToIpA,ToCPsr,ToOplatA,ToOplatB,
                  ToDatIntBw,ToDatIntMb], [d.sink[0]], to.process.3)  --link  0 to Process3

      demultiplexor(from.process.3, [ALUgo,ToDec1A,IpToDec1a,IpToDec1b,
                    FDatIntAc,FromCPsrA,FromOplat,Ctrl3Alx,FDec3PCp], [d.sink[1]])  --link 0 from Process3
      --------------------------------------------------------------------------

      ------------------------link 1 to/from Process2 ----------------------------

      --1-->2: Dec1toXPD, ToAddIntD, Dec1PCA, Dec1XLA, ToApipe, 
      --2-->1: XPtoDec1A, FrAddIntA, PCToDec1, XLtoDec1D, FromApipe,


      multiplexor([Dec1toXPD, ToAddIntD, Dec1PCA, 
                   Dec1XLA, ToApipe], [d.sink[2]], to.process.2) --link 1 to Process2

      demultiplexor(from.process.2, [XPtoDec1A, FrAddIntA, 
                    PCToDec1, XLtoDec1D, FromApipe, b.sink[0], b.sink[1], b.sink[2], b.sink[3] ], [d.sink[3]])  --link 1 from Process2
      ----------------------------------------------------------------------------

      ------------------------link 2 to/from Process4 ----------------------------
      --1-->4: ToRegBI,ToRegBPC,ToRegack
      --4-->1:FromRGA,FromRegA,FromRegB

      multiplexor([ToRegBI,ToRegBPC,ToRegack], [d.sink[4]], to.process.4)  --link  2 to Process4

      demultiplexor(from.process.4, [FromRGA,FromRegA,FromRegB,b.sink[4] ,b.sink[5],b.sink[6],b.sink[7],b.sink[8],b.sink[9]], [d.sink[5]])  --link 2 from Process4
      ------------------------------------------------------------------------------

      ------------------------link 3 to the outside world ----------------------------

      multiplexor([b.sink[10]],[dec1.monitor,dec2.monitor], to.process.7)  --link  3 
      


:

      
   
      
