--Configuration for MU T-rack (first rack) with some switched links installed
--P.C.Capon 22/3/92

VAL K IS 1024 :
VAL M IS K * K:
VAL rack.transputers IS 64:
VAL rack2M.transputers IS 20: --20 rack transputers with 2 Mbytes
NODE tadpole,control:
[64] NODE rack:
[5] NODE graph:
ARC tosun:
--Rack ids of leaf transputers connected to graphics
--Here because used in hardware and software configuration
VAL leaf.transputer.ids IS [63, 61, 60, 59,
                            53, 52, 51, 49,
                            48, 46, 45, 44,
                            38, 37, 36, 34] :

NETWORK transputer.rack
  DO
    SET tadpole (type,memsize := "T414",1*M)
    SET control (type,memsize := "T414",1*M)
    DO i = 0 FOR rack2M.transputers
      SET rack[i] (type, memsize := "T800",2*M)
    DO i = rack2M.transputers FOR rack.transputers - rack2M.transputers
      SET rack[i] (type, memsize := "T800",1*M)
    SET graph[0] (type, memsize := "T800", 4*K)
    DO i = 1 FOR 4
      SET graph[i] (type, memsize := "T800",1*M)

    CONNECT tadpole[link][0] TO HOST WITH tosun
    CONNECT tadpole[link][1] TO control[link][0]
    CONNECT tadpole[link][3] TO rack[0][link][0]
    CONNECT tadpole[link][2] TO rack[63][link][1]
    DO i = 0 FOR rack.transputers - 1
      CONNECT rack[i][link][1] TO rack[i+1][link][0]

    -- hardware description of switched link connections
    -- table giving for each transputer i the destination transputer
    -- of the link2 to link3 connection 
    VAL three.in IS [-1,-1,-1,-1,-1,-1,-1,-1,
                     -1,56,-1,-1,-1,-1,-1,-1,
                     -1,-1,-1,-1,-1,-1,-1,-1,
		     -1,-1,-1,-1,-1,-1,-1,-1,
                     -1,-1,-1,40,-1,-1,-1,37,
                     -1, 9,47,-1,-1,43,-1,-1,
                     -1,-1,55,-1,-1,-1,52,-1,
                     -1,62,-1,-1,58,-1,-1,-1]:
    DO i = 0 FOR rack.transputers
      IF
        three.in[i] <> (-1)
          CONNECT rack[i][link][2] TO rack[three.in[i]][link][3]
        TRUE
          SKIP
    -- hardware description of switched connections to graphics
    -- table giving the link  used to connect each leaf transputer
    -- to the graphics.

    VAL links.to.graph IS [2, 2, 3, 3,
                           2, 2, 3, 3,
                           2, 2, 3, 3,
                           2, 2, 3, 3] :

    DO i = 0 FOR 16
      CONNECT rack[leaf.transputer.ids[i]][link][links.to.graph[i]] TO
        graph[(i+4)/4][link][i\4]
    CONNECT rack[8][link][2] TO graph[0][link][0]
:
--Software configuration for flight Demonstration

#USE "initialise.c8h"
#USE "datagen.c8h"
#USE "cliphither.c8h"
#USE "clipyon.c8h"
#USE "cliptop.c8h"
#USE "clipbottom.c8h"
#USE "clipleft.c8h"
#USE "clipright.c8h"
#USE "perspectivet.c8h"
#USE "shade.c8h"
#USE "split.c8h"
#USE "hse.c8h" --full triangle filling
--#USE "hsefast.c8h" --For fast wire frame triangle drawing
#USE "graphdraw.c8h"
VAL sqno IS 80 :   -- ******* 0.5*SQRT(Number of squares in sphere)
                   -- No More Than 80

-- Clip parameters
VAL hither IS 0 :  -- Yon clipping
VAL yon    IS 500000 : -- Distance Clipping


-- Perspective parameters
VAL screendist IS 8000 : -- Distance from eye to screen


-- Shader parameters
VAL vertang  IS 30 :
VAL horizang IS 0 :  --lightsorce angles
VAL depth  IS 20000 : -- Maximum depth for shading
VAL ambient IS 40 : -- % of Ambient light


---  channels
[17]CHAN OF ANY neckout, neckin, to.gb :
[31]CHAN OF ANY down.tree :
VAL segsize IS 31:

---  vectors
VAL treeids IS [ 9,
                56, 41,
                57, 55, 42, 40,
                62, 58, 54, 50, 47, 43, 39, 35] :

VAL splitpos IS [8*segsize,
                 4*segsize, 12*segsize,
                 2*segsize, 6*segsize,10*segsize, 14*segsize,
                 1*segsize, 3*segsize,5*segsize, 7*segsize,
                 9*segsize, 11*segsize,13*segsize, 15*segsize]:

CONFIG
  PAR
    PROCESSOR tadpole
      SKIP
  
    ---  TRIG GENERATE T800 3
    PROCESSOR rack[0]
      TRIG (neckout[0],
          neckout[0+1],
           neckin[0],
          neckin [0+1],
                 sqno)   -- square number
    
    ---  CLIP STAGES T800's
    PROCESSOR rack[1]
      CLIPHITHER (neckout[1], neckout[1+1],
                hither)
  
    PROCESSOR rack[2]
      CLIPYON (neckout[2], neckout[2+1],
             yon)
  
    PROCESSOR rack[3]
      CLIPTOP (neckout[3], neckout[3+1],
             screendist)
  
    PROCESSOR rack[4]
      CLIPBOTTOM (neckout[4], neckout[4+1],
             screendist)
  
    PROCESSOR rack[5]
      CLIPLEFT (neckout[5], neckout[5+1],
             screendist)
  
    PROCESSOR rack[6]  
      CLIPRIGHT (neckout[6], neckout[6+1],
             screendist)
    
    ---  PERSPECTIVE T800
    PROCESSOR rack[7]  
      XFORM (neckout[7], neckout[7+1],
          screendist)
  
    ---  SHADE T800
    PROCESSOR rack[8]
      SHADE (neckout[8],
        down.tree[0],
           to.gb[16],
                 vertang,
                 horizang,
                 depth,
                 ambient)
  
    ---  SPLIT tree nodes
    PAR i = 0 FOR 15
      PROCESSOR rack[treeids[i]]
        SPLIT (down.tree[i],
             down.tree[(2 * i) + 1],
             down.tree[(2 * i) + 2],
             --up.tree[i],
             --up.tree[(2 * i) + 1],
             --up.tree[(2 * i) + 2],
             splitpos[i])
  
  
    ---  HSE leaves
    PAR i = 0 FOR 16
      PROCESSOR rack[leaf.transputer.ids[i]]
        HSE (down.tree[i+15] ,
            to.gb[i],
            (segsize*i),((segsize*(i+1))-1))
  
  
      ---  Humphrey's Graphics Board

    PROCESSOR graph[0]
      initialise (to.gb[16])

    PROCESSOR graph[1]
      GraphDraw(to.gb[0],
        to.gb[1],
        to.gb[2],
        to.gb[3],
              0)

    PROCESSOR graph[2]
      GraphDraw(to.gb[4],
        to.gb[5],
        to.gb[6],
        to.gb[7],
              1)
  
    PROCESSOR graph[3]
      GraphDraw(to.gb[8],
        to.gb[9],
        to.gb[10],
        to.gb[11],
              2)
  
    PROCESSOR graph[4]
      GraphDraw(to.gb[12],
        to.gb[13],
        to.gb[14],
        to.gb[15],
              3)
  
:
  
