1
0
mirror of https://github.com/wfjm/w11.git synced 2026-02-02 07:01:38 +00:00

- interim release w11a_V0.57 (untagged)

- new C++ and Tcl based backend server supports now RK11 handling
- w11a systems operate with rlink over USB on nexsy2 and nexsy3 boards.
  See w11a_os_guide.txt for details
This commit is contained in:
Walter F.J. Mueller
2013-04-27 14:21:46 +00:00
parent 99de9893cb
commit b06cbef00a
105 changed files with 5202 additions and 593 deletions

102
tools/tcl/rw11/asm.tcl Normal file
View File

@@ -0,0 +1,102 @@
# $Id: asm.tcl 510 2013-04-26 16:14:57Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# This program is free software; you may redistribute and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2, or at your option any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for complete details.
#
# Revision History:
# Date Rev Version Comment
# 2013-04-26 510 1.0 Initial version (extracted from util.tcl)
#
package provide rw11 1.0
package require rlink
package require rwxxtpp
namespace eval rw11 {
#
# asmrun: run a program loaded with ldasm
#
proc asmrun {cpu symName opts} {
upvar 1 $symName sym
array set defs {r0 0 r1 0 r2 0 r3 0 r4 0 r5 0}
array set defs $opts
if {![info exists defs(pc)]} {
if {[info exists sym(start)]} {
set defs(pc) $sym(start)
} else {
error "neither opts(pc) nor sym(start) given"
}
}
if {![info exists defs(sp)]} {
if {[info exists sym(stack)]} {
set defs(sp) $sym(stack)
} elseif {[info exists sym(start)]} {
set defs(sp) $sym(start)
} else {
error "neither opts(sp) nor sym(stack) or sym(start) given"
}
}
$cpu cp -wr0 $defs(r0) \
-wr1 $defs(r1) \
-wr2 $defs(r2) \
-wr3 $defs(r3) \
-wr4 $defs(r4) \
-wr5 $defs(r5)
$cpu cp -wsp $defs(sp) \
-stapc $defs(pc)
return ""
}
#
# asmwait: wait for completion of a program loaded with ldasm
#
proc asmwait {cpu symName {tout 10.}} {
upvar 1 $symName sym
set dt [$cpu wtcpu -reset $tout]
if {$dt >= 0 && [info exists $sym(stop)]} {
$cpu cp -rpc -edata $sym(stop)
}
return $dt
}
#
# asmtreg: test registers after running a program loaded with ldasm
#
proc asmtreg {cpu opts} {
array set defs $opts
set cpcmd ""
foreach key [lsort [array names defs]] {
append cpcmd " -r$key -edata $defs($key)"
}
eval $cpu cp $cpcmd
return ""
}
#
# asmtmem: test memory after running a program loaded with ldasm
#
proc asmtmem {cpu base list} {
set nw [llength $list]
if {$nw == 0} {
error "asmtreg called with empty list"
}
$cpu cp -wal $base -brm $nw -edata $list
return ""
}
}

View File

@@ -0,0 +1,84 @@
# $Id: cpucons.tcl 511 2013-04-27 13:51:46Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# This program is free software; you may redistribute and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2, or at your option any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for complete details.
#
# Revision History:
# Date Rev Version Comment
# 2013-04-26 510 1.0 Initial version
#
package provide rw11 1.0
package require rlink
package require rwxxtpp
namespace eval rw11 {
#
# cpumon: special command environment while cpu is running
#
variable cpucons_done 0
#
# cpucons: setup special console shortcut commands
#
proc cpucons {} {
variable cpucons_done
# quit if cpucons already done
if {$cpucons_done} {
return ""
}
namespace eval :: {
#
# '.' show current PC and PS
#
proc "." {} {
return [cpu0 show -pcps]
}
#
# '?' show current PC and PS and R0-R5
#
proc "?" {} {
return [cpu0 show -pcps -r0r5]
}
#
# '(' type some chars (no cr at end)
#
proc "(" {args} {
set str [join $args " "]
cpu0tta0 type $str
return ""
}
#
# '<' type some chars (with cr at end)
#
proc "<" {args} {
set str [join $args " "]
append str "\n"
cpu0tta0 type $str
return ""
}
}
set cpucons_done 1
return ""
}
}

95
tools/tcl/rw11/cpumon.tcl Normal file
View File

@@ -0,0 +1,95 @@
# $Id: cpumon.tcl 511 2013-04-27 13:51:46Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# This program is free software; you may redistribute and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2, or at your option any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for complete details.
#
# Revision History:
# Date Rev Version Comment
# 2013-04-26 510 1.0 Initial version
#
package provide rw11 1.0
package require rlink
package require rwxxtpp
namespace eval rw11 {
#
# cpumon: special command environment while cpu is running
#
variable cpumon_active 0
variable cpumon_prompt ">"
variable cpumon_attnhdl_added 0
variable cpumon_eofchar_save {puts {}}
proc cpumon {{prompt "cpumon> "} } {
variable cpumon_active
variable cpumon_prompt
variable cpumon_attnhdl_added
variable cpumon_eofchar_save
global tirri_interactive
# quit if cpumon already active
if {$cpumon_active} {
error "cpumon already active"
}
# check that attn handler is installed
if {!$cpumon_attnhdl_added} {
rls attn -add 0x0001 { rw11::cpumon_attncpu }
set cpumon_attnhdl_added 1
}
# redefine ti_rri prompt and eof handling
if { $tirri_interactive } {
# setup new prompt (save old one...)
set cpumon_prompt $prompt
rename ::tclreadline::prompt1 ::rw11::cpumon_prompt1_save
namespace eval ::tclreadline {
proc prompt1 {} {
return $rw11::cpumon_prompt
}
}
# disable ^D (and save old setting)
set cpumon_eofchar_save [::tclreadline::readline eofchar]
::tclreadline::readline eofchar \
{puts {^D disabled, use tirri_exit if you really want to bail-out}}
}
set cpumon_active 1
return ""
}
#
# cpumon_attncpu: cpu attn handler
#
proc cpumon_attncpu {} {
variable cpumon_active
variable cpumon_eofchar_save
global tirri_interactive
if {$cpumon_active} {
puts "CPU down attention"
puts [cpu0 show -pcps]
# restore ti_rri prompt and eof handling
if { $tirri_interactive } {
rename ::tclreadline::prompt1 {}
rename ::rw11::cpumon_prompt1_save ::tclreadline::prompt1
::tclreadline::readline eofchar $cpumon_eofchar_save
}
set cpumon_active 0
}
return ""
}
}

72
tools/tcl/rw11/tbench.tcl Normal file
View File

@@ -0,0 +1,72 @@
# $Id: tbench.tcl 510 2013-04-26 16:14:57Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# This program is free software; you may redistribute and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2, or at your option any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for complete details.
#
# Revision History:
# Date Rev Version Comment
# 2013-04-26 510 1.0 Initial version (extracted from util.tcl)
#
package provide rw11 1.0
package require rlink
package require rwxxtpp
namespace eval rw11 {
#
# tbench: driver for tbench scripts
#
proc tbench {fname} {
rlc exec -init 0xff [regbld rlink::INIT anena]
set errcnt [tbench_list $fname]
return $errcnt
}
#
# tbench_file: execute list of tbench steps
#
proc tbench_list {lname} {
set errcnt 0
if {[string match "@*" $lname]} {
set fname [string range $lname 1 end]
set fh [open "$::env(RETROBASE)/tools/tbench/$fname"]
while {[gets $fh line] >= 0} {
if {[string match "#*" $line]} {
if {[string match "##*" $line]} { puts $line }
} elseif {[string match "@*" $line]} {
incr errcnt [tbench_list $line]
} else {
incr errcnt [tbench_step $line]
}
}
close $fh
} else {
incr errcnt [tbench_step $lname]
}
puts [format "%s: %s" $lname [rutil::errcnt2txt $errcnt]]
return $errcnt
}
#
# tbench_step: execute single tbench step
#
proc tbench_step {fname} {
rlc errcnt -clear
set cpu cpu0
source "$::env(RETROBASE)/tools/tbench/$fname"
set errcnt [rlc errcnt]
puts [format "%s: %s" $fname [rutil::errcnt2txt $errcnt]]
return $errcnt
}
}

76
tools/tcl/rw11/util.tcl Normal file
View File

@@ -0,0 +1,76 @@
# $Id: util.tcl 510 2013-04-26 16:14:57Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# This program is free software; you may redistribute and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2, or at your option any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for complete details.
#
# Revision History:
# Date Rev Version Comment
# 2013-04-26 510 1.1.1 split, asm* and tbench* into separate files
# 2013-04-01 501 1.1 add regdsc's and asm* procs
# 2013-02-02 380 1.0 Initial version
#
package provide rw11 1.0
package require rlink
package require rwxxtpp
namespace eval rw11 {
#
# setup cp interface register descriptions for w11a
#
regdsc CP_CNTL {func 3 0}
regdsc CP_STAT {rust 7 4} {halt 3} {go 2} {merr 1} {err 0}
regdsc CP_IBRB {base 12 7} {bw 1 2}
#
# setup w11a register descriptions
#
regdsc PSW {cmode 15 2} {pmode 13 2} {rset 11} {pri 7 3} {tflag 3} {cc 3 4}
#
# setup_cpu: create w11 cpu system
#
proc setup_cpu {} {
rlc config -basestat 2 -baseaddr 8 -basedata 8
rw11 rlw rls w11a 1
cpu0 cp -reset; # reset CPU
return ""
}
#
# setup_sys: create full system
#
proc setup_sys {} {
if {[info commands rlw] eq ""} {
setup_cpu
}
cpu0 add dl11
cpu0 add dl11 -base 0176500 -lam 2
cpu0 add rk11
rlw start
return ""
}
#
# run_pdpcp: execute pdpcp type command file
#
proc run_pdpcp {fname {cpu "cpu0"}} {
rlc errcnt -clear
set code [exec ticonv_pdpcp $cpu $fname]
eval $code
set errcnt [rlc errcnt]
if { $errcnt } {
puts [format "run_pdpcp: FAIL after %d errors" $errcnt]
}
return $errcnt
}
}

View File

@@ -1,201 +0,0 @@
# $Id: util.tcl 504 2013-04-13 15:37:24Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
# This program is free software; you may redistribute and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2, or at your option any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for complete details.
#
# Revision History:
# Date Rev Version Comment
# 2013-04-13 504 1.1.1 add tbench* procs
# 2013-04-01 501 1.1 add regdsc's and asm* procs
# 2013-02-02 380 1.0 Initial version
#
package provide rw11a 1.0
package require rlink
package require rwxxtpp
namespace eval rw11a {
#
# setup cp interface register descriptions for w11a
#
regdsc CP_CNTL {func 3 0}
regdsc CP_STAT {rust 7 4} {halt 3} {go 2} {merr 1} {err 0}
regdsc CP_IBRB {base 12 7} {bw 1 2}
#
# setup w11a register descriptions
#
regdsc PSW {cmode 15 2} {pmode 13 2} {rset 11} {pri 7 3} {tflag 3} {cc 3 4}
#
# setup_cpu: create w11 cpu system
#
proc setup_cpu {} {
rlc config -basestat 2 -baseaddr 8 -basedata 8
rw11 rlw rls w11a 1
return ""
}
#
# setup_sys: create full system
#
proc setup_sys {} {
if {[info commands rlw] eq ""} {
setup_cpu
}
cpu0 add dl11
rlw start
return ""
}
#
# init: reset w11a
#
proc init {} {
# rlc exec -wreg br.cntl 0x0000
}
#
# asmrun: run a program loaded with ldasm
#
proc asmrun {cpu symName opts} {
upvar 1 $symName sym
array set defs {r0 0 r1 0 r2 0 r3 0 r4 0 r5 0}
array set defs $opts
if {![info exists defs(pc)]} {
if {[info exists sym(start)]} {
set defs(pc) $sym(start)
} else {
error "neither opts(pc) nor sym(start) given"
}
}
if {![info exists defs(sp)]} {
if {[info exists sym(stack)]} {
set defs(sp) $sym(stack)
} elseif {[info exists sym(start)]} {
set defs(sp) $sym(start)
} else {
error "neither opts(sp) nor sym(stack) or sym(start) given"
}
}
$cpu cp -wr0 $defs(r0) \
-wr1 $defs(r1) \
-wr2 $defs(r2) \
-wr3 $defs(r3) \
-wr4 $defs(r4) \
-wr5 $defs(r5)
$cpu cp -wsp $defs(sp) \
-stapc $defs(pc)
return ""
}
#
# asmwait: wait for completion of a program loaded with ldasm
#
proc asmwait {cpu symName {tout 10.}} {
upvar 1 $symName sym
set dt [$cpu wtcpu -reset $tout]
if {$dt >= 0 && [info exists $sym(stop)]} {
$cpu cp -rpc -edata $sym(stop)
}
return $dt
}
#
# asmtreg: test registers after running a program loaded with ldasm
#
proc asmtreg {cpu opts} {
array set defs $opts
set cpcmd ""
foreach key [lsort [array names defs]] {
append cpcmd " -r$key -edata $defs($key)"
}
eval $cpu cp $cpcmd
return ""
}
#
# asmtmem: test memory after running a program loaded with ldasm
#
proc asmtmem {cpu base list} {
set nw [llength $list]
if {$nw == 0} {
error "asmtreg called with empty list"
}
$cpu cp -wal $base -brm $nw -edata $list
return ""
}
#
# tbench: driver for tbench scripts
#
proc tbench {fname} {
rlc exec -init 0xff [regbld rlink::INIT anena]
set errcnt [tbench_list $fname]
return $errcnt
}
#
# tbench_file: execute list of tbench steps
#
proc tbench_list {lname} {
set errcnt 0
if {[string match "@*" $lname]} {
set fname [string range $lname 1 end]
set fh [open "$::env(RETROBASE)/tools/tbench/$fname"]
while {[gets $fh line] >= 0} {
if {[string match "#*" $line]} {
if {[string match "##*" $line]} { puts $line }
} elseif {[string match "@*" $line]} {
incr errcnt [tbench_list $line]
} else {
incr errcnt [tbench_step $line]
}
}
close $fh
} else {
incr errcnt [tbench_step $lname]
}
puts [format "%s: %s" $lname [rutil::errcnt2txt $errcnt]]
return $errcnt
}
#
# tbench_step: execute single tbench step
#
proc tbench_step {fname} {
rlc errcnt -clear
set cpu cpu0
source "$::env(RETROBASE)/tools/tbench/$fname"
set errcnt [rlc errcnt]
puts [format "%s: %s" $fname [rutil::errcnt2txt $errcnt]]
return $errcnt
}
#
# run_pdpcp: execute pdpcp type command file
#
proc run_pdpcp {fname {cpu "cpu0"}} {
rlc errcnt -clear
set code [exec ticonv_pdpcp $cpu $fname]
eval $code
set errcnt [rlc errcnt]
if { $errcnt } {
puts [format "run_pdpcp: FAIL after %d errors" $errcnt]
}
return $errcnt
}
}

View File

@@ -1,5 +1,5 @@
#! /usr/bin/env tclsh
# $Id: setup_packages 480 2013-02-03 10:11:02Z mueller $
# $Id: setup_packages 510 2013-04-26 16:14:57Z mueller $
#
pkg_mkIndex -verbose ../lib libr*tpp.so
#
@@ -11,6 +11,6 @@ pkg_mkIndex -verbose rbbram *.tcl
pkg_mkIndex -verbose rbs3hio *.tcl
pkg_mkIndex -verbose rbemon *.tcl
#
pkg_mkIndex -verbose rw11a *.tcl
pkg_mkIndex -verbose rw11 *.tcl
#
pkg_mkIndex -verbose tst_rlink *.tcl