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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [tools/] [tcl/] [rw11/] [dmscnt.tcl] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 wfjm
# $Id: dmscnt.tcl 722 2015-12-30 19:45:46Z mueller $
2
#
3
# Copyright 2015- 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
# 2015-12-30   722   1.0.2  sc_start: use args2opts
17
# 2015-12-28   721   1.0.1  use ena instead of cnt; use regbldkv
18
# 2015-06-27   695   1.0    Initial version
19
#
20
 
21
package provide rw11 1.0
22
 
23
package require rlink
24
package require rwxxtpp
25
 
26
namespace eval rw11 {
27
  #
28
  # setup dmscnt unit register descriptions for w11a -------------------------
29
  #
30
  regdsc SC_CNTL {clr 1} {ena 0}
31
  regdsc SC_ADDR {mem 10 8} {word 1 2}
32
 
33
  #
34
  # sc_setup: rmap definitions for dmscnt
35
  # 
36
  proc sc_setup {{cpu "cpu0"}} {
37
    set base [$cpu get base]
38
    $cpu rmap -insert sc.cntl [expr {$base + 0x40}]
39
    $cpu rmap -insert sc.addr [expr {$base + 0x41}]
40
    $cpu rmap -insert sc.data [expr {$base + 0x42}]
41
  }
42
 
43
  #
44
  # sc_start: start the dmscnt
45
  #
46
  proc sc_start {{cpu "cpu0"} args} {
47
    args2opts opts { clr 0 } {*}$args
48
    $cpu cp -wreg sc.cntl [regbldkv rw11::SC_CNTL ena 1 clr $opts(clr)]
49
  }
50
 
51
  #
52
  # sc_stop: stop the dmscnt
53
  #
54
  proc sc_stop {{cpu "cpu0"}} {
55
    $cpu cp -wreg sc.cntl [regbldkv rw11::SC_CNTL ena 0]
56
  }
57
 
58
  #
59
  # sc_read: read dmscnt data
60
  #
61
  proc sc_read {{cpu "cpu0"}} {
62
    $cpu cp -wreg sc.addr 0x0000 \
63
            -rblk sc.data [expr {2*3*256}] blk
64
    set sn 0
65
    set rval {}
66
    append rval "#sn  . .... ...."
67
    foreach {d0 d1 d2} $blk {
68
      append rval [format "\n%3.3x  %1.1x %4.4x %4.4x" $sn $d2 $d1 $d0]
69
      incr sn
70
    }
71
    return $rval
72
  }
73
 
74
}

powered by: WebSVN 2.1.0

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