1 |
10 |
wfjm |
# $Id: test_regs.tcl 375 2011-04-02 07:56:47Z mueller $
|
2 |
|
|
#
|
3 |
|
|
# Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
|
4 |
|
|
#
|
5 |
|
|
# This program is free software; you may redistribute and/or modify it under
|
6 |
|
|
# the terms of the GNU General Public License as published by the Free
|
7 |
|
|
# Software Foundation, either version 2, or at your option any later version.
|
8 |
|
|
#
|
9 |
|
|
# This program is distributed in the hope that it will be useful, but
|
10 |
|
|
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
|
11 |
|
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
12 |
|
|
# for complete details.
|
13 |
|
|
#
|
14 |
|
|
# Revision History:
|
15 |
|
|
# Date Rev Version Comment
|
16 |
|
|
# 2011-03-27 374 1.0 Initial version
|
17 |
|
|
# 2011-03-13 369 0.1 First Draft
|
18 |
|
|
#
|
19 |
|
|
|
20 |
|
|
package provide rbmoni 1.0
|
21 |
|
|
|
22 |
|
|
package require rutiltpp
|
23 |
|
|
package require rutil
|
24 |
|
|
package require rlink
|
25 |
|
|
|
26 |
|
|
namespace eval rbmoni {
|
27 |
|
|
#
|
28 |
|
|
# Basic tests with rbtester registers
|
29 |
|
|
#
|
30 |
|
|
proc test_regs {} {
|
31 |
|
|
set esdval 0x00
|
32 |
|
|
set esdmsk [regbld rlink::STAT {stat -1}]
|
33 |
|
|
#
|
34 |
|
|
set errcnt 0
|
35 |
|
|
rlc errcnt -clear
|
36 |
|
|
#
|
37 |
|
|
rlc log "rbmoni::test_regs - start"
|
38 |
|
|
#
|
39 |
|
|
#-------------------------------------------------------------------------
|
40 |
|
|
rlc log " test 1: write/read cntl"
|
41 |
|
|
foreach val [list [regbld rbmoni::CNTL go] 0x0] {
|
42 |
|
|
rlc exec -estatdef $esdval $esdmsk \
|
43 |
|
|
-wreg rm.cntl $val \
|
44 |
|
|
-rreg rm.cntl -edata $val
|
45 |
|
|
}
|
46 |
|
|
#
|
47 |
|
|
#-------------------------------------------------------------------------
|
48 |
|
|
rlc log " test 2: write/read alim"
|
49 |
|
|
foreach val [list [regbld rbmoni::ALIM {hilim 0x00} {lolim 0x00}] \
|
50 |
|
|
[regbld rbmoni::ALIM {hilim 0xff} {lolim 0xff}] \
|
51 |
|
|
[regbld rbmoni::ALIM {hilim 0x00} {lolim 0xff}] \
|
52 |
|
|
[regbld rbmoni::ALIM {hilim 0xff} {lolim 0x00}]
|
53 |
|
|
] {
|
54 |
|
|
rlc exec -estatdef $esdval $esdmsk \
|
55 |
|
|
-wreg rm.alim $val \
|
56 |
|
|
-rreg rm.alim -edata $val
|
57 |
|
|
}
|
58 |
|
|
#
|
59 |
|
|
#-------------------------------------------------------------------------
|
60 |
|
|
rlc log " test 3: write/read addr"
|
61 |
|
|
set amax [regget rbmoni::ADDR(laddr) -1]
|
62 |
|
|
foreach {laddr waddr} [list 0x0000 0 0x0000 3 $amax 0 $amax 3] {
|
63 |
|
|
set addr [regbld rbmoni::ADDR [list laddr $laddr] [list waddr $waddr]]
|
64 |
|
|
rlc exec -estatdef $esdval $esdmsk \
|
65 |
|
|
-wreg rm.addr $addr \
|
66 |
|
|
-rreg rm.addr -edata $addr
|
67 |
|
|
}
|
68 |
|
|
#
|
69 |
|
|
#-------------------------------------------------------------------------
|
70 |
|
|
rlc log " test 4: verify that cntl.go 0->1 clear addr"
|
71 |
|
|
rlc exec -estatdef $esdval $esdmsk \
|
72 |
|
|
-wreg rm.cntl 0x0 \
|
73 |
|
|
-rreg rm.cntl -edata 0x0 \
|
74 |
|
|
-wreg rm.addr [regbld rbmoni::ADDR [list laddr $amax]] \
|
75 |
|
|
-rreg rm.addr -edata [regbld rbmoni::ADDR [list laddr $amax]] \
|
76 |
|
|
-wreg rm.cntl [regbld rbmoni::CNTL go] \
|
77 |
|
|
-rreg rm.cntl -edata [regbld rbmoni::CNTL go] \
|
78 |
|
|
-rreg rm.addr -edata 0x00 \
|
79 |
|
|
-wreg rm.cntl 0x0 \
|
80 |
|
|
-rreg rm.cntl -edata 0x0
|
81 |
|
|
#
|
82 |
|
|
#-------------------------------------------------------------------------
|
83 |
|
|
rlc log "rbmoni::test_regs - cleanup"
|
84 |
|
|
rbmoni::init
|
85 |
|
|
#
|
86 |
|
|
incr errcnt [rlc errcnt -clear]
|
87 |
|
|
return $errcnt
|
88 |
|
|
}
|
89 |
|
|
}
|