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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [tools/] [tcl/] [rw11/] [util.tcl] - Blame information for rev 26

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 wfjm
# $Id: util.tcl 575 2014-07-27 20:55:41Z mueller $
2 19 wfjm
#
3 25 wfjm
# Copyright 2013-2014 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 19 wfjm
#
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 25 wfjm
# 2014-07-26   575   1.2.2  run_pdpcp: add tout argument
17
# 2014-06-27   565   1.2.1  temporarily hide RL11
18
# 2014-06-08   561   1.2    setup_sys: add RL11
19 22 wfjm
# 2014-03-07   553   1.1.3  move definitions to defs.tcl
20 21 wfjm
# 2013-05-09   517   1.1.2  add setup_(tt|lp|pp|ostr) device setup procs
21 20 wfjm
# 2013-04-26   510   1.1.1  split, asm* and tbench* into separate files
22 19 wfjm
# 2013-04-01   501   1.1    add regdsc's and asm* procs
23
# 2013-02-02   380   1.0    Initial version
24
#
25
 
26 20 wfjm
package provide rw11 1.0
27 19 wfjm
 
28
package require rlink
29
package require rwxxtpp
30
 
31 20 wfjm
namespace eval rw11 {
32 19 wfjm
  #
33
  # setup_cpu: create w11 cpu system
34
  # 
35
  proc setup_cpu {} {
36
    rlc config -basestat 2 -baseaddr 8 -basedata 8
37
    rw11 rlw rls w11a 1
38 20 wfjm
    cpu0 cp -reset;                     # reset CPU
39 19 wfjm
    return ""
40
  }
41
 
42
  #
43
  # setup_sys: create full system
44
  # 
45
  proc setup_sys {} {
46
    if {[info commands rlw] eq ""} {
47
      setup_cpu
48
    }
49
    cpu0 add dl11
50 20 wfjm
    cpu0 add dl11 -base 0176500 -lam 2
51
    cpu0 add rk11
52 25 wfjm
  ##  cpu0 add rl11
53 21 wfjm
    cpu0 add lp11
54
    cpu0 add pc11
55 19 wfjm
    rlw start
56
    return ""
57
  }
58
 
59
  #
60 21 wfjm
  # setup_tt: setup terminals
61
  # 
62
  proc setup_tt {{cpu "cpu0"} {optlist {}}} {
63
    # process and check options
64
    array set optref { ndl 2 dlrlim 0 ndz 0 to7bit 0 app 0 nbck 1}
65
    rutil::optlist2arr opt optref $optlist
66
 
67
    # check option values
68
    if {$opt(ndl) < 1 || $opt(ndl) > 2} {
69
      error "ndl option must be 1 or 2"
70
    }
71
    if {$opt(ndz) != 0} {
72
      error "ndz option must be 0 (till dz11 support is added)"
73
    }
74
 
75
    # setup attach url options
76
    set urlopt "?crlf"
77
    if {$opt(app) != 0} {
78
      append urlopt ";app"
79
    }
80
    if {$opt(nbck) != 0} {
81
      append urlopt ";bck=$opt(nbck)"
82
    }
83
 
84
    # setup list if DL11 controllers
85
    set dllist {}
86
    lappend dllist "tta" "8000"
87
    if {$opt(ndl) == 2} {
88
      lappend dllist "ttb" "8001"
89
    }
90
 
91
    # handle DL11 controllers
92
    foreach {cntl port} $dllist {
93
      set unit "${cntl}0"
94
      ${cpu}${unit} att "tcp:?port=${port}"
95
      ${cpu}${unit} set log "tirri_${unit}.log${urlopt}"
96
      if {$opt(dlrlim) != 0} {
97
        ${cpu}${cntl} set rxrlim 7
98
      }
99
      if {$opt(to7bit) != 0} {
100
        ${cpu}${unit} set to7bit 1
101
      }
102
    }
103
    return ""
104
  }
105
 
106
  #
107
  # setup_ostr: setup Ostream device (currently lp or pp)
108
  # 
109
  proc setup_ostr {cpu unit optlist} {
110
    # process and check options
111
    array set optref { app 0 nbck 1}
112
    rutil::optlist2arr opt optref $optlist
113
 
114
    # setup attach url options
115
    set urloptlist {}
116
    if {$opt(app) != 0} {
117
      append urloptlist "app"
118
    }
119
    if {$opt(nbck) != 0} {
120
      append urloptlist "bck=$opt(nbck)"
121
    }
122
    set urlopt ""
123
    if {[llength $urloptlist] > 0} {
124
      append urlopt "?"
125
      append urlopt [join $urloptlist ";"]
126
    }
127
 
128
    # handle unit
129
    ${cpu}${unit} att "tirri_${unit}.dat${urlopt}"
130
    return ""
131
  }
132
 
133
  #
134
  # setup_lp: setup printer
135
  # 
136
  proc setup_lp {{cpu "cpu0"} {optlist {}}} {
137
    # process and check options
138
    array set optref { nlp 1 app 0 nbck 1}
139
    rutil::optlist2arr opt optref $optlist
140
    if {$opt(nlp) != 0} {
141
      setup_ostr $cpu "lpa0" [list app $opt(app) nbck $opt(nbck)]
142
    }
143
  }
144
  #
145
  # setup_pp: setup paper puncher
146
  # 
147
  proc setup_pp {{cpu "cpu0"} {optlist {}}} {
148
    # process and check options
149
    array set optref { npc 1 app 0 nbck 1}
150
    rutil::optlist2arr opt optref $optlist
151
    if {$opt(npc) != 0} {
152
      setup_ostr $cpu "pp" [list app $opt(app) nbck $opt(nbck)]
153
    }
154
  }
155
 
156
  #
157 19 wfjm
  # run_pdpcp: execute pdpcp type command file
158
  #
159 25 wfjm
  proc run_pdpcp {fname {tout 10.} {cpu "cpu0"}} {
160 19 wfjm
    rlc errcnt -clear
161 25 wfjm
    set code [exec ticonv_pdpcp --tout=$tout $cpu $fname]
162 19 wfjm
    eval $code
163
    set errcnt [rlc errcnt]
164
    if { $errcnt } {
165
      puts [format "run_pdpcp: FAIL after %d errors" $errcnt]
166
    }
167
    return $errcnt
168
  }
169 20 wfjm
 
170 19 wfjm
}

powered by: WebSVN 2.1.0

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