
#INCLUDE "Regbankdefs.inc"

PROC addrinput  (CHAN OF INPUT indata,
               CHAN OF INT WBus,ABus,BBus,
               CHAN OF BOOL Ma,               
               CHAN OF ANY Ack,Noread)

  #USE "string.lib"

  [MAXDATA]BOOL Main:
  [MAXDATA]INT Waddr, Aaddr, Baddr:
  
  INT i, num.of.data,mfifo:
  BOOL any,more.data,ok: 
  
  SEQ
    num.of.data:=0
    ok:=TRUE
    more.data:=TRUE
    WHILE more.data
      SEQ
        indata?CASE
          data;Waddr[num.of.data]
            SEQ
              indata?CASE data;Aaddr[num.of.data]
              indata?CASE data;Baddr[num.of.data]
              indata?CASE data;mfifo              
              IF
                mfifo = 0
                  Main[num.of.data]:=FALSE
                TRUE
                  Main[num.of.data]:=TRUE
              num.of.data:=num.of.data+1
          end.of.data
            more.data:=FALSE

    SEQ i=0 FOR num.of.data
      SEQ
        PAR
          IF
            Aaddr[i]= (-1)
              Noread!any
            TRUE
              PAR
                BBus!Baddr[i]           
                ABus!Aaddr[i]
          WBus!Waddr[i]
          Ma!Main[i]
        Ack?any
:

                
               

