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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [tbench/] [cp/] [test_cp_cpubasics.tcl] - Blame information for rev 36

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 31 wfjm
# $Id: test_cp_cpubasics.tcl 683 2015-05-17 21:54:35Z mueller $
2 19 wfjm
#
3 30 wfjm
# Copyright 2013-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 19 wfjm
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
5
#
6
# Revision History:
7
# Date         Rev Version  Comment
8 30 wfjm
# 2015-05-09   676   1.1    w11a start/stop/suspend overhaul
9 19 wfjm
# 2013-03-31   502   1.0    Initial version
10
#
11
# Test very basic cpu interface gymnastics
12
#  1. load code via ldasm
13 30 wfjm
#  2. execute code via -start, -stapc
14 19 wfjm
#  3. single step code via -step
15 30 wfjm
#  4. verify -suspend, -resume
16 19 wfjm
#
17
 
18 22 wfjm
# ----------------------------------------------------------------------------
19 30 wfjm
rlc log "test_cp_cpubasics: Test very basic cpu interface gymnastics ---------"
20
rlc log "  A1: start/stop/step basics --------------------------------"
21
rlc log "    load simple linear code via lsasm"
22 22 wfjm
 
23
#
24 19 wfjm
$cpu ldasm -lst lst -sym sym {
25
        . = 1000
26
start:  inc   r2
27
        inc   r2
28
        inc   r2
29
        halt
30
stop:
31
}
32
 
33 30 wfjm
rlc log "    read back and check"
34 19 wfjm
$cpu cp -wal $sym(start) \
35
        -brm 4 -edata {0005202 0005202 0005202 0000000}
36
 
37 30 wfjm
rlc log "    execute via -start"
38 19 wfjm
$cpu cp -wr2 00000 \
39
        -wpc $sym(start) \
40
        -start
41
$cpu wtcpu -reset 1.0
42
$cpu cp -rr2 -edata 00003 \
43
        -rpc -edata $sym(stop)
44
 
45 30 wfjm
rlc log "    execute via -stapc"
46 19 wfjm
$cpu cp -wr2 00100 \
47
        -stapc $sym(start)
48
$cpu wtcpu -reset 1.0
49
$cpu cp -rr2 -edata 00103 \
50
        -rpc -edata $sym(stop)
51
 
52 30 wfjm
rlc log "    execute via -step"
53
$cpu cp -wr2  00300 \
54
        -wpc  $sym(start)
55
$cpu cp -step \
56
        -rpc -edata [expr {$sym(start)+002}] \
57
        -rr2 -edata 00301 \
58
        -rstat -edata 000100
59
$cpu cp -step \
60
        -rpc -edata [expr {$sym(start)+004}] \
61
        -rr2 -edata 00302 \
62
        -rstat -edata 000100
63
$cpu cp -step \
64
        -rpc -edata [expr {$sym(start)+006}] \
65
        -rr2 -edata 00303 \
66
        -rstat -edata 000100
67
$cpu cp -step \
68
        -rpc -edata [expr {$sym(start)+010}] \
69
        -rr2 -edata 00303 \
70
        -rstat -edata 000020
71
 
72
rlc log "  A2: suspend/resume basics; cpugo,cpususp flags ------------"
73
# define tmpproc for r2 increment checks
74
proc tmpproc_checkr2inc {val} {
75
  set emsg ""
76
  if {$val == 0} {
77
    set emsg "FAIL: r2 change zero"
78
    rlc errcnt -inc
79
  }
80
  rlc log -bare ".. r2 increment $val $emsg"
81
}
82
 
83
#
84
rlc log "    load simple loop code via lsasm"
85
$cpu ldasm -lst lst -sym sym {
86
        . = 1000
87
start:  inc   r2
88
        br    start
89
stop:
90
}
91
 
92
set statgo   [regbld rw11::STAT cpugo]
93
set statgosu [regbld rw11::STAT cpususp cpugo]
94
 
95
rlc log "    execute via -stapc, check cpugo and that r2 increments"
96
$cpu cp -wr2 00000 \
97
        -stapc $sym(start) \
98
        -rr2 rr2_1 -estat $statgo \
99
        -rr2 rr2_2 -estat $statgo
100
tmpproc_checkr2inc $rr2_1
101
tmpproc_checkr2inc [expr {$rr2_2 - $rr2_1}]
102
 
103
rlc log "    suspend, check cpususp=1 and that r2 doesn't increment"
104
$cpu cp -suspend \
105
        -wr2 00000 \
106
        -rr2 -edata 0 -estat $statgosu \
107
        -rr2 -edata 0 -estat $statgosu
108
 
109
rlc log "    resume, check cpususp=0 and that r2 increments again"
110
$cpu cp -resume \
111
        -rr2 rr2_1 -estat $statgo \
112
        -rr2 rr2_2 -estat $statgo
113
tmpproc_checkr2inc $rr2_1
114
tmpproc_checkr2inc [expr {$rr2_2 - $rr2_1}]
115
 
116
rlc log "    suspend than step, two steps should inc r2 once"
117
$cpu cp -suspend \
118
        -wr2 00000 \
119
        -step \
120
        -step \
121
        -rr2  -edata 1 \
122
        -step \
123
        -step \
124
        -rr2  -edata 2
125
 
126
rlc log "    stop while suspended, check cpugo=0,cpususp=1,attn=1; harvest attn"
127
$cpu cp -stop -estat [regbld rw11::STAT cpususp attn]
128 19 wfjm
$cpu wtcpu -reset 1.0
129
 
130 30 wfjm
rlc log "    creset, check cpususp=0"
131
# Note: creset still has cpususp stat flag set because it clears with one
132
#       cycle delay. So do -estat after next command
133
$cpu cp -creset \
134
        -rr2 -estat 0

powered by: WebSVN 2.1.0

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