OpenCores
URL https://opencores.org/ocsvn/xgate/xgate/trunk

Subversion Repositories xgate

[/] [xgate/] [trunk/] [sw/] [xgate_test_code/] [debug_test/] [debug_test.s] - Diff between revs 16 and 52

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 16 Rev 52
; 345678901234567890123456789012345678901234567890123456789012345678901234567890
; 345678901234567890123456789012345678901234567890123456789012345678901234567890
; Instruction set test for xgate RISC processor core
; Instruction set test for xgate RISC processor core
; Bob Hayes - Sept 23 2009
; Bob Hayes - Sept 23 2009
;  Version 0.1 Basic tests of Debug Mode
;  Version 0.1 Basic tests of Debug Mode
 
 
 
 
        CPU     XGATE
        CPU     XGATE
 
 
        ORG     $fe00
        ORG     $fe00
        DS.W    2       ; reserve two words at channel 0
        DS.W    2       ; reserve two words at channel 0
        ; channel 1
        ; channel 1
        DC.W    _START  ; point to start address
        DC.W    _START  ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 2
        ; channel 2
        DC.W    _START2 ; point to start address
        DC.W    _START2 ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 3
        ; channel 3
        DC.W    _START3 ; point to start address
        DC.W    _START3 ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 4
        ; channel 4
        DC.W    _START4 ; point to start address
        DC.W    _START4 ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 5
        ; channel 5
        DC.W    _START5 ; point to start address
        DC.W    _START5 ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 6
        ; channel 6
        DC.W    _START6 ; point to start address
        DC.W    _START6 ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 7
        ; channel 7
        DC.W    _ERROR  ; point to start address
        DC.W    _ERROR  ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 8
        ; channel 8
        DC.W    _ERROR  ; point to start address
        DC.W    _ERROR  ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 9
        ; channel 9
        DC.W    _ERROR  ; point to start address
        DC.W    _ERROR  ; point to start address
        DC.W    V_PTR   ; point to initial variables
        DC.W    V_PTR   ; point to initial variables
        ; channel 10
        ; channel 10
        DC.W    _ERROR  ; point to start address
        DC.W    _ERROR  ; point to start address
        DC.W    V_PTR           ; point to initial variables
        DC.W    V_PTR           ; point to initial variables
 
 
        ORG     $2000 ; with comment
        ORG     $2000 ; with comment
 
 
V_PTR   EQU     123
V_PTR   EQU     123
 
 
 
 
        DC.W    BACK_
        DC.W    BACK_
        DS.W    8
        DS.W    8
        DC.B    $56
        DC.B    $56
        DS.B    11
        DS.B    11
 
 
        ALIGN   1
        ALIGN   1
 
 
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;   Place where undefined interrupts go
;   Place where undefined interrupts go
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
_ERROR
_ERROR
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$ff
        LDL     R3,#$ff
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
 
 
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;   Test Debug Mode and Single Step instructions
;   Test Debug Mode and Single Step instructions
;
;
;    Note: The testbench checks the PC values so adding or removing instructions
;    Note: The testbench checks the PC values so adding or removing instructions
;          from this test will also require a change to the testbench
;          from this test will also require a change to the testbench
;          expected values.
;          expected values.
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
_START
_START
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$01
        LDL     R3,#$01
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
 
 
 
 
        ; Test
        ; Test
        LDL     R4,#$c3 ;
        LDL     R4,#$c3 ;
        STW     R4,(R0,#$08)    ;
        STW     R4,(R0,#$08)    ;
        LDL     R3,#$01         ; R3 = $01
        LDL     R7,#$01         ; R3 = $01; R7 = $01
 
 
        BRK                     ; Enter Debug mode and start doing Single Step Commands
        BRK                     ; Enter Debug mode and start doing Single Step Commands
                                ;  from the testbench. Verify PC and R3 values.
                                ;  from the testbench. Verify PC and R3 values.
 
 
        ADDL    R3,#$01         ; R3 + $01 => R3 (R3 = $02)
        ADDL    R3,#$01         ; R3 + $01 => R3 (R3 = $02)
        NOP
        NOP
        BRA     _BRA_OK1        ; Do Foward Branch Single Step
        BRA     _BRA_OK1        ; Do Foward Branch Single Step
        ADDL    R3,#$40         ; For error detection
        ADDL    R3,#$40         ; For error detection
        NOP
        NOP
        ADDL    R3,#$60         ; For error detection
        ADDL    R3,#$60         ; For error detection
_BRA_OK2
_BRA_OK2
        STW     R3,(R0,#$0c)    ; 
        STW     R3,(R0,#$0c)    ; 
        ADDL    R3,#$01         ; R3 + $01 => R3 (R3 = $04)
        ADDL    R3,#$01         ; R3 + $01 => R3 (R3 = $04)
 
 
                                ; Testbench Clears Debug mode
                                ; Testbench Clears Debug mode
 
 
        CMP     R4,R7           ; Check Load and Store commands received correct data
        CMP     R4,R7           ; Check Load and Store commands received correct data
        BNE     _FAIL
        BNE     _FAIL
        LDW     R5,(R0,#$0c)    ;
        LDW     R5,(R0,#$0c)    ;
        ADDL    R5,#$01         ; R5 + $01 => R5 (R5 = $04) Catch up to latest R3 value
        ADDL    R5,#$01         ; R5 + $01 => R5 (R5 = $04) Catch up to latest R3 value
        CMP     R3,R5           ;
        CMP     R3,R5           ;
        BNE     _FAIL
        BNE     _FAIL
 
 
        LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
        LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$02
        LDL     R3,#$02
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
_BRA_OK1
_BRA_OK1
        ADDL    R3,#$01         ; R3 + $01 => R3 (R3 = $03)
        ADDL    R3,#$01         ; R3 + $01 => R3 (R3 = $03)
        LDW     R7,(R0,#$08)    ;
        LDW     R7,(R0,#$08)    ;
        BRA     _BRA_OK2        ; Do Backward Branch
        BRA     _BRA_OK2        ; Do Backward Branch
 
 
_FAIL
_FAIL
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$01
        LDL     R3,#$01
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
 
 
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;   Test Debug Command
;   Test Debug Command
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
_START2
_START2
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$03
        LDL     R3,#$03
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
        LDL     R3,#$02    ; Thread Value
        LDL     R3,#$02    ; Thread Value
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
 
 
 
 
        ; Test
        ; Test
        LDL     R3,#$01         ; R3 = $01
        LDL     R3,#$01         ; R3 = $01
        LDL     R4,#$01         ; R4 = $01
        LDL     R4,#$01         ; R4 = $01
        LDL     R7,#$03         ; R7 = $03
        LDL     R7,#$03         ; R7 = $03
 
 
_T2_LOOP
_T2_LOOP
        ADDL    R3,#$01         ; R3 + $01 => R3 (R3 = $02)
        ADDL    R3,#$01         ; R3 + $01 => R3 (R3 = $02)
        NOP
        COM     R6              ; Toggle R6
        BRA     _T2_LOOP        ; Create an infinate loop. The testbench will
        BRA     _T2_LOOP        ; Create an infinate loop. The testbench will
                                ;  take control using the Debug bit and change
                                ;  take control using the Debug bit and change
                                ;  the PC to exit the loop.
                                ;  the PC to exit the loop.
 
 
        NOP
        NOP
        NOP
        NOP
        ADDL    R4,#$60         ; For error detection
        ADDL    R4,#$60         ; For error detection
        ADDL    R4,#$01         ; Test bench will set the PC to here
        ADDL    R4,#$01         ; Test bench will set the PC to here
        ADDL    R4,#$01         ; 
        ADDL    R4,#$01         ; 
 
 
        CMP     R4,R7           ; Check Load and Store commands received correct data
        CMP     R4,R7           ; Check Load and Store commands received correct data
        BNE     _FAIL2
        BNE     _FAIL2
 
 
_END_2  LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
_END_2  LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$04
        LDL     R3,#$04
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
 
 
_FAIL2
_FAIL2
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$02
        LDL     R3,#$02
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;   Test Debug and Change Channel ID Command
;   Test Debug and Change Channel ID Command
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
_START3
_START3
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$05
        LDL     R3,#$05
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
        LDL     R3,#$03    ; Thread Value
        LDL     R3,#$03    ; Thread Value
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
 
 
 
 
        ; Test
        ; Test
        LDL     R3,#$01         ; R3 = $01
        LDL     R3,#$01         ; R3 = $01
        LDL     R4,#$01         ; R4 = $01
        LDL     R4,#$01         ; R4 = $01
        LDL     R7,#$03         ; R7 = $03
        LDL     R7,#$03         ; R7 = $03
 
 
        BRK                     ; Enter Debug mode
        BRK                     ; Enter Debug mode
 
 
        ; The testbench will use writes to the XGCHID reg to move to another
        ; The testbench will use writes to the XGCHID reg to move to another
        ;  channel to complete the test.
        ;  channel to complete the test.
 
 
_FAIL3
_FAIL3
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$03
        LDL     R3,#$03
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;   Target for debug mode change CHID Command
;   Target for debug mode change CHID Command
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
_START4
_START4
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$06
        LDL     R3,#$06
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
 
 
        ; Test
        ; Test
        BRK
        BRK
 
 
_END_4  LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
_END_4  LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$07
        LDL     R3,#$07
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
 
 
_FAIL4
_FAIL4
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$04
        LDL     R3,#$04
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;   False Target for debug mode change CHID Command
;   False Target for debug mode change CHID Command
;    Verify that when the CHID command is issued that a higher poririty interrup
;    Verify that when the CHID command is issued that a higher poririty interrup
;    dosn't slip in.
;    dosn't slip in.
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
_START5
_START5
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$08
        LDL     R3,#$08
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
        LDL     R3,#$05    ; Thread Value
        LDL     R3,#$05    ; Thread Value
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
 
 
 
 
        ; Test
        ; Test
        BRK
        BRK
 
 
_END_5  LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
_END_5  LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$09
        LDL     R3,#$09
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
 
 
_FAIL5
_FAIL5
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$05
        LDL     R3,#$05
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;   Test Debug and Change Channel ID Command
;   Test Debug and Change Channel ID Command
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
_START6
_START6
        BRK                ; Enter Debug mode
        BRK                ; Enter Debug mode
        BRA     _GO6
        BRA     _GO6
        BRA     _FAIL6
        BRA     _FAIL6
_GO6
_GO6
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDL     R2,#$00    ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$0a
        LDL     R3,#$0a
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
        LDL     R3,#$06    ; Thread Value
        LDL     R3,#$06    ; Thread Value
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
        STB     R3,(R2,#2) ; Send Message to clear Testbench interrupt register
 
 
 
 
        ; Test
        ; Test
 
 
_END_6  LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
_END_6  LDL     R2,#$00         ; Sent Message to Testbench Check Point Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$0b
        LDL     R3,#$0b
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
 
 
_FAIL6
_FAIL6
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDL     R2,#$04    ; Sent Message to Testbench Error Register
        LDH     R2,#$80
        LDH     R2,#$80
        LDL     R3,#$06
        LDL     R3,#$06
        STB     R3,(R2,#0)
        STB     R3,(R2,#0)
 
 
        SIF
        SIF
        RTS
        RTS
 
 
 
 
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
;-------------------------------------------------------------------------------
 
 
 
 
;empty line
;empty line
 
 
BACK_
BACK_
 
 
 
 
        SIF     R7
        SIF     R7
        BRK
        BRK
 
 
        ORG     $8000 ; Special Testbench Addresses
        ORG     $8000 ; Special Testbench Addresses
_BENCH  DS.W    8
_BENCH  DS.W    8
 
 
 
 
 
 
 
 
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.