# File: twavg.src
#
program "%Z% MODULE: %M% RELEASE: %R%.%L% CREATED: %G% %U%"
source "/mdisw/cfl/eof/src/twavg.src"
descr  "twavg  - load TWA instruction test macro"
#
# DSBQUE                ; Disable Queue
tcblock mbipldin 0x0154 
#
#=======================================================
#
#
# ; IP program to test time weighted averaging.
# ;
# ; EXTRACT central 128 X 128 area
# ;    SETREGS  R69  2  0  0
# ;    Source:     P = 0,  Offset = 475988
# ;    Dest.:      P = 1,  Offset = 0
# ;    X-Length:     128
# ;    Y-Length:     128
# ;    Row Length:  1040
# ;    Global Reg.:   69
# ;
# ;    Downlink the extracted image
# ;    Apply Time weighted averaging 12 times to the extracted image.
# ;    Downlink the weighted data.
# ;
#      SETREGS  R69  2  0  0
tcblock mbipcmd 0x0091 0x0100   0x01B2 0x0045 0x0002 0x0000 \
                                0x0000 
# ;
#      SETREGS  R800  8  0x4354 0x0007  0 0x0800  128 128 1040  R69
tcblock mbipcmd 0x0091 0x0105   0x01B2 0x0320 0x0008 0x4354 \
                                0x0007 0x0000 0x0800 0x0080 \
                                0x0080 0x0410 0x0045 
#      EXTRACT  R800
tcblock mbipcmd 0x0091 0x0110   0x017A 0x0320 
#      MOVBLK      0  0x0800   0x0226  0x4000   16384  0
tcblock mbipcmd 0x0091 0x0112   0x0164 0x0000 0x0800 0x0226 \
                                0x4000 0x4000 0x0000 
# ;
#      SETREGS  R808  6  0x0000 0x0000  0x4000      0  0xFFFF 0xFF15
tcblock mbipcmd 0x0091 0x0119   0x01B2 0x0328 0x0006 0x0000 \
                                0x0000 0x4000 0x0000 0xFFFF \
                                0xFF15 
#      HRDINIT  R808
tcblock mbipcmd 0x0091 0x0122   0x019C 0x0328 
# ;
#      SETREGS  512  2  17000  0
tcblock mbipcmd 0x0091 0x0124   0x01B2 0x0200 0x0002 0x4268 \
                                0x0000 
#      START1HR 3  0x4000  R512
tcblock mbipcmd 0x0091 0x0129   0x0174 0x0003 0x4000 0x0200 
# ;
#      END
tcblock mbipcmd 0x0091 0x012D   0x01FC 
# ;........................................................... 
# ;
# ;
# ; This program applies the weights to an image which has been extracted
# ; into page 1, offset 0. On the 12th call it downlinks the sum of 
# ; weighted data.
# ;
# ;    Source:             1  Page
# ;                        0  Offset 
# ;    Buffer:            17  Page
# ;                        0  Offset  (8-Byte EDAC Memory)
# ;    Dest.:             17  Page
# ;                    32768  Offset  (8-Byte EDAC Memory)
# ;    Count:          16384    
# ;    Wt. Tbl:          950
# ;    Index:              0
# ;    Max Index:         12
# ;    Shift Count:        8
# ;
#     SETREGS  R950 12  8 10 14 21 28 33 36 33 28 21 14 10 
tcblock mbipcmd 0x0091 0x012E   0x01B2 0x03B6 0x000C 0x0008 \
                                0x000A 0x000E 0x0015 0x001C \
                                0x0021 0x0024 0x0021 0x001C \
                                0x0015 0x000E 0x000A 
#     SETREGS  R900 12  0 0x0800 0 0x8800 32768 0x8800 16384 0 R950 0 12 8
tcblock mbipcmd 0x0091 0x013D   0x01B2 0x0384 0x000C 0x0000 \
                                0x0800 0x0000 0x8800 0x8000 \
                                0x8800 0x4000 0x0000 0x03B6 \
                                0x0000 0x000C 0x0008 
#     
#     TWAVG    R900
tcblock mbipcmd 0x0091 0x014C   0x01CE 0x0384 
# ;
#     BRNCHIF  R909  &DWNLNK
tcblock mbipcmd 0x0091 0x014E   0x015A 0x038D 0x0152 
# ;
#     END
tcblock mbipcmd 0x0091 0x0151   0x01FC 
# ;
# DWNLNK:
#     MOVBLK   32768  0x8800  0x0226  0x4000  16384 0
tcblock mbipcmd 0x0091 0x0152   0x0164 0x8000 0x8800 0x0226 \
                                0x4000 0x4000 0x0000 
#     SETREGS  R816  6  0x0000 0x0000  0x4000      0  0xFFFF 0xFF15
tcblock mbipcmd 0x0091 0x0159   0x01B2 0x0330 0x0006 0x0000 \
                                0x0000 0x4000 0x0000 0xFFFF \
                                0xFF15 
#     HRDINIT  R816
tcblock mbipcmd 0x0091 0x0162   0x019C 0x0330 
# 
#     SETREGS  R512  2  17000  0
tcblock mbipcmd 0x0091 0x0164   0x01B2 0x0200 0x0002 0x4268 \
                                0x0000 
#     START1HR 3  0x4000  R512
tcblock mbipcmd 0x0091 0x0169   0x0174 0x0003 0x4000 0x0200 
#     END
tcblock mbipcmd 0x0091 0x016D   0x01FC 
# ;----------------------------------------------------------
#=======================================================
#
# ENBQUE                ; Enable Queue
tcblock mbipldin 0x0136
#
#
return
#
#=======================================================
