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

Subversion Repositories w11

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /w11/trunk
    from Rev 19 to Rev 20
    Reverse comparison

Rev 19 → Rev 20

tools/tcl/rw11a Property changes : Deleted: svn:ignore ## -1,33 +0,0 ## -*.dep_ghdl -*.dep_isim -*.dep_xst -work-obj93.cf -*.vcd -*.ghw -*.sav -*.tmp -*.exe -ise -xflow.his -*.ngc -*.ncd -*.pcf -*.bit -*.msk -isim -isim.log -isim.wdb -fuse.log -*_[sft]sim.vhd -*_tsim.sdf -*_xst.log -*_tra.log -*_twr.log -*_map.log -*_par.log -*_pad.log -*_bgn.log -*_svn.log -*_sum.log -*_[dsft]sim.log -pkgIndex.tcl Index: tools/tcl/rw11/asm.tcl =================================================================== --- tools/tcl/rw11/asm.tcl (nonexistent) +++ tools/tcl/rw11/asm.tcl (revision 20) @@ -0,0 +1,102 @@ +# $Id: asm.tcl 510 2013-04-26 16:14:57Z mueller $ +# +# Copyright 2013- by Walter F.J. Mueller +# +# 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 "" + } + +} Index: tools/tcl/rw11/cpumon.tcl =================================================================== --- tools/tcl/rw11/cpumon.tcl (nonexistent) +++ tools/tcl/rw11/cpumon.tcl (revision 20) @@ -0,0 +1,95 @@ +# $Id: cpumon.tcl 511 2013-04-27 13:51:46Z mueller $ +# +# Copyright 2013- by Walter F.J. Mueller +# +# 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 "" + } + +} Index: tools/tcl/rw11/tbench.tcl =================================================================== --- tools/tcl/rw11/tbench.tcl (nonexistent) +++ tools/tcl/rw11/tbench.tcl (revision 20) @@ -0,0 +1,72 @@ +# $Id: tbench.tcl 510 2013-04-26 16:14:57Z mueller $ +# +# Copyright 2013- by Walter F.J. Mueller +# +# 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 + } + +} Index: tools/tcl/rw11/cpucons.tcl =================================================================== --- tools/tcl/rw11/cpucons.tcl (nonexistent) +++ tools/tcl/rw11/cpucons.tcl (revision 20) @@ -0,0 +1,84 @@ +# $Id: cpucons.tcl 511 2013-04-27 13:51:46Z mueller $ +# +# Copyright 2013- by Walter F.J. Mueller +# +# 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 "" + } + +} Index: tools/tcl/rw11/util.tcl =================================================================== --- tools/tcl/rw11/util.tcl (nonexistent) +++ tools/tcl/rw11/util.tcl (revision 20) @@ -0,0 +1,76 @@ +# $Id: util.tcl 510 2013-04-26 16:14:57Z mueller $ +# +# Copyright 2013- by Walter F.J. Mueller +# +# 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 + } + +} Index: tools/tcl/rw11/.cvsignore =================================================================== --- tools/tcl/rw11/.cvsignore (nonexistent) +++ tools/tcl/rw11/.cvsignore (revision 20) @@ -0,0 +1 @@ +pkgIndex.tcl Index: tools/tcl/rw11 =================================================================== --- tools/tcl/rw11 (nonexistent) +++ tools/tcl/rw11 (revision 20)
tools/tcl/rw11 Property changes : Added: svn:ignore ## -0,0 +1,33 ## +*.dep_ghdl +*.dep_isim +*.dep_xst +work-obj93.cf +*.vcd +*.ghw +*.sav +*.tmp +*.exe +ise +xflow.his +*.ngc +*.ncd +*.pcf +*.bit +*.msk +isim +isim.log +isim.wdb +fuse.log +*_[sft]sim.vhd +*_tsim.sdf +*_xst.log +*_tra.log +*_twr.log +*_map.log +*_par.log +*_pad.log +*_bgn.log +*_svn.log +*_sum.log +*_[dsft]sim.log +pkgIndex.tcl Index: tools/tcl/setup_packages =================================================================== --- tools/tcl/setup_packages (revision 19) +++ tools/tcl/setup_packages (revision 20) @@ -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 rbs3hio *.tcl pkg_mkIndex -verbose rbemon *.tcl # -pkg_mkIndex -verbose rw11a *.tcl +pkg_mkIndex -verbose rw11 *.tcl # pkg_mkIndex -verbose tst_rlink *.tcl Index: tools/tbench/test_w11a_inst_traps.tcl =================================================================== --- tools/tbench/test_w11a_inst_traps.tcl (revision 19) +++ tools/tbench/test_w11a_inst_traps.tcl (revision 20) @@ -1,4 +1,4 @@ -# $Id: test_w11a_inst_traps.tcl 502 2013-04-02 19:29:30Z mueller $ +# $Id: test_w11a_inst_traps.tcl 510 2013-04-26 16:14:57Z mueller $ # # Copyright 2013- by Walter F.J. Mueller # License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory @@ -62,13 +62,13 @@ .word 177777 } -rw11a::asmrun $cpu sym [list r5 $sym(data) ] -rw11a::asmwait $cpu sym 1.0 -rw11a::asmtreg $cpu [list r0 0 r1 0 r2 0 r3 0 \ - r5 [expr {$sym(data) + 6*5*2}] \ - sp $sym(start) ] +rw11::asmrun $cpu sym [list r5 $sym(data) ] +rw11::asmwait $cpu sym 1.0 +rw11::asmtreg $cpu [list r0 0 r1 0 r2 0 r3 0 \ + r5 [expr {$sym(data) + 6*5*2}] \ + sp $sym(start) ] # data: trap ps; trap id; stack-pc; stack-ps opcode -rw11a::asmtmem $cpu $sym(data) \ +rw11::asmtmem $cpu $sym(data) \ [list 000340 001014 $sym(start:350$) 000350 0000003 \ 000341 001020 $sym(start:351$) 000351 0000004 \ 000342 001030 $sym(start:352$) 000352 0104100 \
/tools/tbench/test_w11a_dstm_word_flow.tcl
1,4 → 1,4
# $Id: test_w11a_dstm_word_flow.tcl 502 2013-04-02 19:29:30Z mueller $
# $Id: test_w11a_dstm_word_flow.tcl 510 2013-04-26 16:14:57Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
38,20 → 38,20
pdat5e:
}
 
rw11a::asmrun $cpu sym [list r0 010 \
r1 $sym(data1) \
r2 $sym(data2) \
r3 $sym(pdata3) \
r4 $sym(data4e) \
r5 $sym(pdat5e) ]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 011 \
r1 $sym(data1) \
r2 [expr {$sym(data2) + 4}] \
r3 [expr {$sym(pdata3) + 4}] \
r4 [expr {$sym(data4e) - 4}] \
r5 [expr {$sym(pdat5e) - 4}] ]
rw11a::asmtmem $cpu $sym(data1) {021 031 032 041 042 051 052 061 062}
rw11::asmrun $cpu sym [list r0 010 \
r1 $sym(data1) \
r2 $sym(data2) \
r3 $sym(pdata3) \
r4 $sym(data4e) \
r5 $sym(pdat5e) ]
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 011 \
r1 $sym(data1) \
r2 [expr {$sym(data2) + 4}] \
r3 [expr {$sym(pdata3) + 4}] \
r4 [expr {$sym(data4e) - 4}] \
r5 [expr {$sym(pdat5e) - 4}] ]
rw11::asmtmem $cpu $sym(data1) {021 031 032 041 042 051 052 061 062}
 
 
rlc log " nn(r0),@nn(r0),var,@var,@#var (mode=6,7,67,77,37)"
74,7 → 74,7
pdata3: .word data3
}
 
rw11a::asmrun $cpu sym [list r0 [expr {$sym(data0)-020}] \
r1 [expr {$sym(pdata1)-040}] ]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtmem $cpu $sym(data0) {0201 0211 0221 0231 0241}
rw11::asmrun $cpu sym [list r0 [expr {$sym(data0)-020}] \
r1 [expr {$sym(pdata1)-040}] ]
rw11::asmwait $cpu sym 1.0
rw11::asmtmem $cpu $sym(data0) {0201 0211 0221 0231 0241}
/tools/tbench/test_w11a_srcr_word_flow.tcl
1,4 → 1,4
# $Id: test_w11a_srcr_word_flow.tcl 502 2013-04-02 19:29:30Z mueller $
# $Id: test_w11a_srcr_word_flow.tcl 510 2013-04-26 16:14:57Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
22,9 → 22,9
stop:
}
 
rw11a::asmrun $cpu sym [list r0 01234]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 01234 \
rw11::asmrun $cpu sym [list r0 01234]
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 01234 \
r1 01234 \
r2 $sym(stack) \
r3 $sym(lpc) \
45,14 → 45,14
.word 1002
}
 
rw11a::asmrun $cpu sym [list r0 $sym(data)]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 $sym(data) \
r1 001001 \
r2 001001 \
r3 001002 \
r4 001002 \
r5 001001]
rw11::asmrun $cpu sym [list r0 $sym(data)]
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 $sym(data) \
r1 001001 \
r2 001001 \
r3 001002 \
r4 001002 \
r5 001001]
 
rlc log " @(r0)+,@-(r0) (mode=3,5)"
$cpu ldasm -lst lst -sym sym {
71,14 → 71,14
data1: .word 2002
}
 
rw11a::asmrun $cpu sym [list r0 $sym(pdata)]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 $sym(pdata) \
r1 002001 \
r2 002002 \
r3 [expr {$sym(pdata)+4}] \
r4 002002 \
r5 002001]
rw11::asmrun $cpu sym [list r0 $sym(pdata)]
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 $sym(pdata) \
r1 002001 \
r2 002002 \
r3 [expr {$sym(pdata)+4}] \
r4 002002 \
r5 002001]
 
rlc log " nn(r0),@nn(r0) (mode=6,7)"
$cpu ldasm -lst lst -sym sym {
99,14 → 99,14
data1: .word 003004
}
 
rw11a::asmrun $cpu sym [list r0 $sym(data)]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 $sym(data) \
r1 003001 \
r2 003002 \
r3 003003 \
r4 003004 \
r5 0]
rw11::asmrun $cpu sym [list r0 $sym(data)]
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 $sym(data) \
r1 003001 \
r2 003002 \
r3 003003 \
r4 003004 \
r5 0]
 
rlc log " #nn,@#nn,var,@var (mode=27,37,67,77)"
$cpu ldasm -lst lst -sym sym {
124,11 → 124,11
data4: .word 004004
}
 
rw11a::asmrun $cpu sym {}
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 0 \
r1 004001 \
r2 004002 \
r3 004003 \
r4 004004 \
r5 0]
rw11::asmrun $cpu sym {}
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 0 \
r1 004001 \
r2 004002 \
r3 004003 \
r4 004004 \
r5 0]
/tools/tbench/test_w11a_dsta_flow.tcl
1,4 → 1,4
# $Id: test_w11a_dsta_flow.tcl 502 2013-04-02 19:29:30Z mueller $
# $Id: test_w11a_dsta_flow.tcl 510 2013-04-26 16:14:57Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
51,20 → 51,20
.word 177777
}
 
rw11a::asmrun $cpu sym [list r0 $sym(sub00) \
r1 $sym(sub10) \
r2 $sym(psub2) \
r3 [expr {$sym(sub30)+2}] \
r4 $sym(psub4e) \
r5 $sym(data) ]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 $sym(sub00) \
rw11::asmrun $cpu sym [list r0 $sym(sub00) \
r1 $sym(sub10) \
r2 $sym(psub2) \
r3 [expr {$sym(sub30)+2}] \
r4 $sym(psub4e) \
r5 $sym(data) ]
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 $sym(sub00) \
r1 [expr {$sym(sub10)+2}] \
r2 [expr {$sym(psub2)+4}] \
r3 $sym(sub30) \
r4 $sym(psub4) \
r5 [expr {$sym(data) + 7*2*2}] ]
rw11a::asmtmem $cpu $sym(data) [list \
rw11::asmtmem $cpu $sym(data) [list \
0100 $sym(start:100$) \
0110 $sym(start:110$) \
0120 $sym(start:120$) \
105,17 → 105,17
.word 177777
}
 
rw11a::asmrun $cpu sym [list r0 [expr {$sym(sub00)-020}] \
rw11::asmrun $cpu sym [list r0 [expr {$sym(sub00)-020}] \
r1 [expr {$sym(psub10)-040}] \
r5 $sym(data) ]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 [expr {$sym(sub00)-020}] \
r1 [expr {$sym(psub10)-040}] \
r2 0 \
r3 0 \
r4 0 \
r5 [expr {$sym(data) + 5*2*2}] ]
rw11a::asmtmem $cpu $sym(data) [list \
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 [expr {$sym(sub00)-020}] \
r1 [expr {$sym(psub10)-040}] \
r2 0 \
r3 0 \
r4 0 \
r5 [expr {$sym(data) + 5*2*2}] ]
rw11::asmtmem $cpu $sym(data) [list \
01100 $sym(start:1100$) \
01110 $sym(start:1110$) \
01120 $sym(start:1120$) \
/tools/tbench/test_w11a_dstw_word_flow.tcl
1,4 → 1,4
# $Id: test_w11a_dstw_word_flow.tcl 502 2013-04-02 19:29:30Z mueller $
# $Id: test_w11a_dstw_word_flow.tcl 510 2013-04-26 16:14:57Z mueller $
#
# Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
38,19 → 38,19
pdat5e:
}
 
rw11a::asmrun $cpu sym [list r1 $sym(data1) \
rw11::asmrun $cpu sym [list r1 $sym(data1) \
r2 $sym(data2) \
r3 $sym(pdata3) \
r4 $sym(data4e) \
r5 $sym(pdat5e) ]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtreg $cpu [list r0 0100 \
r1 $sym(data1) \
r2 [expr {$sym(data2) + 4}] \
r3 [expr {$sym(pdata3) + 4}] \
r4 [expr {$sym(data4e) - 4}] \
r5 [expr {$sym(pdat5e) - 4}] ]
rw11a::asmtmem $cpu $sym(data1) {0110 0120 0121 0130 0131 0140 0141 0150 0151}
rw11::asmwait $cpu sym 1.0
rw11::asmtreg $cpu [list r0 0100 \
r1 $sym(data1) \
r2 [expr {$sym(data2) + 4}] \
r3 [expr {$sym(pdata3) + 4}] \
r4 [expr {$sym(data4e) - 4}] \
r5 [expr {$sym(pdat5e) - 4}] ]
rw11::asmtmem $cpu $sym(data1) {0110 0120 0121 0130 0131 0140 0141 0150 0151}
 
 
 
74,7 → 74,7
pdata3: .word data3
}
 
rw11a::asmrun $cpu sym [list r0 [expr {$sym(data0)-020}] \
r1 [expr {$sym(pdata1)-040}] ]
rw11a::asmwait $cpu sym 1.0
rw11a::asmtmem $cpu $sym(data0) {0200 0210 0220 0230 0240}
rw11::asmrun $cpu sym [list r0 [expr {$sym(data0)-020}] \
r1 [expr {$sym(pdata1)-040}] ]
rw11::asmwait $cpu sym 1.0
rw11::asmtmem $cpu $sym(data0) {0200 0210 0220 0230 0240}
/tools/src/librw11/Rw11VirtTermTcp.cpp
1,4 → 1,4
// $Id: Rw11VirtTermTcp.cpp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11VirtTermTcp.cpp 508 2013-04-20 18:43:28Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-20 508 1.0.1 add fSndPreConQue handling
// 2013-03-06 495 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
19,7 → 20,7
 
/*!
\file
\version $Id: Rw11VirtTermTcp.cpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11VirtTermTcp.cpp 508 2013-04-20 18:43:28Z mueller $
\brief Implemenation of Rw11VirtTermTcp.
*/
 
70,6 → 71,8
const uint8_t Rw11VirtTermTcp::kOpt_TTYP;
const uint8_t Rw11VirtTermTcp::kOpt_LINE;
 
const size_t Rw11VirtTermTcp::kPreConQue_limit;
 
//------------------------------------------+-----------------------------------
//! Default constructor
 
78,13 → 81,18
fFdListen(-1),
fFd(-1),
fState(ts_Closed),
fTcpTrace(false)
fTcpTrace(false),
fSndPreConQue()
{
fStats.Define(kStatNVTPreConSave , "NVTPreConSave" ,
"VT snd bytes saved prior connect");
fStats.Define(kStatNVTPreConDrop , "NVTPreConDrop" ,
"VT snd bytes dropped prior connect");
fStats.Define(kStatNVTListenPoll , "NVTListenPoll" ,
"ListenPollHandler() calls");
fStats.Define(kStatNVTAccept, "NVTAccept", "socket accepts");
fStats.Define(kStatNVTRcvRaw, "NVTRcvRaw", "raw bytes received");
fStats.Define(kStatNVTSndRaw, "NVTSndRaw", "raw bytes send");
"VT ListenPollHandler() calls");
fStats.Define(kStatNVTAccept, "NVTAccept", "VT socket accepts");
fStats.Define(kStatNVTRcvRaw, "NVTRcvRaw", "VT raw bytes received");
fStats.Define(kStatNVTSndRaw, "NVTSndRaw", "VT raw bytes send");
}
 
//------------------------------------------+-----------------------------------
96,7 → 104,7
Server().RemovePollHandler(fFdListen);
close(fFdListen);
}
if (fFd > 2) {
if (Connected()) {
Server().RemovePollHandler(fFd);
close(fFd);
}
182,7 → 190,18
fStats.Inc(kStatNVTSnd);
const uint8_t* pdata = data;
const uint8_t* pdataend = data+count;
if (count == 0) return true; // quit if nothing to do
 
if (!Connected()) { // if not connected keep last chars
for (size_t i=0; i<count; i++) fSndPreConQue.push_back(data[i]);
fStats.Inc(kStatNVTPreConSave, double(count));
while (fSndPreConQue.size() > kPreConQue_limit) {
fSndPreConQue.pop_front();
fStats.Inc(kStatNVTPreConDrop);
}
return true;
}
 
uint8_t obuf[1024];
while (pdata < pdataend) {
uint8_t* pobuf = obuf;
231,6 → 250,7
}
os << bl << " fState: " << t_state << endl;
os << bl << " fTcpTrace: " << fTcpTrace << endl;
os << bl << " fSndPreConQue.size" << fSndPreConQue.size() << endl;
Rw11VirtTerm::Dump(os, ind, " ^");
return;
}
265,11 → 285,14
 
int nerr = 0;
 
// send initial negotiation WILLs and DOs
if (write(fFd, buf_1, sizeof(buf_1)) < 0) nerr += 1;
if (write(fFd, buf_2, sizeof(buf_2)) < 0) nerr += 1;
if (write(fFd, buf_3, sizeof(buf_3)) < 0) nerr += 1;
if (write(fFd, buf_4, sizeof(buf_4)) < 0) nerr += 1;
if (write(fFd, buf_5, sizeof(buf_5)) < 0) nerr += 1;
 
// send connect message
if (nerr==0) {
stringstream msg;
msg << "\r\nconnect on port " << fChannelId
278,6 → 301,17
if (write(fFd, str.c_str(), str.length()) < 0) nerr += 1;
}
 
// send chars buffered while attached but not connected
if (nerr==0 && fSndPreConQue.size()) {
stringstream msg;
while (!fSndPreConQue.empty()) {
msg << char(fSndPreConQue.front());
fSndPreConQue.pop_front();
}
string str = msg.str();
if (write(fFd, str.c_str(), str.length()) < 0) nerr += 1;
}
 
if (nerr) {
close(fFd);
fFd = -1;
/tools/src/librw11/Rw11UnitRK11.hpp
0,0 → 1,54
// $Id: Rw11UnitRK11.hpp 509 2013-04-21 20:46:20Z 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-20 508 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: Rw11UnitRK11.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class Rw11UnitRK11.
*/
 
#ifndef included_Retro_Rw11UnitRK11
#define included_Retro_Rw11UnitRK11 1
 
#include "Rw11UnitDiskBase.hpp"
 
namespace Retro {
 
class Rw11CntlRK11; // forw decl to avoid circular incl
 
class Rw11UnitRK11 : public Rw11UnitDiskBase<Rw11CntlRK11> {
public:
Rw11UnitRK11(Rw11CntlRK11* pcntl, size_t index);
~Rw11UnitRK11();
 
void SetRkds(uint16_t rkds);
uint16_t Rkds() const;
 
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
 
protected:
uint16_t fRkds;
};
} // end namespace Retro
 
#include "Rw11UnitRK11.ipp"
 
#endif
/tools/src/librw11/Rw11UnitRK11.ipp
0,0 → 1,53
// $Id: Rw11UnitRK11.ipp 509 2013-04-21 20:46:20Z 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-20 508 1.0 Initial version
// 2013-04-14 505 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11UnitRK11.ipp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation (inline) of Rw11UnitRK11.
*/
 
#include "Rw11UnitRK11.hpp"
 
/*!
\class Retro::Rw11UnitRK11
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline void Rw11UnitRK11::SetRkds(uint16_t rkds)
{
fRkds = rkds;
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline uint16_t Rw11UnitRK11::Rkds() const
{
return fRkds;
}
 
} // end namespace Retro
/tools/src/librw11/Rw11Cpu.cpp
1,4 → 1,4
// $Id: Rw11Cpu.cpp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11Cpu.cpp 506 2013-04-14 21:54:03Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-14 506 1.0.1 add AddLalh(),AddRMem(),AddWMem()
// 2013-04-12 504 1.0 Initial version
// 2013-01-27 478 0.1 First draft
// ---------------------------------------------------------------------------
19,7 → 20,7
 
/*!
\file
\version $Id: Rw11Cpu.cpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11Cpu.cpp 506 2013-04-14 21:54:03Z mueller $
\brief Implemenation of Rw11Cpu.
*/
#include <stdlib.h>
94,6 → 95,10
const uint16_t Rw11Cpu::kCp_cpurust_sfail;
const uint16_t Rw11Cpu::kCp_cpurust_vfail;
 
const uint16_t Rw11Cpu::kCp_ah_m_addr;
const uint16_t Rw11Cpu::kCp_ah_m_22bit;
const uint16_t Rw11Cpu::kCp_ah_m_ubmap;
 
//------------------------------------------+-----------------------------------
//! Constructor
 
262,6 → 267,51
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int Rw11Cpu::AddLalh(RlinkCommandList& clist, uint32_t addr, uint16_t mode)
{
uint16_t al = uint16_t(addr);
uint16_t ah = uint16_t(addr>>16) & kCp_ah_m_addr;
ah |= mode & (kCp_ah_m_22bit|kCp_ah_m_ubmap);
int ind = clist.AddWreg(fBase+kCp_addr_al, al);
clist.AddWreg(fBase+kCp_addr_ah, ah);
return ind;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int Rw11Cpu::AddRMem(RlinkCommandList& clist, uint32_t addr,
uint16_t* buf, size_t size, uint16_t mode)
{
int ind = AddLalh(clist, addr, mode);
while (size > 0) {
size_t bsize = (size>256) ? 256 : size;
clist.AddRblk(fBase+kCp_addr_memi, buf, bsize);
buf += bsize;
size -= bsize;
}
return ind;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int Rw11Cpu::AddWMem(RlinkCommandList& clist, uint32_t addr,
const uint16_t* buf, size_t size, uint16_t mode)
{
int ind = AddLalh(clist, addr, mode);
while (size > 0) {
size_t bsize = (size>256) ? 256 : size;
clist.AddWblk(fBase+kCp_addr_memi, buf, bsize);
buf += bsize;
size -= bsize;
}
return ind;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11Cpu::MemRead(uint16_t addr, std::vector<uint16_t>& data,
size_t nword, RerrMsg& emsg)
{
/tools/src/librw11/Rw11VirtTermTcp.hpp
1,4 → 1,4
// $Id: Rw11VirtTermTcp.hpp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11VirtTermTcp.hpp 508 2013-04-20 18:43:28Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-20 508 1.0.1 add fSndPreConQue handling
// 2013-03-06 495 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
20,7 → 21,7
 
/*!
\file
\version $Id: Rw11VirtTermTcp.hpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11VirtTermTcp.hpp 508 2013-04-20 18:43:28Z mueller $
\brief Declaration of class Rw11VirtTermTcp.
*/
 
27,6 → 28,8
#ifndef included_Retro_Rw11VirtTermTcp
#define included_Retro_Rw11VirtTermTcp 1
 
#include <deque>
 
#include "Rw11VirtTerm.hpp"
 
namespace Retro {
45,7 → 48,9
 
// statistics counter indices
enum stats {
kStatNVTListenPoll = Rw11VirtTerm::kDimStat,
kStatNVTPreConSave = Rw11VirtTerm::kDimStat,
kStatNVTPreConDrop,
kStatNVTListenPoll,
kStatNVTAccept,
kStatNVTRcvRaw,
kStatNVTSndRaw,
54,6 → 59,7
 
protected:
 
bool Connected() const;
int ListenPollHandler(const pollfd& pfd);
int RcvPollHandler(const pollfd& pfd);
 
79,6 → 85,8
static const uint8_t kOpt_TTYP = 24;
static const uint8_t kOpt_LINE = 34;
 
static const size_t kPreConQue_limit = 65536;
 
enum telnet_state {
ts_Closed = 0,
ts_Listen,
94,10 → 102,11
int fFd;
telnet_state fState;
bool fTcpTrace;
std::deque<uint8_t> fSndPreConQue;
};
} // end namespace Retro
 
//#include "Rw11VirtTermTcp.ipp"
#include "Rw11VirtTermTcp.ipp"
 
#endif
/tools/src/librw11/Rw11VirtTermTcp.ipp
0,0 → 1,43
// $Id: Rw11VirtTermTcp.ipp 508 2013-04-20 18:43:28Z 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-20 508 1.0 Initial version
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11VirtTermTcp.ipp 508 2013-04-20 18:43:28Z mueller $
\brief Implemenation (inline) of Rw11VirtTermTcp.
*/
 
#include "Rw11VirtTermTcp.hpp"
 
/*!
\class Retro::Rw11VirtTermTcp
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline bool Rw11VirtTermTcp::Connected() const
{
return fFd > 2;
}
 
} // end namespace Retro
/tools/src/librw11/Rw11UnitDisk.cpp
0,0 → 1,116
// $Id: Rw11UnitDisk.cpp 509 2013-04-21 20:46:20Z 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-19 507 1.0 Initial version
// 2013-02-19 490 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11UnitDisk.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of Rw11UnitDisk.
*/
 
#include "librtools/Rexception.hpp"
 
#include "Rw11UnitDisk.hpp"
 
using namespace std;
 
/*!
\class Retro::Rw11UnitDisk
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Constructor
 
Rw11UnitDisk::Rw11UnitDisk(Rw11Cntl* pcntl, size_t index)
: Rw11UnitVirt<Rw11VirtDisk>(pcntl, index),
fType(),
fNCyl(0),
fNHead(0),
fNSect(0),
fBlksize(0),
fNBlock(),
fWProt(false)
{}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
Rw11UnitDisk::~Rw11UnitDisk()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11UnitDisk::SetType(const std::string& type)
{
throw Rexception("Rw11UnitDisk::<ctor>",
string("Bad args: only type '") + fType + "' supported");
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11UnitDisk::VirtRead(size_t lba, size_t nblk, uint8_t* data,
RerrMsg& emsg)
{
if (!Virt()) {
emsg.Init("Rw11UnitDisk::VirtRead", "no disk attached");
return false;
}
return Virt()->Read(lba, nblk, data, emsg);
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11UnitDisk::VirtWrite(size_t lba, size_t nblk, const uint8_t* data,
RerrMsg& emsg)
{
if (!Virt()) {
emsg.Init("Rw11UnitDisk::VirtWrite", "no disk attached");
return false;
}
return Virt()->Write(lba, nblk, data, emsg);
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11UnitDisk::Dump(std::ostream& os, int ind, const char* text) const
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11UnitDisk @ " << this << endl;
os << bl << " fType: " << fType << endl;
os << bl << " fNCyl: " << fNCyl << endl;
os << bl << " fNHead: " << fNHead << endl;
os << bl << " fNSect: " << fNSect << endl;
os << bl << " fBlksize: " << fBlksize << endl;
os << bl << " fNBlock: " << fNBlock << endl;
os << bl << " fWProt: " << fWProt << endl;
 
Rw11UnitVirt<Rw11VirtDisk>::Dump(os, ind, " ^");
return;
}
 
 
} // end namespace Retro
/tools/src/librw11/Rw11Cpu.hpp
1,4 → 1,4
// $Id: Rw11Cpu.hpp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11Cpu.hpp 506 2013-04-14 21:54:03Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-14 506 1.0.1 add AddLalh(),AddRMem(),AddWMem()
// 2013-04-12 504 1.0 Initial version
// 2013-01-27 478 0.1 First draft
// ---------------------------------------------------------------------------
20,7 → 21,7
 
/*!
\file
\version $Id: Rw11Cpu.hpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11Cpu.hpp 506 2013-04-14 21:54:03Z mueller $
\brief Declaration of class Rw11Cpu.
*/
 
55,6 → 56,7
typedef cmap_t::const_iterator cmap_cit_t;
typedef cmap_t::value_type cmap_val_t;
 
 
explicit Rw11Cpu(const std::string& type);
virtual ~Rw11Cpu();
 
82,6 → 84,15
int AddWibr(RlinkCommandList& clist, uint16_t ibaddr,
uint16_t data);
 
int AddLalh(RlinkCommandList& clist, uint32_t addr,
uint16_t mode=kCp_ah_m_22bit);
int AddRMem(RlinkCommandList& clist, uint32_t addr,
uint16_t* buf, size_t size,
uint16_t mode=kCp_ah_m_22bit);
int AddWMem(RlinkCommandList& clist, uint32_t addr,
const uint16_t* buf, size_t size,
uint16_t mode=kCp_ah_m_22bit);
 
bool MemRead(uint16_t addr, std::vector<uint16_t>& data,
size_t nword, RerrMsg& emsg);
bool MemWrite(uint16_t addr, const std::vector<uint16_t>& data,
145,6 → 156,10
static const uint16_t kCp_cpurust_sfail = 0xa; //!< sequencer failure
static const uint16_t kCp_cpurust_vfail = 0xb; //!< vmbox failure
 
static const uint16_t kCp_ah_m_addr = 0x003f; //!<
static const uint16_t kCp_ah_m_22bit = kWBit06; //!<
static const uint16_t kCp_ah_m_ubmap = kWBit07; //!<
 
private:
Rw11Cpu() {} //!< default ctor blocker
 
/tools/src/librw11/Rw11VirtDiskFile.cpp
0,0 → 1,178
// $Id: Rw11VirtDiskFile.cpp 509 2013-04-21 20:46:20Z 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-14 506 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11VirtDiskFile.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of Rw11VirtDiskFile.
*/
 
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
 
#include "librtools/RosFill.hpp"
 
#include "Rw11VirtDiskFile.hpp"
 
using namespace std;
 
/*!
\class Retro::Rw11VirtDiskFile
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Default constructor
 
Rw11VirtDiskFile::Rw11VirtDiskFile(Rw11Unit* punit)
: Rw11VirtDisk(punit),
fFd(0)
{}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
Rw11VirtDiskFile::~Rw11VirtDiskFile()
{
if (fFd > 2) ::close(fFd);
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11VirtDiskFile::Open(const std::string& url, RerrMsg& emsg)
{
if (!fUrl.Set(url, "|wpro|", emsg)) return false;
 
bool wpro = fUrl.FindOpt("wpro");
int fd = ::open(fUrl.Path().c_str(), wpro ? O_RDONLY : O_RDWR);
if (fd < 0) {
emsg.InitErrno("Rw11VirtDiskFile::Open()",
string("open() for '") + fUrl.Path() + string("' failed: "),
errno);
return false;
}
 
struct stat sbuf;
if (::fstat(fd, &sbuf) < 0) {
emsg.InitErrno("Rw11VirtDiskFile::Open()",
string("stat() for '") + fUrl.Path() + string("' failed: "),
errno);
return false;
}
 
fFd = fd;
fSize = sbuf.st_size;
return true;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11VirtDiskFile::Read(size_t lba, size_t nblk, uint8_t* data,
RerrMsg& emsg)
{
fStats.Inc(kStatNVDRead);
fStats.Inc(kStatNVDReadBlk, double(nblk));
 
size_t seekpos = fBlkSize * lba;
size_t nbyt = fBlkSize * nblk;
 
if (seekpos >= fSize) {
uint8_t* p = data;
for (size_t i=0; i<nbyt; i++) *p++ = 0;
return true;
}
 
if (!Seek(seekpos, emsg)) return false;
ssize_t irc = ::read(fFd, data, nbyt);
if (irc < 0) {
emsg.InitErrno("Rw11VirtDiskFile::Read()", "read() failed: ", errno);
return false;
}
 
if (irc < ssize_t(nbyt)) {
uint8_t* p = data+irc;
for (size_t i=irc; i<nbyt; i++) *p++ = 0;
}
 
return true;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11VirtDiskFile::Write(size_t lba, size_t nblk, const uint8_t* data,
RerrMsg& emsg)
{
fStats.Inc(kStatNVDWrite);
fStats.Inc(kStatNVDWriteBlk, double(nblk));
 
size_t seekpos = fBlkSize * lba;
size_t nbyt = fBlkSize * nblk;
 
if (!Seek(seekpos, emsg)) return false;
 
ssize_t irc = ::write(fFd, data, nbyt);
if (irc < ssize_t(nbyt)) {
emsg.InitErrno("Rw11VirtDiskFile::Write()", string("write() failed: "),
errno);
return false;
}
 
if (seekpos+nbyt > fSize) fSize = seekpos+nbyt;
 
return true;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11VirtDiskFile::Seek(size_t seekpos, RerrMsg& emsg)
{
if (::lseek(fFd, seekpos, SEEK_SET) < 0) {
emsg.InitErrno("Rw11VirtDiskFile::Seek()", string("seek() failed: "),
errno);
return false;
}
 
return true;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11VirtDiskFile::Dump(std::ostream& os, int ind, const char* text) const
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11VirtDiskFile @ " << this << endl;
 
os << bl << " fFd: " << fFd << endl;
Rw11VirtDisk::Dump(os, ind, " ^");
return;
}
 
} // end namespace Retro
/tools/src/librw11/Rw11VirtDisk.cpp
0,0 → 1,99
// $Id: Rw11VirtDisk.cpp 509 2013-04-21 20:46:20Z 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-03-03 494 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11VirtDisk.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of Rw11VirtDisk.
*/
#include <memory>
 
#include "librtools/RosFill.hpp"
#include "librtools/RparseUrl.hpp"
#include "Rw11VirtDiskFile.hpp"
 
#include "Rw11VirtDisk.hpp"
 
using namespace std;
 
/*!
\class Retro::Rw11VirtDisk
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Default constructor
 
Rw11VirtDisk::Rw11VirtDisk(Rw11Unit* punit)
: Rw11Virt(punit),
fBlkSize(0),
fNBlock(0)
{
fStats.Define(kStatNVDRead, "NVDRead", "Read() calls");
fStats.Define(kStatNVDReadBlk, "NVDReadBlk", "blocks read");
fStats.Define(kStatNVDWrite, "NVDWrite", "Write() calls");
fStats.Define(kStatNVDWriteBlk,"NVDWriteBlk", "blocks written");
}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
Rw11VirtDisk::~Rw11VirtDisk()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
Rw11VirtDisk* Rw11VirtDisk::New(const std::string& url, Rw11Unit* punit,
RerrMsg& emsg)
{
string scheme = RparseUrl::FindScheme(url, "file");
unique_ptr<Rw11VirtDisk> p;
if (scheme == "file") { // scheme -> file:
p.reset(new Rw11VirtDiskFile(punit));
if (p->Open(url, emsg)) return p.release();
 
} else { // scheme -> no match
emsg.Init("Rw11VirtDisk::New", string("Scheme '") + scheme +
"' is not supported");
}
 
return 0;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11VirtDisk::Dump(std::ostream& os, int ind, const char* text) const
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11VirtDisk @ " << this << endl;
 
os << bl << " fBlkSize: " << fBlkSize << endl;
os << bl << " fNBlock: " << fNBlock << endl;
Rw11Virt::Dump(os, ind, " ^");
return;
}
 
 
} // end namespace Retro
/tools/src/librw11/Rw11CntlRK11.cpp
0,0 → 1,623
// $Id: Rw11CntlRK11.cpp 509 2013-04-21 20:46:20Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
// Other credits:
// the boot code from the simh project and Copyright Robert M Supnik
//
// 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-20 508 1.0 Initial version
// 2013-02-10 485 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11CntlRK11.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of Rw11CntlRK11.
*/
 
#include "boost/bind.hpp"
#include "boost/foreach.hpp"
#define foreach_ BOOST_FOREACH
 
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
#include "librtools/Rexception.hpp"
#include "librtools/RlogMsg.hpp"
 
#include "Rw11CntlRK11.hpp"
 
using namespace std;
 
/*!
\class Retro::Rw11CntlRK11
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
// constants definitions
 
const uint16_t Rw11CntlRK11::kIbaddr;
const int Rw11CntlRK11::kLam;
 
const uint16_t Rw11CntlRK11::kRKDS;
const uint16_t Rw11CntlRK11::kRKER;
const uint16_t Rw11CntlRK11::kRKCS;
const uint16_t Rw11CntlRK11::kRKWC;
const uint16_t Rw11CntlRK11::kRKBA;
const uint16_t Rw11CntlRK11::kRKDA;
const uint16_t Rw11CntlRK11::kRKMR;
 
const uint16_t Rw11CntlRK11::kProbeOff;
const bool Rw11CntlRK11::kProbeInt;
const bool Rw11CntlRK11::kProbeRem;
 
const uint16_t Rw11CntlRK11::kRKDS_M_ID;
const uint16_t Rw11CntlRK11::kRKDS_V_ID;
const uint16_t Rw11CntlRK11::kRKDS_B_ID;
const uint16_t Rw11CntlRK11::kRKDS_M_HDEN;
const uint16_t Rw11CntlRK11::kRKDS_M_DRU;
const uint16_t Rw11CntlRK11::kRKDS_M_SIN;
const uint16_t Rw11CntlRK11::kRKDS_M_SOK;
const uint16_t Rw11CntlRK11::kRKDS_M_DRY;
const uint16_t Rw11CntlRK11::kRKDS_M_ADRY;
const uint16_t Rw11CntlRK11::kRKDS_M_WPS;
const uint16_t Rw11CntlRK11::kRKDS_B_SC;
 
const uint16_t Rw11CntlRK11::kRKER_M_DRE;
const uint16_t Rw11CntlRK11::kRKER_M_OVR;
const uint16_t Rw11CntlRK11::kRKER_M_WLO;
const uint16_t Rw11CntlRK11::kRKER_M_PGE;
const uint16_t Rw11CntlRK11::kRKER_M_NXM;
const uint16_t Rw11CntlRK11::kRKER_M_NXD;
const uint16_t Rw11CntlRK11::kRKER_M_NXC;
const uint16_t Rw11CntlRK11::kRKER_M_NXS;
const uint16_t Rw11CntlRK11::kRKER_M_CSE;
const uint16_t Rw11CntlRK11::kRKER_M_WCE;
 
const uint16_t Rw11CntlRK11::kRKCS_M_MAINT;
const uint16_t Rw11CntlRK11::kRKCS_M_IBA;
const uint16_t Rw11CntlRK11::kRKCS_M_FMT;
const uint16_t Rw11CntlRK11::kRKCS_M_RWA;
const uint16_t Rw11CntlRK11::kRKCS_M_SSE;
const uint16_t Rw11CntlRK11::kRKCS_M_MEX;
const uint16_t Rw11CntlRK11::kRKCS_V_MEX;
const uint16_t Rw11CntlRK11::kRKCS_B_MEX;
const uint16_t Rw11CntlRK11::kRKCS_V_FUNC;
const uint16_t Rw11CntlRK11::kRKCS_B_FUNC;
const uint16_t Rw11CntlRK11::kRKCS_CRESET;
const uint16_t Rw11CntlRK11::kRKCS_WRITE;
const uint16_t Rw11CntlRK11::kRKCS_READ;
const uint16_t Rw11CntlRK11::kRKCS_WCHK;
const uint16_t Rw11CntlRK11::kRKCS_SEEK;
const uint16_t Rw11CntlRK11::kRKCS_RCHK;
const uint16_t Rw11CntlRK11::kRKCS_DRESET;
const uint16_t Rw11CntlRK11::kRKCS_WLOCK;
const uint16_t Rw11CntlRK11::kRKCS_M_GO;
 
const uint16_t Rw11CntlRK11::kRKDA_M_DRSEL;
const uint16_t Rw11CntlRK11::kRKDA_V_DRSEL;
const uint16_t Rw11CntlRK11::kRKDA_B_DRSEL;
const uint16_t Rw11CntlRK11::kRKDA_M_CYL;
const uint16_t Rw11CntlRK11::kRKDA_V_CYL;
const uint16_t Rw11CntlRK11::kRKDA_B_CYL;
const uint16_t Rw11CntlRK11::kRKDA_M_SUR;
const uint16_t Rw11CntlRK11::kRKDA_V_SUR;
const uint16_t Rw11CntlRK11::kRKDA_B_SUR;
const uint16_t Rw11CntlRK11::kRKDA_B_SC;
 
const uint16_t Rw11CntlRK11::kRKMR_M_RID;
const uint16_t Rw11CntlRK11::kRKMR_V_RID;
const uint16_t Rw11CntlRK11::kRKMR_M_CRDONE;
const uint16_t Rw11CntlRK11::kRKMR_M_SBCLR;
const uint16_t Rw11CntlRK11::kRKMR_M_CRESET;
const uint16_t Rw11CntlRK11::kRKMR_M_FDONE;
 
//------------------------------------------+-----------------------------------
//! Default constructor
 
Rw11CntlRK11::Rw11CntlRK11()
: Rw11CntlBase<Rw11UnitRK11,8>("rk11"),
fPC_rkwc(0),
fPC_rkba(0),
fPC_rkda(0),
fPC_rkmr(0),
fPC_rkcs(0),
fRd_busy(false),
fRd_rkcs(0),
fRd_rkda(0),
fRd_addr(0),
fRd_lba(0),
fRd_nwrd(0),
fRd_ovr(false)
{
// must here because Unit have a back-pointer (not available at Rw11CntlBase)
for (size_t i=0; i<NUnit(); i++) {
fspUnit[i].reset(new Rw11UnitRK11(this, i));
}
}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
Rw11CntlRK11::~Rw11CntlRK11()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11CntlRK11::Config(const std::string& name, uint16_t base, int lam)
{
ConfigCntl(name, base, lam, kProbeOff, kProbeInt, kProbeRem);
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11CntlRK11::Start()
{
if (fStarted || fLam<0 || !fEnable || !fProbe.Found())
throw Rexception("Rw11CntlDL11::Start",
"Bad state: started, no lam, not enable, not found");
 
// setup primary info clist
fPrimClist.Clear();
Cpu().AddIbrb(fPrimClist, fBase);
fPC_rkwc = Cpu().AddRibr(fPrimClist, fBase+kRKWC);
fPC_rkba = Cpu().AddRibr(fPrimClist, fBase+kRKBA);
fPC_rkda = Cpu().AddRibr(fPrimClist, fBase+kRKDA);
fPC_rkmr = Cpu().AddRibr(fPrimClist, fBase+kRKMR); // read to monitor CRDONE
fPC_rkcs = Cpu().AddRibr(fPrimClist, fBase+kRKCS);
 
// add attn handler
Server().AddAttnHandler(boost::bind(&Rw11CntlRK11::AttnHandler, this, _1),
uint16_t(1)<<fLam, (void*)this);
 
fStarted = true;
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11CntlRK11::UnitSetup(size_t ind)
{
Rw11UnitRK11& unit = *fspUnit[ind];
Rw11Cpu& cpu = Cpu();
RlinkCommandList clist;
 
uint16_t rkds = ind<<kRKDS_V_ID;
if (unit.Virt()) { // file attached
rkds |= kRKDS_M_HDEN; // always high density
rkds |= kRKDS_M_SOK; // always sector counter OK ?FIXME?
rkds |= kRKDS_M_DRY; // drive available
rkds |= kRKDS_M_ADRY; // access available
if (unit.WProt()) // in case write protected
rkds |= kRKDS_M_WPS;
}
unit.SetRkds(rkds);
cpu.AddIbrb(clist, fBase);
cpu.AddWibr(clist, fBase+kRKDS, rkds);
Server().Exec(clist);
 
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11CntlRK11::BootCode(size_t unit, std::vector<uint16_t>& code,
uint16_t& aload, uint16_t& astart)
{
uint16_t kBOOT_START = 02000;
uint16_t bootcode[] = { // rk05 boot loader - from simh pdp11_rk.c
0042113, // "KD"
0012706, kBOOT_START, // MOV #boot_start, SP
0012700, uint16_t(unit), // MOV #unit, R0 ; unit number
0010003, // # MOV R0, R3
0000303, // # SWAB R3
0006303, // # ASL R3
0006303, // # ASL R3
0006303, // # ASL R3
0006303, // # ASL R3
0006303, // # ASL R3
0012701, 0177412, // # MOV #RKDA, R1 ; rkda
0010311, // # MOV R3, (R1) ; load da
0005041, // # CLR -(R1) ; clear ba
0012741, 0177000, // # MOV #-256.*2, -(R1) ; load wc
0012741, 0000005, // # MOV #READ+GO, -(R1) ; read & go
0005002, // # CLR R2
0005003, // # CLR R3
0012704, uint16_t(kBOOT_START+020), // # MOV #START+20, R4
0005005, // # CLR R5
0105711, // # TSTB (R1)
0100376, // # BPL .-4
0105011, // # CLRB (R1)
0005007 // # CLR PC (5007)
};
code.clear();
foreach_ (uint16_t& w, bootcode) code.push_back(w);
aload = kBOOT_START;
astart = kBOOT_START+2;
return true;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11CntlRK11::Dump(std::ostream& os, int ind, const char* text) const
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11CntlRK11 @ " << this << endl;
os << bl << " fPC_rkwc: " << fPC_rkwc << endl;
os << bl << " fPC_rkba: " << fPC_rkba << endl;
os << bl << " fPC_rkda: " << fPC_rkda << endl;
os << bl << " fPC_rkmr: " << fPC_rkmr << endl;
os << bl << " fPC_rkcs: " << fPC_rkcs << endl;
os << bl << " fRd_busy: " << fRd_busy << endl;
os << bl << " fRd_rkcs: " << fRd_rkcs << endl;
os << bl << " fRd_rkda: " << fRd_rkda << endl;
os << bl << " fRd_addr: " << fRd_addr << endl;
os << bl << " fRd_lba: " << fRd_lba << endl;
os << bl << " fRd_nwrd: " << fRd_nwrd << endl;
os << bl << " fRd_ovr: " << fRd_ovr << endl;
 
Rw11CntlBase<Rw11UnitRK11,8>::Dump(os, ind, " ^");
return;
}
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int Rw11CntlRK11::AttnHandler(const RlinkServer::AttnArgs& args)
{
RlinkCommandList* pclist;
size_t off;
GetPrimInfo(args, pclist, off);
 
uint16_t rkwc = (*pclist)[off+fPC_rkwc].Data();
uint16_t rkba = (*pclist)[off+fPC_rkba].Data();
uint16_t rkda = (*pclist)[off+fPC_rkda].Data();
//uint16_t rkmr = (*pclist)[off+fPC_rkmr].Data();
uint16_t rkcs = (*pclist)[off+fPC_rkcs].Data();
 
uint16_t se = rkda & kRKDA_B_SC;
uint16_t hd = (rkda>>kRKDA_V_SUR) & kRKDA_B_SUR;
uint16_t cy = (rkda>>kRKDA_V_CYL) & kRKDA_B_CYL;
uint16_t dr = (rkda>>kRKDA_V_DRSEL) & kRKDA_B_DRSEL;
bool go = rkcs & kRKCS_M_GO;
uint16_t fu = (rkcs>>kRKCS_V_FUNC) & kRKCS_B_FUNC;
uint16_t mex = (rkcs>>kRKCS_V_MEX) & kRKCS_B_MEX;
uint32_t addr = uint32_t(mex)<<16 | uint32_t(rkba);
 
// Note: apparently are operands first promoted to 32 bit -> mask after ~ !
uint32_t nwrd = (~uint32_t(rkwc)&0xffff) + 1; // transfer size in words
 
if (!go) {
RlogMsg lmsg(LogFile());
lmsg << "-I RK11 cs=" << RosPrintBvi(rkcs,8)
<< " go=0, spurious attn, dropped";
return 0;
}
// all 8 units are always available, but check anyway
if (dr > NUnit())
throw Rexception("Rw11CntlRK11::AttnHandler","Bad state: dr > NUnit()");
 
Rw11UnitRK11& unit = *fspUnit[dr];
Rw11Cpu& cpu = Cpu();
RlinkCommandList clist;
 
uint32_t lba = unit.Chs2Lba(cy,hd,se);
uint32_t nblk = (2*nwrd+unit.BlockSize()-1)/unit.BlockSize();
 
uint16_t rker = 0;
uint16_t rkds = unit.Rkds();
 
if (fTraceLevel>0) {
RlogMsg lmsg(LogFile());
lmsg << "-I RK11 cs=" << RosPrintBvi(rkcs,8)
<< " da=" << RosPrintBvi(rkda,8)
<< " ad=" << RosPrintBvi(addr,8,18)
<< " fu=" << fu
<< " dchs=" << dr
<< "," << RosPrintf(cy,"d",3)
<< "," << hd
<< "," << RosPrintf(se,"d",2)
<< " lba,nw=" << RosPrintf(lba,"d",4)
<< "," << RosPrintf(nwrd,"d",5);
}
 
// check for general abort conditions
if (fu != kRKCS_CRESET && // function not control reset
(!unit.Virt())) { // and drive not attached
rker = kRKER_M_NXD; // --> abort with NXD error
 
} else if (fu != kRKCS_WRITE && // function neither write
fu != kRKCS_READ && // nor read
(rkcs & (kRKCS_M_FMT|kRKCS_M_RWA))) { // and FMT or RWA set
rker = kRKER_M_PGE; // --> abort with PGE error
} else if (rkcs & kRKCS_M_RWA) { // RWA not supported
rker = kRKER_M_DRE; // --> abort with DRE error
}
if (rker) {
cpu.AddWibr(clist, fBase+kRKER, rker);
if (fu == kRKCS_SEEK || fu == kRKCS_DRESET)
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_SBCLR | (1u<<dr));
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_FDONE);
LogRker(rker);
Server().Exec(clist);
return 0;
}
 
// check for overrun (read/write beyond cylinder 203
// if found, truncate request length
bool ovr = lba + nblk > unit.NBlock();
if (ovr) nwrd = (unit.NBlock()-lba) * (unit.BlockSize()/2);
bool queue = false;
 
// now handle the functions
if (fu == kRKCS_CRESET) { // Control reset -----------------
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_CRESET);
fRd_busy = false;
 
} else if (fu == kRKCS_WRITE) { // Write -------------------------
// Note: WRITE+FMT is just WRITE
if (se >= unit.NSector()) rker |= kRKER_M_NXS;
if (cy >= unit.NCylinder()) rker |= kRKER_M_NXC;
if (unit.WProt()) rker |= kRKER_M_WLO;
if (rkcs & kRKCS_M_IBA) rker |= kRKER_M_DRE; // not yet supported FIXME
queue = true;
 
} else if (fu == kRKCS_READ) { // Read --------------------------
if (se >= unit.NSector()) rker |= kRKER_M_NXS;
if (cy >= unit.NCylinder()) rker |= kRKER_M_NXC;
if (rkcs & kRKCS_M_IBA) rker |= kRKER_M_DRE; // not yet supported FIXME
queue = true;
} else if (fu == kRKCS_WCHK) { // Write Check -------------------
if (se >= unit.NSector()) rker |= kRKER_M_NXS;
if (cy >= unit.NCylinder()) rker |= kRKER_M_NXC;
if (rkcs & kRKCS_M_IBA) rker |= kRKER_M_DRE; // not yet supported FIXME
queue = true;
 
} else if (fu == kRKCS_SEEK) { // Seek --------------------------
if (se >= unit.NSector()) rker |= kRKER_M_NXS;
if (cy >= unit.NCylinder()) rker |= kRKER_M_NXC;
if (rker) {
cpu.AddWibr(clist, fBase+kRKER, rker);
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_SBCLR | (1u<<dr));
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_FDONE);
LogRker(rker);
} else {
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_FDONE);
rkds &= ~kRKDS_B_SC; // replace current sector number
rkds |= se;
unit.SetRkds(rkds);
cpu.AddWibr(clist, fBase+kRKDS, rkds);
cpu.AddWibr(clist, fBase+kRKMR, 1u<<dr); // issue seek done
}
 
} else if (fu == kRKCS_RCHK) { // Read Check --------------------
if (se >= unit.NSector()) rker |= kRKER_M_NXS;
if (cy >= unit.NCylinder()) rker |= kRKER_M_NXC;
if (rkcs & kRKCS_M_IBA) rker |= kRKER_M_DRE; // not yet supported FIXME
queue = true;
 
} else if (fu == kRKCS_DRESET) { // Drive Reset -------------------
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_FDONE);
cpu.AddWibr(clist, fBase+kRKMR, 1u<<dr); // issue seek done
} else if (fu == kRKCS_WLOCK) { // Write Lock --------------------
rkds |= kRKDS_M_WPS; // set RKDS write protect flag
unit.SetRkds(rkds);
unit.SetWProt(true);
cpu.AddWibr(clist, fBase+kRKDS, rkds);
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_FDONE);
}
 
if (queue) { // to be handled in RdmaHandlder
if (rker) { // abort on case of errors
cpu.AddWibr(clist, fBase+kRKER, rker);
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_FDONE);
LogRker(rker);
} else { // or queue action
fRd_busy = true;
fRd_rkcs = rkcs;
fRd_rkda = rkda;
fRd_addr = addr;
fRd_lba = lba;
fRd_nwrd = nwrd;
fRd_ovr = ovr;
Server().QueueAction(boost::bind(&Rw11CntlRK11::RdmaHandler, this));
}
 
} else { // handled here
Server().Exec(clist);
}
 
return 0;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int Rw11CntlRK11::RdmaHandler()
{
uint16_t rker = 0;
uint16_t fu = (fRd_rkcs>>kRKCS_V_FUNC) & kRKCS_B_FUNC;
uint16_t dr = (fRd_rkda>>kRKDA_V_DRSEL) & kRKDA_B_DRSEL;
Rw11UnitRK11& unit = *fspUnit[dr];
Rw11Cpu& cpu = Cpu();
 
uint8_t buf[512];
 
if (fu == kRKCS_WRITE) { // Write -------------------------
// Note: WRITE+FMT is like WRITE
RlinkCommandList clist;
size_t bsize = (fRd_nwrd>256) ? 256 : fRd_nwrd;
cpu.AddRMem(clist, fRd_addr, (uint16_t*) buf, bsize,
Rw11Cpu::kCp_ah_m_22bit|Rw11Cpu::kCp_ah_m_ubmap);
Server().Exec(clist);
// FIXME_code: handle rdma I/O error
RerrMsg emsg;
bool rc = unit.VirtWrite(fRd_lba, 1, buf, emsg);
if (!rc) {
RlogMsg lmsg(LogFile());
lmsg << emsg;
rker |= kRKER_M_CSE; // forward disk I/O error
}
if (rker == 0) {
fRd_nwrd -= bsize;
fRd_addr += 2*bsize;
fRd_lba += 1;
}
if (rker==0 && fRd_nwrd>0) // not error and not yet done
return 1; // requeue
} else if (fu == kRKCS_READ) {
if ((fRd_rkcs&kRKCS_M_FMT) == 0) { // Read --------------------------
RerrMsg emsg;
bool rc = unit.VirtRead(fRd_lba, 1, buf, emsg);
if (!rc) {
RlogMsg lmsg(LogFile());
lmsg << emsg;
rker |= kRKER_M_CSE; // forward disk I/O error
}
 
if (rker == 0) {
RlinkCommandList clist;
size_t bsize = (fRd_nwrd>256) ? 256 : fRd_nwrd;
cpu.AddWMem(clist, fRd_addr, (uint16_t*) buf, bsize,
Rw11Cpu::kCp_ah_m_22bit|Rw11Cpu::kCp_ah_m_ubmap);
Server().Exec(clist);
// FIXME_code: handle rdma I/O error
fRd_nwrd -= bsize;
fRd_addr += 2*bsize;
fRd_lba += 1;
}
if (rker==0 && fRd_nwrd>0) // not error and not yet done
return 1; // requeue
} else { // Read Format -------------------
uint16_t cy = fRd_lba / (unit.NHead()*unit.NSector());
uint16_t da = cy<<kRKDA_V_CYL;
RlinkCommandList clist;
cpu.AddWMem(clist, fRd_addr, &da, 1,
Rw11Cpu::kCp_ah_m_22bit|Rw11Cpu::kCp_ah_m_ubmap);
Server().Exec(clist);
// FIXME_code: handle rdma I/O error
fRd_nwrd -= 1;
fRd_addr += 2;
fRd_lba += 1;
if (rker==0 && fRd_nwrd>0) // not error and not yet done
return 1; // requeue
}
} else if (fu == kRKCS_WCHK) { // Write Check -------------------
uint16_t bufmem[256];
RlinkCommandList clist;
size_t bsize = (fRd_nwrd>256) ? 256 : fRd_nwrd;
cpu.AddRMem(clist, fRd_addr, bufmem, bsize,
Rw11Cpu::kCp_ah_m_22bit|Rw11Cpu::kCp_ah_m_ubmap);
Server().Exec(clist);
// FIXME_code: handle rdma I/O error
RerrMsg emsg;
bool rc = unit.VirtRead(fRd_lba, 1, buf, emsg);
if (!rc) {
RlogMsg lmsg(LogFile());
lmsg << emsg;
rker |= kRKER_M_CSE; // forward disk I/O error
}
if (rker == 0) {
uint16_t* pmem = bufmem;
uint16_t* pdsk = (uint16_t*) &buf;
for (size_t i=0; i<bsize; i++) {
if (*pmem++ != *pdsk++) rker |= kRKER_M_WCE;
}
fRd_nwrd -= bsize;
fRd_addr += 2*bsize;
fRd_lba += 1;
}
// determine abort criterion
bool stop = (rker & ~kRKER_M_WCE) != 0 ||
((rker & kRKER_M_WCE) && (fRd_rkcs & kRKCS_M_SSE));
if (!stop && fRd_nwrd>0) // not error and not yet done
return 1; // requeue
 
} else if (fu == kRKCS_RCHK) { // Read Check --------------------
// Note: no DMA transfer done; done here to keep logic similar to read
size_t bsize = (fRd_nwrd>256) ? 256 : fRd_nwrd;
fRd_nwrd -= bsize;
fRd_addr += 2*bsize;
fRd_lba += 1;
if (rker==0 && fRd_nwrd>0) // not error and not yet done
return 1; // requeue
 
} else {
throw Rexception("Rw11CntlDL11::RdmaHandler",
"Bad state: bad function code");
}
 
// common handling for dma transfer completion
if (fRd_ovr) rker |= kRKER_M_OVR;
 
RlinkCommandList clist;
uint16_t ba = fRd_addr & 0177776; // get lower 16 bits
uint16_t mex = (fRd_addr>>16) & 03; // get upper 2 bits
uint16_t cs = (fRd_rkcs & ~kRKCS_M_MEX) | (mex << kRKCS_V_MEX);
uint16_t se;
uint16_t hd;
uint16_t cy;
unit.Lba2Chs(fRd_lba, cy,hd,se);
uint16_t da = (fRd_rkda & kRKDA_M_DRSEL) | (cy<<kRKDA_V_CYL) |
(hd<<kRKDA_V_SUR) | se;
 
cpu.AddIbrb(clist, fBase);
if (rker) {
cpu.AddWibr(clist, fBase+kRKER, rker);
LogRker(rker);
}
cpu.AddWibr(clist, fBase+kRKWC, uint16_t((-fRd_nwrd)&0177777));
cpu.AddWibr(clist, fBase+kRKBA, ba);
cpu.AddWibr(clist, fBase+kRKDA, da);
if (cs != fRd_rkcs)
cpu.AddWibr(clist, fBase+kRKCS, cs);
cpu.AddWibr(clist, fBase+kRKMR, kRKMR_M_FDONE);
Server().Exec(clist);
 
fRd_busy = false;
 
return 0;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11CntlRK11::LogRker(uint16_t rker)
{
RlogMsg lmsg(LogFile());
lmsg << "-E RK11 er=" << RosPrintBvi(rker,8) << " ERROR ABORT";
}
 
} // end namespace Retro
/tools/src/librw11/Rw11UnitDisk.hpp
0,0 → 1,78
// $Id: Rw11UnitDisk.hpp 509 2013-04-21 20:46:20Z 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-19 507 1.0 Initial version
// 2013-02-19 490 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: Rw11UnitDisk.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class Rw11UnitDisk.
*/
 
#ifndef included_Retro_Rw11UnitDisk
#define included_Retro_Rw11UnitDisk 1
 
#include "Rw11VirtDisk.hpp"
 
#include "Rw11UnitVirt.hpp"
 
namespace Retro {
 
class Rw11UnitDisk : public Rw11UnitVirt<Rw11VirtDisk> {
public:
Rw11UnitDisk(Rw11Cntl* pcntl, size_t index);
~Rw11UnitDisk();
 
virtual void SetType(const std::string& type);
 
const std::string& Type() const;
size_t NCylinder() const;
size_t NHead() const;
size_t NSector() const;
size_t BlockSize() const;
size_t NBlock() const;
 
uint32_t Chs2Lba(uint16_t cy, uint16_t hd, uint16_t se);
void Lba2Chs(uint32_t lba, uint16_t& cy, uint16_t& hd,
uint16_t& se);
 
void SetWProt(bool wprot);
bool WProt() const;
 
bool VirtRead(size_t lba, size_t nblk, uint8_t* data,
RerrMsg& emsg);
bool VirtWrite(size_t lba, size_t nblk, const uint8_t* data,
RerrMsg& emsg);
 
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
 
protected:
std::string fType;
size_t fNCyl;
size_t fNHead;
size_t fNSect;
size_t fBlksize;
size_t fNBlock;
bool fWProt;
};
} // end namespace Retro
 
#include "Rw11UnitDisk.ipp"
 
#endif
/tools/src/librw11/Rw11UnitDisk.ipp
0,0 → 1,116
// $Id: Rw11UnitDisk.ipp 509 2013-04-21 20:46:20Z 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-19 507 1.0 Initial version
// 2013-02-19 490 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11UnitDisk.ipp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation (inline) of Rw11UnitDisk.
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline const std::string& Rw11UnitDisk::Type() const
{
return fType;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline size_t Rw11UnitDisk::NCylinder() const
{
return fNCyl;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline size_t Rw11UnitDisk::NHead() const
{
return fNHead;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline size_t Rw11UnitDisk::NSector() const
{
return fNSect;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline size_t Rw11UnitDisk::BlockSize() const
{
return fBlksize;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline size_t Rw11UnitDisk::NBlock() const
{
return fNBlock;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline uint32_t Rw11UnitDisk::Chs2Lba(uint16_t cy, uint16_t hd, uint16_t se)
{
return se + fNSect * (hd + fNHead*cy);
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline void Rw11UnitDisk::Lba2Chs(uint32_t lba, uint16_t& cy, uint16_t& hd,
uint16_t& se)
{
se = lba % fNSect;
hd = (lba/fNSect) % fNHead;
cy = lba / (fNSect*fNHead);
return;
}
 
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline void Rw11UnitDisk::SetWProt(bool wprot)
{
fWProt = wprot;
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline bool Rw11UnitDisk::WProt() const
{
return fWProt;
}
 
 
} // end namespace Retro
/tools/src/librw11/Rw11CntlRK11.hpp
0,0 → 1,154
// $Id: Rw11CntlRK11.hpp 509 2013-04-21 20:46:20Z 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-20 508 1.0 Initial version
// 2013-02-10 485 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: Rw11CntlRK11.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class Rw11CntlRK11.
*/
 
#ifndef included_Retro_Rw11CntlRK11
#define included_Retro_Rw11CntlRK11 1
 
#include "Rw11CntlBase.hpp"
#include "Rw11UnitRK11.hpp"
 
namespace Retro {
 
class Rw11CntlRK11 : public Rw11CntlBase<Rw11UnitRK11,8> {
public:
 
Rw11CntlRK11();
~Rw11CntlRK11();
 
void Config(const std::string& name, uint16_t base, int lam);
 
virtual void Start();
 
virtual bool BootCode(size_t unit, std::vector<uint16_t>& code,
uint16_t& aload, uint16_t& astart);
 
virtual void UnitSetup(size_t ind);
 
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
 
// some constants (also defined in cpp)
static const uint16_t kIbaddr = 0177400; //!< RK11 default address
static const int kLam = 4; //!< RK11 default lam
 
static const uint16_t kRKDS = 000; //!< RKDS register address offset
static const uint16_t kRKER = 002; //!< RKER register address offset
static const uint16_t kRKCS = 004; //!< RKCS register address offset
static const uint16_t kRKWC = 006; //!< RKWC register address offset
static const uint16_t kRKBA = 010; //!< RKBA register address offset
static const uint16_t kRKDA = 012; //!< RKDA register address offset
static const uint16_t kRKMR = 014; //!< RKMR register address offset
 
static const uint16_t kProbeOff = kRKCS; //!< probe address offset (rkcs)
static const bool kProbeInt = true; //!< probe int active
static const bool kProbeRem = true; //!< probr rem active
 
static const uint16_t kRKDS_M_ID = 0160000; //!< ID: drive number
static const uint16_t kRKDS_V_ID = 13;
static const uint16_t kRKDS_B_ID = 0007;
static const uint16_t kRKDS_M_HDEN = kWBit11; //!< HDEN: high density drv
static const uint16_t kRKDS_M_DRU = kWBit10; //!< DRU: drive unsafe
static const uint16_t kRKDS_M_SIN = kWBit09; //!< SIN: seek incomplete
static const uint16_t kRKDS_M_SOK = kWBit08; //!< SOK: sector counter OK
static const uint16_t kRKDS_M_DRY = kWBit07; //!< DRY: drive ready
static const uint16_t kRKDS_M_ADRY = kWBit06; //!< ADRY: access ready
static const uint16_t kRKDS_M_WPS = kWBit05; //!< WPS: write protect
static const uint16_t kRKDS_B_SC = 0017; //!< SC: sector counter
 
static const uint16_t kRKER_M_DRE = kWBit15;
static const uint16_t kRKER_M_OVR = kWBit14;
static const uint16_t kRKER_M_WLO = kWBit13;
static const uint16_t kRKER_M_PGE = kWBit11;
static const uint16_t kRKER_M_NXM = kWBit10;
static const uint16_t kRKER_M_NXD = kWBit07;
static const uint16_t kRKER_M_NXC = kWBit06;
static const uint16_t kRKER_M_NXS = kWBit05;
static const uint16_t kRKER_M_CSE = kWBit01;
static const uint16_t kRKER_M_WCE = kWBit00;
 
static const uint16_t kRKCS_M_MAINT= kWBit12;
static const uint16_t kRKCS_M_IBA = kWBit11;
static const uint16_t kRKCS_M_FMT = kWBit10;
static const uint16_t kRKCS_M_RWA = kWBit09;
static const uint16_t kRKCS_M_SSE = kWBit08;
static const uint16_t kRKCS_M_MEX = 000060;
static const uint16_t kRKCS_V_MEX = 4;
static const uint16_t kRKCS_B_MEX = 0003;
static const uint16_t kRKCS_V_FUNC = 1;
static const uint16_t kRKCS_B_FUNC = 0007;
static const uint16_t kRKCS_CRESET = 0;
static const uint16_t kRKCS_WRITE = 1;
static const uint16_t kRKCS_READ = 2;
static const uint16_t kRKCS_WCHK = 3;
static const uint16_t kRKCS_SEEK = 4;
static const uint16_t kRKCS_RCHK = 5;
static const uint16_t kRKCS_DRESET = 6;
static const uint16_t kRKCS_WLOCK = 7;
static const uint16_t kRKCS_M_GO = kWBit00;
 
static const uint16_t kRKDA_M_DRSEL= 0160000;
static const uint16_t kRKDA_V_DRSEL= 13;
static const uint16_t kRKDA_B_DRSEL= 0007;
static const uint16_t kRKDA_M_CYL = 0017740;
static const uint16_t kRKDA_V_CYL = 5;
static const uint16_t kRKDA_B_CYL = 0377;
static const uint16_t kRKDA_M_SUR = 0000020;
static const uint16_t kRKDA_V_SUR = 4;
static const uint16_t kRKDA_B_SUR = 0001;
static const uint16_t kRKDA_B_SC = 0017;
 
static const uint16_t kRKMR_M_RID = 0160000;
static const uint16_t kRKMR_V_RID = 13;
static const uint16_t kRKMR_M_CRDONE= kWBit11;
static const uint16_t kRKMR_M_SBCLR = kWBit10;
static const uint16_t kRKMR_M_CRESET= kWBit09;
static const uint16_t kRKMR_M_FDONE = kWBit08;
 
protected:
int AttnHandler(const RlinkServer::AttnArgs& args);
int RdmaHandler();
void LogRker(uint16_t rker);
protected:
size_t fPC_rkwc; //!< PrimClist: rkwc index
size_t fPC_rkba; //!< PrimClist: rkba index
size_t fPC_rkda; //!< PrimClist: rkda index
size_t fPC_rkmr; //!< PrimClist: rkmr index
size_t fPC_rkcs; //!< PrimClist: rkcs index
 
bool fRd_busy; //!< Rdma: busy flag
uint16_t fRd_rkcs; //!< Rdma: request rkcs
uint16_t fRd_rkda; //!< Rdma: request rkda
uint32_t fRd_addr; //!< Rdma: current addr
uint32_t fRd_lba; //!< Rdma: current lba
uint32_t fRd_nwrd; //!< Rdma: current nwrd
bool fRd_ovr; //!< Rdma: overrun condition found
};
} // end namespace Retro
 
//#include "Rw11CntlRK11.ipp"
 
#endif
/tools/src/librw11/Rw11VirtDiskFile.hpp
0,0 → 1,61
// $Id: Rw11VirtDiskFile.hpp 509 2013-04-21 20:46:20Z 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-14 506 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: Rw11VirtDiskFile.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class Rw11VirtDiskFile.
*/
 
#ifndef included_Retro_Rw11VirtDiskFile
#define included_Retro_Rw11VirtDiskFile 1
 
#include "Rw11VirtDisk.hpp"
 
namespace Retro {
 
class Rw11VirtDiskFile : public Rw11VirtDisk {
public:
 
explicit Rw11VirtDiskFile(Rw11Unit* punit);
~Rw11VirtDiskFile();
 
bool Open(const std::string& url, RerrMsg& emsg);
 
virtual bool Read(size_t lba, size_t nblk, uint8_t* data,
RerrMsg& emsg);
virtual bool Write(size_t lba, size_t nblk, const uint8_t* data,
RerrMsg& emsg);
 
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
 
protected:
bool Seek(size_t seekpos, RerrMsg& emsg);
 
protected:
int fFd;
size_t fSize;
};
} // end namespace Retro
 
//#include "Rw11VirtDiskFile.ipp"
 
#endif
/tools/src/librw11/Rw11VirtDisk.hpp
0,0 → 1,71
// $Id: Rw11VirtDisk.hpp 509 2013-04-21 20:46:20Z 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-03-03 494 1.0 Initial version
// 2013-02-13 488 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: Rw11VirtDisk.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class Rw11VirtDisk.
*/
 
#ifndef included_Retro_Rw11VirtDisk
#define included_Retro_Rw11VirtDisk 1
 
#include "Rw11Virt.hpp"
 
namespace Retro {
 
class Rw11VirtDisk : public Rw11Virt {
public:
explicit Rw11VirtDisk(Rw11Unit* punit);
~Rw11VirtDisk();
 
void Setup(size_t blksize, size_t nblock);
size_t BlockSize() const;
size_t NBlock() const;
 
virtual bool Read(size_t lba, size_t nblk, uint8_t* data,
RerrMsg& emsg) = 0;
virtual bool Write(size_t lba, size_t nblk, const uint8_t* data,
RerrMsg& emsg) = 0;
 
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
 
static Rw11VirtDisk* New(const std::string& url, Rw11Unit* punit,
RerrMsg& emsg);
 
// statistics counter indices
enum stats {
kStatNVDRead = Rw11Virt::kDimStat,
kStatNVDReadBlk,
kStatNVDWrite,
kStatNVDWriteBlk,
kDimStat
};
 
protected:
size_t fBlkSize; //<! block size in byte
size_t fNBlock; //<! disk size in blocks
};
} // end namespace Retro
 
#include "Rw11VirtDisk.ipp"
 
#endif
/tools/src/librw11/Rw11VirtDisk.ipp
0,0 → 1,55
// $Id: Rw11VirtDisk.ipp 509 2013-04-21 20:46:20Z 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-03-03 494 1.0 Initial version
// 2013-02-19 490 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11VirtDisk.ipp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation (inline) of Rw11VirtDisk.
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline void Rw11VirtDisk::Setup(size_t blksize, size_t nblock)
{
fBlkSize = blksize;
fNBlock = nblock;
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline size_t Rw11VirtDisk::BlockSize() const
{
return fBlkSize;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline size_t Rw11VirtDisk::NBlock() const
{
return fNBlock;
}
 
} // end namespace Retro
/tools/src/librw11/Makefile
25,9 → 25,12
OBJ_all += Rw11Probe.o
OBJ_all += Rw11Cntl.o Rw11Unit.o
OBJ_all += Rw11UnitTerm.o
OBJ_all += Rw11UnitDisk.o
OBJ_all += Rw11CntlDL11.o Rw11UnitDL11.o
OBJ_all += Rw11CntlRK11.o Rw11UnitRK11.o
OBJ_all += Rw11Virt.o
OBJ_all += Rw11VirtTerm.o Rw11VirtTermPty.o Rw11VirtTermTcp.o
OBJ_all += Rw11VirtDisk.o Rw11VirtDiskFile.o
#
DEP_all = $(OBJ_all:.o=.dep)
#
/tools/src/librw11/Rw11UnitDiskBase.hpp
0,0 → 1,57
// $Id: Rw11UnitDiskBase.hpp 509 2013-04-21 20:46:20Z 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-14 506 1.0 Initial version
// 2013-02-22 490 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: Rw11UnitDiskBase.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class Rw11UnitDiskBase.
*/
 
#ifndef included_Retro_Rw11UnitDiskBase
#define included_Retro_Rw11UnitDiskBase 1
 
#include "Rw11UnitDisk.hpp"
 
namespace Retro {
 
template <class TC>
class Rw11UnitDiskBase : public Rw11UnitDisk {
public:
 
Rw11UnitDiskBase(TC* pcntl, size_t index);
~Rw11UnitDiskBase();
 
TC& Cntl() const;
 
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
 
protected:
virtual void AttachSetup();
virtual void DetachCleanup();
 
protected:
TC* fpCntl;
};
} // end namespace Retro
 
#include "Rw11UnitDiskBase.ipp"
 
#endif
/tools/src/librw11/Rw11UnitDiskBase.ipp
0,0 → 1,98
// $Id: Rw11UnitDiskBase.ipp 509 2013-04-21 20:46:20Z 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-14 506 1.0 Initial version
// 2013-02-22 490 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11UnitDiskBase.ipp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation (inline) of Rw11UnitDiskBase.
*/
 
#include "Rw11UnitDiskBase.hpp"
 
/*!
\class Retro::Rw11UnitDiskBase
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Default constructor
 
template <class TC>
Rw11UnitDiskBase<TC>::Rw11UnitDiskBase(TC* pcntl, size_t index)
: Rw11UnitDisk(pcntl, index),
fpCntl(pcntl)
{}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
template <class TC>
Rw11UnitDiskBase<TC>::~Rw11UnitDiskBase()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
template <class TC>
inline TC& Rw11UnitDiskBase<TC>::Cntl() const
{
return *fpCntl;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
template <class TC>
void Rw11UnitDiskBase<TC>::Dump(std::ostream& os, int ind,
const char* text) const
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11UnitDiskBase @ " << this << std::endl;
os << bl << " fpCntl: " << fpCntl << std::endl;
Rw11UnitDisk::Dump(os, ind, " ^");
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
template <class TC>
void Rw11UnitDiskBase<TC>::AttachSetup()
{
Virt()->Setup(BlockSize(), NBlock());
Cntl().UnitSetup(Index());
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
template <class TC>
void Rw11UnitDiskBase<TC>::DetachCleanup()
{
SetWProt(false);
Cntl().UnitSetup(Index());
return;
}
 
} // end namespace Retro
/tools/src/librw11/Rw11Cntl.hpp
1,4 → 1,4
// $Id: Rw11Cntl.hpp 495 2013-03-06 17:13:48Z mueller $
// $Id: Rw11Cntl.hpp 508 2013-04-20 18:43:28Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
20,7 → 20,7
 
/*!
\file
\version $Id: Rw11Cntl.hpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: Rw11Cntl.hpp 508 2013-04-20 18:43:28Z mueller $
\brief Declaration of class Rw11Cntl.
*/
 
105,7 → 105,7
bool fEnable; //!< enable flag
bool fStarted; //!< true if Start() called
Rw11Probe fProbe; //!< controller probe context
uint32_t fTraceLevel; //!< trace level; 0=off;1=attn
uint32_t fTraceLevel; //!< trace level; 0=off;1=cntl
RlinkCommandList fPrimClist; //!< clist for attn primary info
Rstats fStats; //!< statistics
};
/tools/src/librw11/Rw11UnitTerm.cpp
1,4 → 1,4
// $Id: Rw11UnitTerm.cpp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11UnitTerm.cpp 508 2013-04-20 18:43:28Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
19,7 → 19,7
 
/*!
\file
\version $Id: Rw11UnitTerm.cpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11UnitTerm.cpp 508 2013-04-20 18:43:28Z mueller $
\brief Implemenation of Rw11UnitTerm.
*/
 
26,7 → 26,9
#include "boost/thread/locks.hpp"
#include "boost/bind.hpp"
 
#include "librtools/RparseUrl.hpp"
#include "librtools/RosPrintf.hpp"
#include "librtools/Rexception.hpp"
 
#include "Rw11UnitTerm.hpp"
 
45,9 → 47,19
 
Rw11UnitTerm::Rw11UnitTerm(Rw11Cntl* pcntl, size_t index)
: Rw11UnitVirt<Rw11VirtTerm>(pcntl, index),
fRcv7bit(false),
fRcvQueue()
{}
fTo7bit(false),
fToEnpc(false),
fTi7bit(false),
fRcvQueue(),
fLogFname(),
fLogStream(),
fLogOptCrlf(false),
fLogCrPend(false),
fLogLfLast(false)
{
fStats.Define(kStatNPreAttDrop, "NPreAttDrop",
"snd bytes dropped prior attach");
}
 
//------------------------------------------+-----------------------------------
//! Destructor
68,6 → 80,42
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11UnitTerm::SetLog(const std::string& fname)
{
if (fLogStream.is_open()) {
if (fLogCrPend) fLogStream << "\r";
fLogCrPend = false;
fLogStream.close();
}
fLogFname.clear();
if (fname.length() == 0) return;
 
RparseUrl purl;
RerrMsg emsg;
if (!purl.Set(fname, "|app|crlf|", emsg))
throw Rexception(emsg);
 
ios_base::openmode mode = ios_base::out;
if (purl.FindOpt("app")) mode |= ios_base::app;
 
fLogStream.open(purl.Path(), mode);
if (!fLogStream.is_open()) {
throw Rexception("Rw11UnitTerm::SetLog",
string("failed to open '")+purl.Path()+"'");
}
 
fLogFname = fname;
fLogOptCrlf = purl.FindOpt("crlf");
fLogCrPend = false;
fLogLfLast = false;
 
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool Rw11UnitTerm::RcvQueueEmpty()
{
return fRcvQueue.empty();
111,12 → 159,75
bool Rw11UnitTerm::Snd(const uint8_t* buf, size_t count)
{
bool ok = true;
if (fpVirt) {
vector<uint8_t> bufmod;
const uint8_t* bufout = buf;
size_t bufcnt = count;
 
if (fTo7bit || fToEnpc) {
for (size_t i=0; i<count; i++) {
uint8_t ochr = buf[i];
if (fTo7bit) ochr &= 0177;
if (fToEnpc) {
if ((ochr>=040 && ochr<177) ||
ochr=='\t' || ochr=='\n' || ochr=='\r') {
bufmod.push_back(ochr);
} else {
if (ochr != 0) {
bufmod.push_back('<');
bufmod.push_back('0' + ((ochr>>6)&07) );
bufmod.push_back('0' + ((ochr>>3)&07) );
bufmod.push_back('0' + (ochr &07) );
bufmod.push_back('>');
}
}
} else {
bufmod.push_back(ochr);
}
}
bufout = bufmod.data();
bufcnt = bufmod.size();
}
 
if (fLogStream.is_open()) {
for (size_t i=0; i<bufcnt; i++) {
uint8_t ochr = bufout[i];
// the purpose of the 'crlf' filter is to map
// \r\n -> \n
// \r\r\n -> \n (any number of \r)
// \n\r -> \n
// \n\r\r -> \n (any number of \r)
// and to ignore \0 chars
if (fLogOptCrlf) { // crlf filtering on
if (ochr == 0) continue; // ignore \0 chars
if (fLogCrPend) {
if (ochr == '\r') continue; // collapes multiple \r
if (ochr != '\n') fLogStream << '\r'; // log \r if not followed by \n
fLogCrPend = false;
}
if (ochr == '\r') { // \r seen
fLogCrPend = !fLogLfLast; // remember \r if last wasn't \n
continue;
}
}
fLogStream << char(ochr);
fLogLfLast = (ochr == '\n');
}
}
 
if (fpVirt) { // if virtual device attached
RerrMsg emsg;
ok = fpVirt->Snd(buf, count, emsg);
ok = fpVirt->Snd(bufout, bufcnt, emsg);
// FIXME_code: handler errors
} else {
for (size_t i=0; i<count; i++) cout << buf[i] << flush;
} else { // no virtual device attached
if (Name() == "tta0") { // is it main console ?
for (size_t i=0; i<bufcnt; i++) { // than print to stdout
cout << char(bufout[i]) << flush;
}
} else { // otherwise discard
fStats.Inc(kStatNPreAttDrop); // and count at least...
}
}
return ok;
}
131,7 → 242,11
boost::lock_guard<RlinkConnect> lock(Connect());
 
bool que_empty_old = fRcvQueue.empty();
for (size_t i=0; i<count; i++) fRcvQueue.push_back(buf[i]);
for (size_t i=0; i<count; i++) {
uint8_t ichr = buf[i];
if (fTi7bit) ichr &= 0177;
fRcvQueue.push_back(ichr);
}
bool que_empty_new = fRcvQueue.empty();
if (que_empty_old && !que_empty_new) WakeupCntl();
return true;
153,7 → 268,9
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11UnitTerm @ " << this << endl;
 
os << bl << " fRcv7bit: " << fRcv7bit << endl;
os << bl << " fTo7bit: " << fTo7bit << endl;
os << bl << " fToEnpc: " << fToEnpc << endl;
os << bl << " fTi7bit: " << fTi7bit << endl;
{
boost::lock_guard<RlinkConnect> lock(Connect());
size_t size = fRcvQueue.size();
179,6 → 296,12
}
}
os << bl << " fLogFname: " << fLogFname << endl;
os << bl << " fLogStream.is_open: " << fLogStream.is_open() << endl;
os << bl << " fLogOptCrlf: " << fLogOptCrlf << endl;
os << bl << " fLogCrPend: " << fLogCrPend << endl;
os << bl << " fLogLfLast: " << fLogLfLast << endl;
 
Rw11UnitVirt<Rw11VirtTerm>::Dump(os, ind, " ^");
return;
}
/tools/src/librw11/Rw11UnitTerm.hpp
1,4 → 1,4
// $Id: Rw11UnitTerm.hpp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11UnitTerm.hpp 508 2013-04-20 18:43:28Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-20 508 1.0.1 add 7bit and non-printable masking; add log file
// 2013-04-13 504 1.0 Initial version
// 2013-02-19 490 0.1 First draft
// ---------------------------------------------------------------------------
20,7 → 21,7
 
/*!
\file
\version $Id: Rw11UnitTerm.hpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11UnitTerm.hpp 508 2013-04-20 18:43:28Z mueller $
\brief Declaration of class Rw11UnitTerm.
*/
 
27,6 → 28,8
#ifndef included_Retro_Rw11UnitTerm
#define included_Retro_Rw11UnitTerm 1
 
#include <iostream>
#include <fstream>
#include <deque>
 
#include "Rw11VirtTerm.hpp"
42,9 → 45,16
 
const std::string& ChannelId() const;
 
void SetRcv7bit(bool rcv7bit);
bool Rcv7bit() const;
void SetTo7bit(bool to7bit);
void SetToEnpc(bool toenpc);
void SetTi7bit(bool ti7bit);
bool To7bit() const;
bool ToEnpc() const;
bool Ti7bit() const;
 
void SetLog(const std::string& fname);
const std::string& Log() const;
 
virtual bool RcvQueueEmpty();
virtual size_t RcvQueueSize();
virtual uint8_t RcvNext();
57,12 → 67,25
 
virtual void Dump(std::ostream& os, int ind=0, const char* text=0) const;
 
// statistics counter indices
enum stats {
kStatNPreAttDrop = Rw11Unit::kDimStat,
kDimStat
};
protected:
virtual void AttachSetup();
 
protected:
bool fRcv7bit; //<! discard parity bit on input
bool fTo7bit; //<! discard parity bit on output
bool fToEnpc; //<! escape non-printabls on output
bool fTi7bit; //<! discard parity bit on input
std::deque<uint8_t> fRcvQueue; //<! input queue
std::string fLogFname; //<! log file name
std::ofstream fLogStream; //<! log file stream
bool fLogOptCrlf; //<! log file: crlf option given
bool fLogCrPend; //<! log file: cr pending
bool fLogLfLast; //<! log file: lf was last char
};
} // end namespace Retro
/tools/src/librw11/Rw11VirtTerm.cpp
1,4 → 1,4
// $Id: Rw11VirtTerm.cpp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11VirtTerm.cpp 508 2013-04-20 18:43:28Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
19,7 → 19,7
 
/*!
\file
\version $Id: Rw11VirtTerm.cpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11VirtTerm.cpp 508 2013-04-20 18:43:28Z mueller $
\brief Implemenation of Rw11VirtTerm.
*/
#include <memory>
49,10 → 49,10
fChannelId(),
fRcvCb()
{
fStats.Define(kStatNVTRcvPoll, "NVTRcvPoll", "RcvPollHandler() calls");
fStats.Define(kStatNVTSnd, "NVTSnd", "Snd() calls");
fStats.Define(kStatNVTRcvByt, "NVTRcvByt", "bytes received");
fStats.Define(kStatNVTSndByt, "NVTSndByt", "bytes send");
fStats.Define(kStatNVTRcvPoll, "NVTRcvPoll", "VT RcvPollHandler() calls");
fStats.Define(kStatNVTSnd, "NVTSnd", "VT Snd() calls");
fStats.Define(kStatNVTRcvByt, "NVTRcvByt", "VT bytes received");
fStats.Define(kStatNVTSndByt, "NVTSndByt", "VT bytes send");
}
 
//------------------------------------------+-----------------------------------
/tools/src/librw11/Rw11UnitTerm.ipp
1,4 → 1,4
// $Id: Rw11UnitTerm.ipp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11UnitTerm.ipp 508 2013-04-20 18:43:28Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-20 508 1.0.1 add 7bit and non-printable masking; add log file
// 2013-04-13 504 1.0 Initial version
// 2013-03-02 493 0.1 First draft
// ---------------------------------------------------------------------------
19,7 → 20,7
 
/*!
\file
\version $Id: Rw11UnitTerm.ipp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11UnitTerm.ipp 508 2013-04-20 18:43:28Z mueller $
\brief Implemenation (inline) of Rw11UnitTerm.
*/
 
29,9 → 30,9
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline void Rw11UnitTerm::SetRcv7bit(bool rcv7bit)
inline void Rw11UnitTerm::SetTo7bit(bool to7bit)
{
fRcv7bit = rcv7bit;
fTo7bit = to7bit;
return;
}
 
38,9 → 39,51
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline bool Rw11UnitTerm::Rcv7bit() const
inline void Rw11UnitTerm::SetToEnpc(bool toenpc)
{
return fRcv7bit;
fToEnpc = toenpc;
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline void Rw11UnitTerm::SetTi7bit(bool ti7bit)
{
fTi7bit = ti7bit;
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline bool Rw11UnitTerm::To7bit() const
{
return fTo7bit;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline bool Rw11UnitTerm::ToEnpc() const
{
return fToEnpc;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline bool Rw11UnitTerm::Ti7bit() const
{
return fTi7bit;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
inline const std::string& Rw11UnitTerm::Log() const
{
return fLogFname;
}
 
} // end namespace Retro
/tools/src/librw11/Rw11UnitRK11.cpp
0,0 → 1,78
// $Id: Rw11UnitRK11.cpp 509 2013-04-21 20:46:20Z 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-20 508 1.0 Initial version
// 2013-02-05 483 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: Rw11UnitRK11.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of Rw11UnitRK11.
*/
 
#include "boost/bind.hpp"
 
#include "librtools/RosFill.hpp"
#include "Rw11CntlRK11.hpp"
 
#include "Rw11UnitRK11.hpp"
 
using namespace std;
 
/*!
\class Retro::Rw11UnitRK11
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Constructor
 
Rw11UnitRK11::Rw11UnitRK11(Rw11CntlRK11* pcntl, size_t index)
: Rw11UnitDiskBase<Rw11CntlRK11>(pcntl, index),
fRkds(0)
{
// setup disk geometry: only rk05 supported, no rk05f !
fType = "rk05";
fNCyl = 203;
fNHead = 2;
fNSect = 12;
fBlksize = 512;
fNBlock = fNCyl*fNHead*fNSect;
}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
Rw11UnitRK11::~Rw11UnitRK11()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void Rw11UnitRK11::Dump(std::ostream& os, int ind, const char* text) const
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11UnitRK11 @ " << this << endl;
os << bl << " fRkds: " << fRkds << endl;
 
Rw11UnitDiskBase<Rw11CntlRK11>::Dump(os, ind, " ^");
return;
}
} // end namespace Retro
/tools/src/librw11/Rw11CntlDL11.cpp
1,4 → 1,4
// $Id: Rw11CntlDL11.cpp 504 2013-04-13 15:37:24Z mueller $
// $Id: Rw11CntlDL11.cpp 508 2013-04-20 18:43:28Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-20 508 1.0.1 add trace support
// 2013-03-06 495 1.0 Initial version
// 2013-02-05 483 0.1 First draft
// ---------------------------------------------------------------------------
19,7 → 20,7
 
/*!
\file
\version $Id: Rw11CntlDL11.cpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: Rw11CntlDL11.cpp 508 2013-04-20 18:43:28Z mueller $
\brief Implemenation of Rw11CntlDL11.
*/
 
26,7 → 27,10
#include "boost/bind.hpp"
 
#include "librtools/RosFill.hpp"
#include "librtools/RosPrintBvi.hpp"
#include "librtools/RosPrintf.hpp"
#include "librtools/Rexception.hpp"
#include "librtools/RlogMsg.hpp"
 
#include "Rw11CntlDL11.hpp"
 
141,6 → 145,8
{
RosFill bl(ind);
os << bl << (text?text:"--") << "Rw11CntlDL11 @ " << this << endl;
os << bl << " fPC_xbuf: " << fPC_xbuf << endl;
 
Rw11CntlBase<Rw11UnitDL11,1>::Dump(os, ind, " ^");
return;
}
161,6 → 167,42
bool xval = xbuf & kXBUF_M_XVAL;
bool rrdy = xbuf & kXBUF_M_RRDY;
 
if (fTraceLevel>0) {
RlogMsg lmsg(LogFile());
lmsg << "-I DL11." << Name()
<< " xbuf=" << RosPrintBvi(xbuf,8)
<< " xval=" << xval
<< " rrdy=" << rrdy
<< " rcvq=" << RosPrintf(fspUnit[0]->RcvQueueSize(),"d",3);
if (xval) {
lmsg << " char=";
if (ochr>=040 && ochr<0177) {
lmsg << "'" << char(ochr) << "'";
} else {
lmsg << RosPrintBvi(ochr,8);
lmsg << " " << ((ochr&0200) ? "|" : " ");
uint8_t ochr7 = ochr & 0177;
if (ochr7 < 040) {
switch (ochr7) {
case 010: lmsg << "BS"; break;
case 011: lmsg << "HT"; break;
case 012: lmsg << "LF"; break;
case 013: lmsg << "VT"; break;
case 014: lmsg << "FF"; break;
case 015: lmsg << "CR"; break;
default: lmsg << "^" << char('A'+ochr7);
}
} else {
if (ochr7 < 0177) {
lmsg << "'" << char(ochr7) << "'";
} else {
lmsg << "DEL";
}
}
}
}
}
 
if (xval) {
fspUnit[0]->Snd(&ochr, 1);
}
/tools/src/librwxxtpp/RtclRw11CntlRK11.cpp
0,0 → 1,94
// $Id: RtclRw11CntlRK11.cpp 509 2013-04-21 20:46:20Z 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-03-06 495 1.0 Initial version
// 2013-02-02 480 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: RtclRw11CntlRK11.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of RtclRw11CntlRK11.
*/
 
#include "librtcltools/RtclNameSet.hpp"
 
#include "RtclRw11CntlRK11.hpp"
#include "RtclRw11UnitRK11.hpp"
 
using namespace std;
 
/*!
\class Retro::RtclRw11CntlRK11
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Constructor
 
RtclRw11CntlRK11::RtclRw11CntlRK11()
: RtclRw11CntlBase<Rw11CntlRK11>("Rw11CntlRK11")
{}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
RtclRw11CntlRK11::~RtclRw11CntlRK11()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int RtclRw11CntlRK11::FactoryCmdConfig(RtclArgs& args, RtclRw11Cpu& cpu)
{
static RtclNameSet optset("-base|-lam");
 
string cntlname(cpu.Obj().NextCntlName("rk"));
string cntlcmd = cpu.CommandName() + cntlname;
 
uint16_t base = Rw11CntlRK11::kIbaddr;
int lam = Rw11CntlRK11::kLam;
string opt;
while (args.NextOpt(opt, optset)) {
if (opt == "-base") {
if (!args.GetArg("base", base, 0177776, 0160000)) return kERR;
} else if (opt == "-lam") {
if (!args.GetArg("lam", lam, 0, 15)) return kERR;
}
}
if (!args.AllDone()) return kERR;
 
// configure controller
Obj().Config(cntlname, base, lam);
 
// install in CPU
cpu.Obj().AddCntl(dynamic_pointer_cast<Rw11Cntl>(ObjSPtr()));
// finally create tcl command
CreateObjectCmd(args.Interp(), cntlcmd.c_str());
 
// and create unit commands
for (size_t i=0; i<Obj().NUnit(); i++) {
string unitcmd = cpu.CommandName() + Obj().UnitName(i);
new RtclRw11UnitRK11(args.Interp(), unitcmd, Obj().UnitSPtr(i));
}
 
return kOK;
}
 
} // end namespace Retro
/tools/src/librwxxtpp/RtclRw11UnitDisk.hpp
0,0 → 1,52
// $Id: RtclRw11UnitDisk.hpp 509 2013-04-21 20:46:20Z 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-19 507 1.0 Initial version
// 2013-02-22 490 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: RtclRw11UnitDisk.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class RtclRw11UnitDisk.
*/
 
#ifndef included_Retro_RtclRw11UnitDisk
#define included_Retro_RtclRw11UnitDisk 1
 
#include "librw11/Rw11UnitDisk.hpp"
 
#include "RtclRw11Unit.hpp"
 
namespace Retro {
 
class RtclRw11UnitDisk {
public:
RtclRw11UnitDisk(RtclRw11Unit* ptcl, Rw11UnitDisk* pobj);
~RtclRw11UnitDisk();
 
protected:
 
protected:
RtclRw11Unit* fpTcl;
Rw11UnitDisk* fpObj;
};
} // end namespace Retro
 
//#include "RtclRw11UnitDisk.ipp"
 
#endif
/tools/src/librwxxtpp/RtclRw11CntlRK11.hpp
0,0 → 1,47
// $Id: RtclRw11CntlRK11.hpp 509 2013-04-21 20:46:20Z 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-03-06 495 1.0 Initial version
// 2013-02-08 484 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: RtclRw11CntlRK11.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class RtclRw11CntlRK11.
*/
 
#ifndef included_Retro_RtclRw11CntlRK11
#define included_Retro_RtclRw11CntlRK11 1
 
#include "RtclRw11CntlBase.hpp"
#include "librw11/Rw11CntlRK11.hpp"
 
namespace Retro {
 
class RtclRw11CntlRK11 : public RtclRw11CntlBase<Rw11CntlRK11> {
public:
RtclRw11CntlRK11();
~RtclRw11CntlRK11();
 
virtual int FactoryCmdConfig(RtclArgs& args, RtclRw11Cpu& cpu);
};
} // end namespace Retro
 
//#include "RtclRw11CntlRK11.ipp"
 
#endif
/tools/src/librwxxtpp/RtclRw11Cpu.cpp
1,4 → 1,4
// $Id: RtclRw11Cpu.cpp 504 2013-04-13 15:37:24Z mueller $
// $Id: RtclRw11Cpu.cpp 511 2013-04-27 13:51:46Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-26 511 1.0.1 add M_show
// 2013-04-02 502 1.0 Initial version
// 2013-02-02 480 0.1 First draft
// ---------------------------------------------------------------------------
19,7 → 20,7
 
/*!
\file
\version $Id: RtclRw11Cpu.cpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: RtclRw11Cpu.cpp 511 2013-04-27 13:51:46Z mueller $
\brief Implemenation of RtclRw11Cpu.
*/
 
34,6 → 35,7
#include <sstream>
 
#include "boost/bind.hpp"
#include "boost/thread/locks.hpp"
 
#include "librtools/RerrMsg.hpp"
#include "librtools/RlogMsg.hpp"
81,6 → 83,7
AddMeth("get", boost::bind(&RtclRw11Cpu::M_get, this, _1));
AddMeth("set", boost::bind(&RtclRw11Cpu::M_set, this, _1));
AddMeth("stats", boost::bind(&RtclRw11Cpu::M_stats, this, _1));
AddMeth("show", boost::bind(&RtclRw11Cpu::M_show, this, _1));
AddMeth("dump", boost::bind(&RtclRw11Cpu::M_dump, this, _1));
AddMeth("$default", boost::bind(&RtclRw11Cpu::M_default, this, _1));
}
818,6 → 821,166
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int RtclRw11Cpu::M_show(RtclArgs& args)
{
static RtclNameSet optset("-pcps|-r0r5|-mmu|-ubmap"
);
 
string opt;
uint16_t base = Obj().Base();
ostringstream sos;
RerrMsg emsg;
 
const char* mode[4] = {"k","s","?","u"};
const char* rust[16] = {"init", "HALTed", "reset", "stopped",
"stepped", "suspend", "0110", "..run..",
"F:vecfet", "F:redstk", "1010", "1011",
"F:seq", "F:vmbox" , "1101", "1111"};
 
while (args.NextOpt(opt, optset)) {
if (opt == "-pcps") {
RlinkCommandList clist;
size_t i_pc = clist.AddRreg(base + Rw11Cpu::kCp_addr_pc);
size_t i_sp = clist.AddRreg(base + Rw11Cpu::kCp_addr_r0+6);
size_t i_psw = clist.AddRreg(base + Rw11Cpu::kCp_addr_psw);
size_t i_stat = clist.AddRreg(base + Rw11Cpu::kCp_addr_stat);
if (!Server().Exec(clist, emsg)) return args.Quit(emsg);
uint16_t psw = clist[i_psw].Data();
uint16_t stat = clist[i_stat].Data();
uint16_t psw_cm = (psw>>14) & 003;
uint16_t psw_pm = (psw>>12) & 003;
uint16_t psw_set = (psw>>11) & 001;
uint16_t psw_pri = (psw>>5) & 007;
uint16_t psw_tbit = (psw>>4) & 001;
uint16_t psw_nzvc = (psw) & 017;
uint16_t stat_rust = (stat>>4) & 017;
sos << "PC=" << RosPrintBvi(clist[i_pc].Data(),8)
<< " SP=" << RosPrintBvi(clist[i_sp].Data(),8)
<< " PS=" << RosPrintBvi(psw,8)
<< " cm,pm=" << mode[psw_cm] << "," << mode[psw_pm]
<< " s,p,t=" << psw_set << "," << psw_pri << "," << psw_tbit
<< " NZVC=" << RosPrintBvi(psw_nzvc,2,4)
<< " rust=" << RosPrintBvi(stat_rust,8,4) << " " << rust[stat_rust]
<< endl;
 
} else if (opt == "-r0r5") {
RlinkCommandList clist;
for (size_t i=0; i<6; i++) clist.AddRreg(base + Rw11Cpu::kCp_addr_r0+i);
if (!Server().Exec(clist, emsg)) return args.Quit(emsg);
sos << "R0-R5:";
for (size_t i=0; i<6; i++) sos << " " << RosPrintBvi(clist[i].Data(),8);
sos << endl;
 
} else if (opt == "-mmu") {
uint16_t mmr[4];
uint16_t asr[3][32];
const char* pmode[3] = {"km","sm","um"};
const char* acf[8] = {"nres ",
"r -r ",
"r ",
"011 ",
"rw-rw",
"rw- w",
"rw ",
"111 "};
{
boost::lock_guard<RlinkConnect> lock(Connect());
RlinkCommandList clist;
clist.AddWreg(base + Rw11Cpu::kCp_addr_al, 0177572);
clist.AddRblk(base + Rw11Cpu::kCp_addr_memi, mmr, 3);
clist.AddWreg(base + Rw11Cpu::kCp_addr_al, 0172516);
clist.AddRblk(base + Rw11Cpu::kCp_addr_memi, mmr+3, 1);
if (!Server().Exec(clist, emsg)) return args.Quit(emsg);
clist.Clear();
clist.AddWreg(base + Rw11Cpu::kCp_addr_al, 0172300);
clist.AddRblk(base + Rw11Cpu::kCp_addr_memi, asr[0], 32);
clist.AddWreg(base + Rw11Cpu::kCp_addr_al, 0172200);
clist.AddRblk(base + Rw11Cpu::kCp_addr_memi, asr[1], 32);
clist.AddWreg(base + Rw11Cpu::kCp_addr_al, 0177600);
clist.AddRblk(base + Rw11Cpu::kCp_addr_memi, asr[2], 32);
if (!Server().Exec(clist, emsg)) return args.Quit(emsg);
}
uint16_t mmr1_0_reg = (mmr[1] ) & 07;
int16_t mmr1_0_val = (mmr[1]>> 3) & 37;
uint16_t mmr1_1_reg = (mmr[1]>> 8) & 07;
int16_t mmr1_1_val = (mmr[1]>>11) & 37;
uint16_t mmr3_ubmap = (mmr[3]>> 5) & 01;
uint16_t mmr3_22bit = (mmr[3]>> 4) & 01;
uint16_t mmr3_d_km = (mmr[3]>> 2) & 01;
uint16_t mmr3_d_sm = (mmr[3]>> 1) & 01;
uint16_t mmr3_d_um = (mmr[3] ) & 01;
sos << "mmu:" << endl;
sos << "mmr0=" << RosPrintBvi(mmr[0],8) << endl;
if (mmr1_0_val & 020) mmr1_0_val |= 0177740;
if (mmr1_1_val & 020) mmr1_1_val |= 0177740;
sos << "mmr1=" << RosPrintBvi(mmr[1],8);
if (mmr1_0_val) sos << " r" << mmr1_0_reg
<< ":" << RosPrintf(mmr1_0_val,"d",3);
if (mmr1_1_val) sos << " r" << mmr1_1_reg
<< ":" << RosPrintf(mmr1_1_val,"d",3);
sos << endl;
sos << "mmr2=" << RosPrintBvi(mmr[2],8) << endl;
sos << "mmr3=" << RosPrintBvi(mmr[3],8)
<< " ubmap=" << mmr3_ubmap
<< " 22bit=" << mmr3_22bit
<< " d-space k,s,u=" << mmr3_d_km
<< "," << mmr3_d_sm << "," << mmr3_d_um << endl;
for (size_t m=0; m<3; m++) {
sos << pmode[m] << " "
<< " I pdr slf aw d acf I par"
<< " "
<< " D pdr slf aw d acf D par" << endl;
for (size_t i=0; i<=7; i++) {
sos << " " << i << " ";
for (size_t s=0; s<=1; s++) {
if (s!=0) sos << " ";
uint16_t pdr = asr[m][i +8*s];
uint16_t par = asr[m][i+16+8*s];
uint16_t pdr_slf = (pdr>>8) & 0177;
uint16_t pdr_a = (pdr>>7) & 01;
uint16_t pdr_w = (pdr>>6) & 01;
uint16_t pdr_e = (pdr>>3) & 01;
uint16_t pdr_acf = (pdr) & 07;
sos<< RosPrintBvi(pdr,8)
<< " " << RosPrintf(pdr_slf,"d",3)
<< " " << pdr_a << pdr_w
<< " " << (pdr_e ? "d" : "u")
<< " " << acf[pdr_acf]
<< " " << RosPrintBvi(par,8);
}
sos << endl;
}
}
 
} else if (opt == "-ubmap") {
uint16_t ubmap[64];
RlinkCommandList clist;
clist.AddWreg(base + Rw11Cpu::kCp_addr_al, 0170200);
clist.AddRblk(base + Rw11Cpu::kCp_addr_memi, ubmap, 64);
if (!Server().Exec(clist, emsg)) return args.Quit(emsg);
sos << "unibus map:" << endl;
for (size_t i = 0; i<=7; i++) {
for (size_t j = 0; j <= 030; j+=010) {
size_t k = 2*(i+j);
uint32_t data = uint32_t(ubmap[k]) | (uint32_t(ubmap[k+1]))<<16;
if (j!=0) sos << " ";
sos << RosPrintBvi(j+i,8,5) << " "
<< RosPrintBvi(data,8,22);
}
sos << endl;
}
}
}
 
if (!args.AllDone()) return kERR;
args.SetResult(sos);
 
return kOK;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int RtclRw11Cpu::M_stats(RtclArgs& args)
{
RtclStats::Context cntx;
/tools/src/librwxxtpp/Makefile
28,7 → 28,9
OBJ_all += RtclRw11Cntl.o RtclRw11CntlFactory.o
OBJ_all += RtclRw11Unit.o
OBJ_all += RtclRw11UnitTerm.o
OBJ_all += RtclRw11UnitDisk.o
OBJ_all += RtclRw11CntlDL11.o RtclRw11UnitDL11.o
OBJ_all += RtclRw11CntlRK11.o RtclRw11UnitRK11.o
#
DEP_all = $(OBJ_all:.o=.dep)
#
/tools/src/librwxxtpp/RtclRw11Cpu.hpp
1,4 → 1,4
// $Id: RtclRw11Cpu.hpp 504 2013-04-13 15:37:24Z mueller $
// $Id: RtclRw11Cpu.hpp 511 2013-04-27 13:51:46Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-26 511 1.0.1 add M_show
// 2013-04-02 502 1.0 Initial version
// 2013-02-02 480 0.1 First draft
// ---------------------------------------------------------------------------
20,7 → 21,7
 
/*!
\file
\version $Id: RtclRw11Cpu.hpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: RtclRw11Cpu.hpp 511 2013-04-27 13:51:46Z mueller $
\brief Declaration of class RtclRw11Cpu.
*/
 
60,6 → 61,7
int M_boot(RtclArgs& args);
int M_get(RtclArgs& args);
int M_set(RtclArgs& args);
int M_show(RtclArgs& args);
int M_stats(RtclArgs& args);
int M_dump(RtclArgs& args);
int M_default(RtclArgs& args);
/tools/src/librwxxtpp/RtclRw11UnitTerm.cpp
1,4 → 1,4
// $Id: RtclRw11UnitTerm.cpp 504 2013-04-13 15:37:24Z mueller $
// $Id: RtclRw11UnitTerm.cpp 511 2013-04-27 13:51:46Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-26 511 1.0.1 add M_type
// 2013-03-03 494 1.0 Initial version
// 2013-03-01 493 0.1 First draft
// ---------------------------------------------------------------------------
19,7 → 20,7
 
/*!
\file
\version $Id: RtclRw11UnitTerm.cpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: RtclRw11UnitTerm.cpp 511 2013-04-27 13:51:46Z mueller $
\brief Implemenation of RtclRw11UnitTerm.
*/
 
42,16 → 43,30
: fpTcl(ptcl),
fpObj(pobj)
{
ptcl->AddMeth("type", boost::bind(&RtclRw11UnitTerm::M_type, this, _1));
 
RtclGetList& gets = ptcl->GetList();
RtclSetList& sets = ptcl->SetList();
 
gets.Add<const string&> ("channelid",
boost::bind(&Rw11UnitTerm::ChannelId, pobj));
gets.Add<bool> ("rcv7bit",
boost::bind(&Rw11UnitTerm::Rcv7bit, pobj));
gets.Add<bool> ("to7bit",
boost::bind(&Rw11UnitTerm::To7bit, pobj));
gets.Add<bool> ("toenpc",
boost::bind(&Rw11UnitTerm::ToEnpc, pobj));
gets.Add<bool> ("ti7bit",
boost::bind(&Rw11UnitTerm::Ti7bit, pobj));
gets.Add<const string&> ("log",
boost::bind(&Rw11UnitTerm::Log, pobj));
 
sets.Add<bool> ("rcv7bit",
boost::bind(&Rw11UnitTerm::SetRcv7bit,pobj, _1));
sets.Add<bool> ("to7bit",
boost::bind(&Rw11UnitTerm::SetTo7bit,pobj, _1));
sets.Add<bool> ("toenpc",
boost::bind(&Rw11UnitTerm::SetToEnpc,pobj, _1));
sets.Add<bool> ("ti7bit",
boost::bind(&Rw11UnitTerm::SetTi7bit,pobj, _1));
sets.Add<const string&> ("log",
boost::bind(&Rw11UnitTerm::SetLog,pobj, _1));
}
 
//------------------------------------------+-----------------------------------
60,5 → 75,19
RtclRw11UnitTerm::~RtclRw11UnitTerm()
{}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
int RtclRw11UnitTerm::M_type(RtclArgs& args)
{
string text;
if (!args.GetArg("text", text)) return TCL_ERROR;
 
if (!args.AllDone()) return TCL_ERROR;
 
fpObj->RcvCallback((const uint8_t*)text.data(), text.size());
 
return TCL_OK;
}
 
} // end namespace Retro
/tools/src/librwxxtpp/RtclRw11UnitTerm.hpp
1,4 → 1,4
// $Id: RtclRw11UnitTerm.hpp 504 2013-04-13 15:37:24Z mueller $
// $Id: RtclRw11UnitTerm.hpp 511 2013-04-27 13:51:46Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-26 511 1.0.1 add M_type
// 2013-03-03 494 1.0 Initial version
// 2013-03-01 493 0.1 First draft
// ---------------------------------------------------------------------------
20,7 → 21,7
 
/*!
\file
\version $Id: RtclRw11UnitTerm.hpp 504 2013-04-13 15:37:24Z mueller $
\version $Id: RtclRw11UnitTerm.hpp 511 2013-04-27 13:51:46Z mueller $
\brief Declaration of class RtclRw11UnitTerm.
*/
 
39,6 → 40,7
~RtclRw11UnitTerm();
 
protected:
int M_type(RtclArgs& args);
 
protected:
RtclRw11Unit* fpTcl;
/tools/src/librwxxtpp/RtclRw11UnitRK11.cpp
0,0 → 1,56
// $Id: RtclRw11UnitRK11.cpp 509 2013-04-21 20:46:20Z 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-02-22 490 1.0 Initial version
// 2013-02-16 488 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: RtclRw11UnitRK11.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of RtclRw11UnitRK11.
*/
 
#include "RtclRw11UnitRK11.hpp"
 
using namespace std;
 
/*!
\class Retro::RtclRw11UnitRK11
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Constructor
 
RtclRw11UnitRK11::RtclRw11UnitRK11(
Tcl_Interp* interp, const std::string& unitcmd,
const boost::shared_ptr<Rw11UnitRK11>& spunit)
: RtclRw11UnitBase<Rw11UnitRK11>("Rw11UnitRK11", spunit),
RtclRw11UnitDisk(this, spunit.get())
{
CreateObjectCmd(interp, unitcmd.c_str());
}
 
//------------------------------------------+-----------------------------------
//! Destructor
 
RtclRw11UnitRK11::~RtclRw11UnitRK11()
{}
 
} // end namespace Retro
/tools/src/librwxxtpp/RtclRw11UnitRK11.hpp
0,0 → 1,53
// $Id: RtclRw11UnitRK11.hpp 509 2013-04-21 20:46:20Z 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-02-22 490 1.0 Initial version
// 2013-02-16 488 0.1 First draft
// ---------------------------------------------------------------------------
 
 
/*!
\file
\version $Id: RtclRw11UnitRK11.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class RtclRw11UnitRK11.
*/
 
#ifndef included_Retro_RtclRw11UnitRK11
#define included_Retro_RtclRw11UnitRK11 1
 
#include "librw11/Rw11UnitRK11.hpp"
#include "librw11/Rw11CntlRK11.hpp"
 
#include "RtclRw11UnitDisk.hpp"
#include "RtclRw11UnitBase.hpp"
 
namespace Retro {
 
class RtclRw11UnitRK11 : public RtclRw11UnitBase<Rw11UnitRK11>,
public RtclRw11UnitDisk {
public:
RtclRw11UnitRK11(Tcl_Interp* interp,
const std::string& unitcmd,
const boost::shared_ptr<Rw11UnitRK11>& spunit);
~RtclRw11UnitRK11();
 
protected:
};
} // end namespace Retro
 
//#include "RtclRw11UnitRK11.ipp"
 
#endif
/tools/src/librwxxtpp/RtclRw11CntlFactory.cpp
1,4 → 1,4
// $Id: RtclRw11CntlFactory.cpp 495 2013-03-06 17:13:48Z mueller $
// $Id: RtclRw11CntlFactory.cpp 504 2013-04-13 15:37:24Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
19,7 → 19,7
 
/*!
\file
\version $Id: RtclRw11CntlFactory.cpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: RtclRw11CntlFactory.cpp 504 2013-04-13 15:37:24Z mueller $
\brief Implemenation of global function RtclRw11CntlFactory.
*/
 
28,7 → 28,7
#include "RtclRw11CntlFactory.hpp"
 
#include "RtclRw11CntlDL11.hpp"
//#include "RtclRw11CntlRK11.hpp"
#include "RtclRw11CntlRK11.hpp"
 
using namespace std;
 
49,10 → 49,10
if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
pobj.release();
// } else if (type == "rk11") { // rk11 --------------------------
// unique_ptr<RtclRw11CntlRK11> pobj(new RtclRw11CntlRK11());
// if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
// pobj.release();
} else if (type == "rk11") { // rk11 --------------------------
unique_ptr<RtclRw11CntlRK11> pobj(new RtclRw11CntlRK11());
if(pobj->FactoryCmdConfig(args, cpu) != TCL_OK) return TCL_ERROR;
pobj.release();
} else { // unknown cntl type -------------
return args.Quit(string("-E: unknown controller type '") + type + "'");
/tools/src/librwxxtpp/RtclRw11UnitDisk.cpp
0,0 → 1,73
// $Id: RtclRw11UnitDisk.cpp 509 2013-04-21 20:46:20Z 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-19 507 1.0 Initial version
// 2013-02-22 490 0.1 First draft
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: RtclRw11UnitDisk.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of RtclRw11UnitDisk.
*/
 
using namespace std;
 
#include "RtclRw11UnitDisk.hpp"
 
/*!
\class Retro::RtclRw11UnitDisk
\brief FIXME_docs
*/
 
// all method definitions in namespace Retro
namespace Retro {
 
//------------------------------------------+-----------------------------------
//! Constructor
 
RtclRw11UnitDisk::RtclRw11UnitDisk(RtclRw11Unit* ptcl, Rw11UnitDisk* pobj)
: fpTcl(ptcl),
fpObj(pobj)
{
RtclGetList& gets = ptcl->GetList();
RtclSetList& sets = ptcl->SetList();
gets.Add<const string&> ("type",
boost::bind(&Rw11UnitDisk::Type, pobj));
gets.Add<size_t> ("ncylinder",
boost::bind(&Rw11UnitDisk::NCylinder, pobj));
gets.Add<size_t> ("nhead",
boost::bind(&Rw11UnitDisk::NHead, pobj));
gets.Add<size_t> ("nsector",
boost::bind(&Rw11UnitDisk::NSector, pobj));
gets.Add<size_t> ("blocksize",
boost::bind(&Rw11UnitDisk::BlockSize, pobj));
gets.Add<size_t> ("nblock",
boost::bind(&Rw11UnitDisk::NBlock, pobj));
gets.Add<bool> ("wprot",
boost::bind(&Rw11UnitDisk::WProt, pobj));
 
sets.Add<const string&> ("type",
boost::bind(&Rw11UnitDisk::SetType,pobj, _1));
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
RtclRw11UnitDisk::~RtclRw11UnitDisk()
{}
 
 
} // end namespace Retro
/tools/src/librlink/RlinkConnect.hpp
1,4 → 1,4
// $Id: RlinkConnect.hpp 495 2013-03-06 17:13:48Z mueller $
// $Id: RlinkConnect.hpp 509 2013-04-21 20:46:20Z mueller $
//
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-21 509 1.3.3 add SndAttn() method
// 2013-03-05 495 1.3.2 add Exec() without emsg (will send emsg to LogFile)
// 2013-03-01 493 1.3.1 add Server(Active..|SignalAttn)() methods
// 2013-02-23 492 1.3 use scoped_ptr for Port; Close allways allowed
30,7 → 31,7
 
/*!
\file
\version $Id: RlinkConnect.hpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: RlinkConnect.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class \c RlinkConnect.
*/
 
108,6 → 109,7
double WaitAttn(double timeout, RerrMsg& emsg);
int PollAttn(RerrMsg& emsg);
bool SndOob(uint16_t addr, uint16_t data, RerrMsg& emsg);
bool SndAttn(RerrMsg& emsg);
 
bool AddrMapInsert(const std::string& name, uint16_t addr);
bool AddrMapErase(const std::string& name);
/tools/src/librlink/RlinkPacketBuf.cpp
1,4 → 1,4
// $Id: RlinkPacketBuf.cpp 492 2013-02-24 22:14:47Z mueller $
// $Id: RlinkPacketBuf.cpp 509 2013-04-21 20:46:20Z mueller $
//
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-21 509 1.0.4 add SndAttn() method
// 2013-02-03 481 1.0.3 use Rexception
// 2013-01-13 474 1.0.2 add PollAttn() method
// 2013-01-04 469 1.0.1 SndOob(): Add filler 0 to ensure escape state
22,7 → 23,7
 
/*!
\file
\version $Id: RlinkPacketBuf.cpp 492 2013-02-24 22:14:47Z mueller $
\version $Id: RlinkPacketBuf.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of class RlinkPacketBuf.
*/
 
326,8 → 327,8
Init();
 
fRawBuf.clear();
fRawBuf.push_back(kSymEsc); // ESC
fRawBuf.push_back(kSymEsc); // ESC
fRawBuf.push_back(kSymEsc); // ESC
fRawBuf.push_back(kSymEsc); // ESC
 
return SndRaw(port, emsg);
}
335,6 → 336,19
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool RlinkPacketBuf::SndAttn(RlinkPort* port, RerrMsg& emsg)
{
Init();
 
fRawBuf.clear();
fRawBuf.push_back(kCommaAttn); // Attn
 
return SndRaw(port, emsg);
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void RlinkPacketBuf::Dump(std::ostream& os, int ind, const char* text) const
{
RosFill bl(ind);
/tools/src/librlink/RlinkPacketBuf.hpp
1,4 → 1,4
// $Id: RlinkPacketBuf.hpp 486 2013-02-10 22:34:43Z mueller $
// $Id: RlinkPacketBuf.hpp 509 2013-04-21 20:46:20Z mueller $
//
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-21 509 1.0.2 add SndAttn() method
// 2013-01-13 474 1.0.1 add PollAttn() method
// 2011-04-02 375 1.0 Initial version
// 2011-03-05 366 0.1 First draft
21,7 → 22,7
 
/*!
\file
\version $Id: RlinkPacketBuf.hpp 486 2013-02-10 22:34:43Z mueller $
\version $Id: RlinkPacketBuf.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class RlinkPacketBuf.
*/
 
57,6 → 58,7
bool SndOob(RlinkPort* port, uint16_t addr, uint16_t data,
RerrMsg& emsg);
bool SndKeep(RlinkPort* port, RerrMsg& emsg);
bool SndAttn(RlinkPort* port, RerrMsg& emsg);
bool CheckSize(size_t nbyte) const;
uint8_t Get8WithCrc();
/tools/src/librlink/ReventLoop.cpp
1,4 → 1,4
// $Id: ReventLoop.cpp 495 2013-03-06 17:13:48Z mueller $
// $Id: ReventLoop.cpp 511 2013-04-27 13:51:46Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-27 511 1.1.3 BUGFIX: logic in DoCall() fixed (loop range)
// 2013-03-05 495 1.1.2 add exception catcher to EventLoop
// 2013-03-01 493 1.1.1 DoCall(): remove handler on negative return
// 2013-02-22 491 1.1 use new RlogFile/RlogMsg interfaces
21,7 → 22,7
 
/*!
\file
\version $Id: ReventLoop.cpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: ReventLoop.cpp 511 2013-04-27 13:51:46Z mueller $
\brief Implemenation of class ReventLoop.
*/
 
228,7 → 229,7
 
if (fspLog && fTraceLevel >= 1) {
RlogMsg lmsg(*fspLog, 'I');
lmsg << "eloop: redo pollfd list, size=" << fPollFd.size() << endl;
lmsg << "eloop: redo pollfd list, size=" << fPollDsc.size() << endl;
}
}
258,8 → 259,8
 
void ReventLoop::DoCall(void)
{
for (size_t i=0; i<fPollDsc.size(); i++) {
if (fPollFd[i].revents) {
for (size_t i=0; i<fPollFd.size(); i++) {
if (fPollFd[i].revents) {
int irc = fPollHdl[i](fPollFd[i]);
// remove handler negative return (nothrow=true to prevent remove race)
if (irc < 0) {
/tools/src/librlink/RlinkServer.cpp
1,4 → 1,4
// $Id: RlinkServer.cpp 495 2013-03-06 17:13:48Z mueller $
// $Id: RlinkServer.cpp 509 2013-04-21 20:46:20Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-21 509 1.0.1 add Resume(), reorganize server start handling
// 2013-03-06 495 1.0 Initial version
// 2013-01-12 474 0.5 First draft
// ---------------------------------------------------------------------------
19,7 → 20,7
 
/*!
\file
\version $Id: RlinkServer.cpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: RlinkServer.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of RlinkServer.
*/
 
219,27 → 220,7
 
void RlinkServer::Start()
{
if (IsActive())
throw Rexception("RlinkServer::Start()",
"Bad state: server thread already running");
if (!fspConn->IsOpen())
throw Rexception("RlinkServer::Start()",
"Bad state: RlinkConnect not open");
 
// enable attn comma send
RlinkCommandList clist;
clist.AddInit(RlinkCommand::kRbaddr_IInt, RlinkCommand::kIInt_M_AnEna);
Exec(clist);
 
// setup poll handler for Rlink traffic
int rlinkfd = fspConn->Port()->FdRead();
if (!fELoop.TestPollHandler(rlinkfd, POLLIN))
fELoop.AddPollHandler(boost::bind(&RlinkServer::RlinkHandler, this, _1),
rlinkfd, POLLIN);
// and start server thread
fServerThread = boost::thread(boost::bind(&RlinkServerEventLoop::EventLoop,
&fELoop));
StartOrResume(false);
return;
}
 
257,6 → 238,15
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void RlinkServer::Resume()
{
StartOrResume(true);
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void RlinkServer::Wakeup()
{
uint64_t one(1);
348,6 → 338,46
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void RlinkServer::StartOrResume(bool resume)
{
if (IsActive())
throw Rexception("RlinkServer::StartOrResume()",
"Bad state: server thread already running");
if (!fspConn->IsOpen())
throw Rexception("RlinkServer::StartOrResume()",
"Bad state: RlinkConnect not open");
 
boost::lock_guard<RlinkConnect> lock(Connect());
// enable attn comma send
RlinkCommandList clist;
if (!resume) clist.AddAttn();
clist.AddInit(RlinkCommand::kRbaddr_IInt, RlinkCommand::kIInt_M_AnEna);
Exec(clist);
 
// setup poll handler for Rlink traffic
int rlinkfd = fspConn->Port()->FdRead();
if (!fELoop.TestPollHandler(rlinkfd, POLLIN))
fELoop.AddPollHandler(boost::bind(&RlinkServer::RlinkHandler, this, _1),
rlinkfd, POLLIN);
// and start server thread
fServerThread = boost::thread(boost::bind(&RlinkServerEventLoop::EventLoop,
&fELoop));
 
if (resume) {
RerrMsg emsg;
if (!Connect().SndAttn(emsg)) {
RlogMsg lmsg(LogFile(), 'E');
lmsg << "attn send for server resume failed:" << emsg;
}
}
 
return;
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void RlinkServer::CallAttnHandler()
{
if (fAttnSeen) {
402,8 → 432,8
 
int irc = fActnList.front()();
 
// if irc>1 requeue to end, otherwise drop
if (irc > 1) {
// if irc>0 requeue to end, otherwise drop
if (irc > 0) {
fActnList.splice(fActnList.end(), fActnList, fActnList.begin());
} else {
fActnList.pop_front();
/tools/src/librlink/RlinkServer.hpp
1,4 → 1,4
// $Id: RlinkServer.hpp 502 2013-04-02 19:29:30Z mueller $
// $Id: RlinkServer.hpp 509 2013-04-21 20:46:20Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-21 509 1.0.1 add Resume(), reorganize server start handling
// 2013-03-06 495 1.0 Initial version
// 2013-01-12 474 0.5 First draft
// ---------------------------------------------------------------------------
19,7 → 20,7
 
/*!
\file
\version $Id: RlinkServer.hpp 502 2013-04-02 19:29:30Z mueller $
\version $Id: RlinkServer.hpp 509 2013-04-21 20:46:20Z mueller $
\brief Declaration of class \c RlinkServer.
*/
 
90,6 → 91,7
 
void Start();
void Stop();
void Resume();
void Wakeup();
void SignalAttn();
 
134,6 → 136,7
friend class RlinkServerEventLoop;
 
protected:
void StartOrResume(bool resume);
bool AttnPending() const;
bool ActnPending() const;
void CallAttnHandler();
/tools/src/librlink/RlinkConnect.cpp
1,4 → 1,4
// $Id: RlinkConnect.cpp 495 2013-03-06 17:13:48Z mueller $
// $Id: RlinkConnect.cpp 509 2013-04-21 20:46:20Z mueller $
//
// Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,7
//
// Revision History:
// Date Rev Version Comment
// 2013-04-21 509 1.3.2 add SndAttn() method
// 2013-03-01 493 1.3.1 add Server(Active..|SignalAttn)() methods
// 2013-02-23 492 1.3 use scoped_ptr for Port; Close allways allowed
// use RlinkContext, add Context(), Exec(..., cntx)
27,7 → 28,7
 
/*!
\file
\version $Id: RlinkConnect.cpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: RlinkConnect.cpp 509 2013-04-21 20:46:20Z mueller $
\brief Implemenation of RlinkConnect.
*/
 
574,6 → 575,7
 
bool RlinkConnect::SndOob(uint16_t addr, uint16_t data, RerrMsg& emsg)
{
boost::lock_guard<RlinkConnect> lock(*this);
fStats.Inc(kStatNSndOob);
return fTxPkt.SndOob(fpPort.get(), addr, data, emsg);
}
581,6 → 583,15
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
bool RlinkConnect::SndAttn(RerrMsg& emsg)
{
boost::lock_guard<RlinkConnect> lock(*this);
return fTxPkt.SndAttn(fpPort.get(), emsg);
}
 
//------------------------------------------+-----------------------------------
//! FIXME_docs
 
void RlinkConnect::SetLogOpts(const LogOpts& opts)
{
if (opts.baseaddr!=2 && opts.baseaddr!=8 && opts.baseaddr!=16)
/tools/src/librlinktpp/RtclRlinkServer.cpp
1,4 → 1,4
// $Id: RtclRlinkServer.cpp 495 2013-03-06 17:13:48Z mueller $
// $Id: RtclRlinkServer.cpp 510 2013-04-26 16:14:57Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,6 → 13,8
//
// Revision History:
// Date Rev Version Comment
// 2013-04-26 510 1.0.4 change M_attn, now -info instead of -show
// 2013-04-21 509 1.0.3 add server -resume
// 2013-02-05 483 1.0.2 ClassCmdConfig: use RtclArgs
// 2013-02-05 482 1.0.1 add shared_ptr to RlinkConnect object
// 2013-01-12 474 1.0 Initial version
20,7 → 22,7
 
/*!
\file
\version $Id: RtclRlinkServer.cpp 495 2013-03-06 17:13:48Z mueller $
\version $Id: RtclRlinkServer.cpp 510 2013-04-26 16:14:57Z mueller $
\brief Implemenation of class RtclRlinkServer.
*/
 
107,7 → 109,7
 
int RtclRlinkServer::M_server(RtclArgs& args)
{
static RtclNameSet optset("-start|-stop|-test|-trace");
static RtclNameSet optset("-start|-stop|-resume|-test|-trace");
string opt;
if (args.NextOpt(opt, optset)) {
if (opt == "-start") { // server -start
116,6 → 118,9
} else if (opt == "-stop") { // server -stop
if (!args.AllDone()) return kERR;
Obj().Stop();
} else if (opt == "-resume") { // server -resume
if (!args.AllDone()) return kERR;
Obj().Resume();
} else if (opt == "-test") { // server -test
if (!args.AllDone()) return kERR;
args.SetResult(Obj().IsActive());
143,7 → 148,7
 
int RtclRlinkServer::M_attn(RtclArgs& args)
{
static RtclNameSet optset("-add|-remove|-show|-test|-list");
static RtclNameSet optset("-add|-remove|-info|-test|-list");
 
Tcl_Interp* interp = args.Interp();
 
181,21 → 186,32
return args.Quit(string("-E: no handler defined for '") +
args.PeekArgString(-1) + "'");
 
// common handling for -show, -test
} else if (opt == "-show" ||opt == "-test") {// attn -(show|test) mask
} else if (opt == "-info") { // attn -info mask
uint16_t mask=0;
if (!args.GetArg("mask", mask)) return kERR;
if (!args.AllDone()) return kERR;
RtclOPtr pres(Tcl_NewListObj(0,0));
for (alist_it_t it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) {
if ((*it)->Mask() & mask) {
RtclOPtr pele(Tcl_NewListObj(0,0));
Tcl_ListObjAppendElement(NULL, pele, Tcl_NewIntObj((*it)->Mask()) );
Tcl_ListObjAppendElement(NULL, pele, (*it)->Script() );
Tcl_ListObjAppendElement(NULL, pres, pele);
}
}
args.SetResult(pres);
return kOK;
 
} else if (opt == "-test") { // attn -test mask
uint16_t mask=0;
if (!args.GetArg("mask", mask)) return kERR;
if (!args.AllDone()) return kERR;
int nhdl = 0;
for (alist_it_t it = fAttnHdl.begin(); it != fAttnHdl.end(); it++) {
if ((*it)->Mask() & mask) {
nhdl += 1;
if (opt == "-show") { // attn -show mask
args.SetResult((*it)->Script());
} else if (opt == "-test") { // attn -test mask
int rc = Tcl_EvalObjEx(interp, (*it)->Script(), TCL_EVAL_GLOBAL);
if (rc != kOK) return rc;
}
int rc = Tcl_EvalObjEx(interp, (*it)->Script(), TCL_EVAL_GLOBAL);
if (rc != kOK) return rc;
}
}
if (nhdl) return kOK;
/tools/src/librtcltools/RtclCmdBase.hpp
1,4 → 1,4
// $Id: RtclCmdBase.hpp 486 2013-02-10 22:34:43Z mueller $
// $Id: RtclCmdBase.hpp 511 2013-04-27 13:51:46Z mueller $
//
// Copyright 2013- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
//
13,12 → 13,13
//
// Revision History:
// Date Rev Version Comment
// 2013-04-26 511 1.0.1 AddMeth() now public
// 2013-02-02 480 1.0 Initial version (refactored out from ProxyBase)
// ---------------------------------------------------------------------------
 
/*!
\file
\version $Id: RtclCmdBase.hpp 486 2013-02-10 22:34:43Z mueller $
\version $Id: RtclCmdBase.hpp 511 2013-04-27 13:51:46Z mueller $
\brief Declaration of class RtclCmdBase.
*/
 
50,6 → 51,7
virtual ~RtclCmdBase();
 
int DispatchCmd(RtclArgs& args);
void AddMeth(const std::string& name, const methfo_t& methfo);
 
// some constants (also defined in cpp)
static const int kOK = TCL_OK; //<!
56,7 → 58,6
static const int kERR = TCL_ERROR; //<!
 
protected:
void AddMeth(const std::string& name, const methfo_t& methfo);
protected:
mmap_t fMapMeth; //!< map for named methods
/tools/bin/ti_rri
1,6 → 1,6
#! /usr/bin/env tclsh
# -*- tcl -*-
# $Id: ti_rri 504 2013-04-13 15:37:24Z mueller $
# $Id: ti_rri 511 2013-04-27 13:51:46Z mueller $
#
# Copyright 2011-2013 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
#
15,6 → 15,7
#
# Revision History:
# Date Rev Version Comment
# 2013-04-26 510 1.1.5 reorganize readline startup
# 2013-04-12 504 1.1.4 add --pack; trailing '-' argv implies --int
# 2013-02-05 482 1.1.3 stop server is rls found
# 2013-01-27 478 1.1.2 use 'exec sh -c $cmd &' for --run implementation
44,6 → 45,8
# @...tcl
#
 
set tirri_interactive 0
 
array set opts {
pack_ ""
fifo 0
73,7 → 76,7
# must be in a proc so that it can be called from tclreadline
# must be defined before ::tclreadline::Loop called (all after ignored...)
#
proc exit_cleanup {} {
proc tirri_exit {{doexit 1}} {
global opts
global runpid
 
90,6 → 93,10
if { "$runpid" ne "" } {
after 100; # currently just wait 100ms
}
if { $doexit } {
puts {}; # \n to ensure shell prompt on new line
exit
}
return
}
 
289,7 → 296,31
# setup simulation mode default
set rlink::sim_mode [rlink::isfifo]
 
# if tclsh runs a script given on the command line or is invoked
# like here via a shebang the tcl_interactive is always set to 0
# so we have to check whether stdin/stdout is a terminal and set
# tcl_interactive accordingly
 
# FIXME_code: fstat not available (grr...), currently just assume istty
set tcl_interactive 1
 
# determine whether interactive mode, if yes, initialize readline
if {$opts(int) || [llength $clist] == 0 } {
set tirri_interactive 1
 
package require tclreadline
namespace eval tclreadline {
proc prompt1 {} {
set version [info tclversion]
return "ti_rri > "
}
}
::tclreadline::readline eofchar {::tirri_exit; puts {}; exit}
}
 
# now execute all commands and scripts given as start-up arguments
foreach cmd $clist {
# puts "executing: $cmd"
# handle @filename commands
if { [regexp {^@(.+)} $cmd dummy filename] } {
# handle @file.tcl --> source tcl file
318,28 → 349,11
}
}
 
# if tclsh runs a script given on the command line or is invoked
# like here via a shebang the tcl_interactive is always set to 0
# so we have to check whether stdin/stdout is a terminal and set
# tcl_interactive accordingly
 
# FIXME_code: fstat not available (grr...), currently just assume istty
set tcl_interactive 1
 
if { $opts(int) || [llength $clist] == 0 } {
if {$tcl_interactive} {
package require tclreadline
namespace eval tclreadline {
proc prompt1 {} {
set version [info tclversion]
return "ti_rri > "
}
}
::tclreadline::readline eofchar {::exit_cleanup; puts {}; exit}
::tclreadline::Loop
}
if { $tirri_interactive } {
::tclreadline::Loop
} else {
exit_cleanup
tirri_exit 0
}
 
return 0
/rtl/sys_gen/tst_fx2loop/tst_fx2loop.vhd
1,6 → 1,6
-- $Id: tst_fx2loop.vhd 453 2012-01-15 17:51:18Z mueller $
-- $Id: tst_fx2loop.vhd 510 2013-04-26 16:14:57Z mueller $
--
-- Copyright 2011-2012 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2011-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
24,6 → 24,7
--
-- Revision History:
-- Date Rev Version Comment
-- 2013-04-24 510 1.0.1 fix sensitivity list of proc_next
-- 2012-01-15 453 1.0 Initial version
-- 2011-12-26 445 0.5 First draft
------------------------------------------------------------------------------
162,7 → 163,8
end process proc_regs;
 
proc_next: process (R_REGS, CE_MSEC, HIO_CNTL, FX2_MONI,
RXWDATA, RXWVAL, TXWBUSY, TX2WBUSY)
RXWDATA, RXWVAL, TXWBUSY, TX2WBUSY,
RXHOLD_L, TXBUSY, TX2BUSY)
 
variable r : regs_type := regs_init;
variable n : regs_type := regs_init;
/rtl/sys_gen/w11a/tb/dorri
1,5 → 1,5
#!/usr/bin/perl -w
# $Id: dorri 503 2013-04-06 19:44:13Z mueller $
# $Id: dorri 510 2013-04-26 16:14:57Z mueller $
#
# Revision History:
# Date Rev Version Comment
139,7 → 139,7
} elsif ($opt_io eq "t") {
push @arglist, "--term=$val_term";
} else {
print STDERR "dorri-E: neither -s3/-n2/-n3 nor -t specified\n";
print STDERR "dorri-E: neither -s3/-n2/-n3 nor -t or -u specified\n";
print_usage();
exit 1;
}
/rtl/sys_gen/w11a/tb/torri
0,0 → 1,229
#!/usr/bin/perl -w
# $Id: torri 511 2013-04-27 13:51:46Z mueller $
#
# Revision History:
# Date Rev Version Comment
# 2013-04-26 510 1.0 Initial version (derived from dorri)
#
 
use 5.005; # require Perl 5.005 or higher
use strict; # require strict checking
use FileHandle;
 
sub print_usage;
 
autoflush STDOUT 1; # autoflush, so noting lost on exec later
 
my $opt_b;
my $opt_io = '';
my $opt_f = '';
my $opt_tmu;
my $tirri;
my $val_term;
my $val_tb_s3='tbw ../s3board/tb/tb_w11a_s3';
my $val_tb_n2='tbw ../nexys2/tb/tb_w11a_n2';
my $val_tb_n3='tbw ../nexys3/tb/tb_w11a_n3';
my $val_tb;
my $val_e;
 
my @arglist;
 
#
# process torri options
#
while (scalar(@ARGV)) {
my $curarg = $ARGV[0];
 
if ($curarg =~ m{^-b$} ) { # -b
$opt_b = 1;
shift @ARGV;
 
} elsif ($curarg =~ m{^-tmu$} ) { # -tmu
$opt_tmu = 1;
shift @ARGV;
 
} elsif ($curarg =~ m{^-s3$} ) { # -s3
$opt_io = 'f';
$val_tb = $val_tb_s3;
shift @ARGV;
 
} elsif ($curarg =~ m{^-n2$} ) { # -n2
$opt_io = 'f';
$val_tb = $val_tb_n2;
shift @ARGV;
 
} elsif ($curarg =~ m{^-n3$} ) { # -n3
$opt_io = 'f';
$val_tb = $val_tb_n3;
shift @ARGV;
 
} elsif ($curarg =~ m{^-f(s\d?|u)$} ) { # -f[su]
$opt_f = $1;
shift @ARGV;
 
} elsif ($curarg =~ m{^-t([su])(\d?),?} ) { # -t[su]...
my $devnam = ($1 eq 's') ? '/dev/ttyS' : '/dev/ttyUSB';
my $devnum = $2;
my ($dev,$baud,$opt1,$opt2) = split /,/,$curarg;
$baud = '115k' unless defined $baud;
 
if ($baud !~ m{^\d*k?$}) {
print STDERR "torri-E: invalid format of -ts or -tu option\n";
exit 1;
}
 
$opt_io = 't';
$val_term = sprintf '%s%d,%s', $devnam, $devnum, $baud;
$val_term .= ",$opt1" if defined $opt1;
$val_term .= ",$opt2" if defined $opt2;
shift @ARGV;
 
} elsif ($curarg =~ m{^-u$} ) { # -u
$opt_io = 'u';
shift @ARGV;
 
} elsif ($curarg =~ m{^-e$} ) { # -e <file>
print STDERR "torri-W: multiple -e options, only last taken\n"
if defined $val_e;
shift @ARGV;
if (scalar(@ARGV) == 0 || $ARGV[0] =~ m{^-}) {
print STDERR "torri-E: no file name after -e option\n";
exit 1;
} else {
$val_e = shift @ARGV;
if (not -r $val_e) {
print STDERR "torri-E: file '$val_e' not found\n";
exit 1;
}
}
} else {
last;
}
}
 
#
# check that either -s3/n2/n3 or -t or -u given
# setup pi_rri options for either case
#
 
if ($opt_io eq 'f') {
push @arglist, '--fifo';
push @arglist, "--run=$val_tb";
} elsif ($opt_io eq 't') {
push @arglist, "--term=$val_term";
} elsif ($opt_io eq 'u') {
push @arglist, '--cuff';
} else {
print STDERR "torri-E: neither -s3/-n2/-n3 nor -t or -u specified\n";
print_usage();
exit 1;
}
 
#
# setup all other ti_rri options
#
 
push @arglist, '--logl=2';
push @arglist, '--int' unless $opt_b;
push @arglist, '--pack=rw11';
push @arglist, '--';
 
#
# actions prior to first exec
# setup tmu ect
# setup access path --> handle -f options
#
if ($opt_io eq 'f') {
if ($opt_tmu) {
push @arglist, 'rlc oob -sbcntl 13 1';
}
if ($opt_f eq 'u') {
push @arglist, 'rlc oob -sbdata 8 0x2';
push @arglist, 'rlc oob -sbdata 16 0x4';
}
 
}
 
#
# initialize w11 cpu system
#
push @arglist, 'rw11::setup_sys';
 
#
# handle -e option
#
 
if (defined $val_e) {
if ($val_e =~ m/\.mac$/) {
push @arglist, "cpu0 ldasm -file $val_e -sym ldasm_sym -lst ldasm_lst";
} else {
push @arglist, "cpu0 ldabs $val_e";
}
push @arglist, 'rw11::cpumon';
push @arglist, 'rw11::cpucons';
push @arglist, 'cpu0 cp -stapc 0200';
}
 
#
# all remaining commands
#
 
while (scalar(@ARGV)) {
my $curarg = shift @ARGV;
if ($curarg =~ m{^@(.*)$} && ! -r $1) {
print STDERR "torri-E: file '$1' not found\n";
exit 1;
}
push @arglist,$curarg;
}
 
#
# find ti_rri executable
#
 
$tirri=`which ti_rri`;
chomp $tirri;
if ($tirri eq '' || ! -e $tirri) {
print STDERR "torri-E: failed to locate ti_rri\n";
exit 1;
}
 
#
# print command file
#
if (1) {
print 'ti_rri ', join (' ', map {(m{\s}) ? "\"$_\"" : $_} @arglist) , "\n";
}
 
#
# and do it
#
exec $tirri, @arglist
or die "failed to exec: $!";
 
exit 1;
 
# ----------------------------------------------------------------------------
sub print_usage {
print "usage: torri <setup options> <ti_rri opts and cmds>...\n";
print " setup options for ghdl simulation runs:\n";
print " -s3 start tb_w11a_s3 simulation\n";
print " -n2 start tb_w11a_n2 simulation\n";
print " -n3 start tb_w11a_n3 simulation\n";
print " -f.. simulation communication options\n";
print " -fu use cuff data path\n";
print " -tmu activate trace and monitoring unit\n";
print " setup options for FPGA connects:\n";
print " -u use --cuff connect\n";
print " -t.. use --term connect\n";
print " -ts*[,opts] use /dev/ttyS* (* is device number)\n";
print " -tu*[,opts] use /dev/ttyUSB* (* is device number)\n";
print " opts can be ',break', ',xon'\n";
print " common options:\n";
print " -e <file> load and execute file\n";
print " file type '.mac': on the fly compile with asm-11\n";
print " any other file type: assume lda format\n";
print "\n";
print " either one of -s3,-n2, or -n3 must be given -> sim run\n";
print " or one of -t or -u must be given -> fpga run\n";
}
rtl/sys_gen/w11a/tb/torri Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: rtl/sys_gen/w11a/tb/uv5_boot.tcl =================================================================== --- rtl/sys_gen/w11a/tb/uv5_boot.tcl (nonexistent) +++ rtl/sys_gen/w11a/tb/uv5_boot.tcl (revision 20) @@ -0,0 +1,29 @@ +# $Id: uv5_boot.tcl 511 2013-04-27 13:51:46Z mueller $ +# +# Setup file for Unix V5 System +# +# Usage: +# +# telnet_starter -d DL0 & +# torri -xxx @uv5_boot.tcl ( -xxx depends on sim or fpga connect) + +# setup w11 cpu +puts [rlw] + +# 2.11 bsd uses parity, so strip it +cpu0tta0 set to7bit 1 + +# setup tcp links for terminals +cpu0tta0 att "tcp:?port=8000" + +# setup log files +cpu0tta0 set log "tt_dl0.log?crlf" + +# mount disks +cpu0rka0 att unix_v5_rk.dsk + +# and boot +#cpu0rka set trace 1 +rw11::cpumon +rw11::cpucons +cpu0 boot rka0 Index: rtl/sys_gen/w11a/tb/211bsd_rk_boot.tcl =================================================================== --- rtl/sys_gen/w11a/tb/211bsd_rk_boot.tcl (nonexistent) +++ rtl/sys_gen/w11a/tb/211bsd_rk_boot.tcl (revision 20) @@ -0,0 +1,38 @@ +# $Id: 211bsd_rk_boot.tcl 511 2013-04-27 13:51:46Z mueller $ +# +# Setup file for 211bsd RK based system (w11a, in sys/tb area...) +# +# Usage: +# +# telnet_starter -d DL0 & +# telnet_starter -d DL1 & +# torri -xxx @211bsd_rk_boot.tcl ( -xxx depends on sim or fpga connect) +# + +# setup w11 cpu +puts [rlw] + +# 2.11 bsd uses parity, so strip it +cpu0tta0 set to7bit 1 +cpu0ttb0 set to7bit 1 + +# setup tcp links for terminals +cpu0tta0 att "tcp:?port=8000" +cpu0ttb0 att "tcp:?port=8001" + +# setup log files +cpu0tta0 set log "tt_dl0.log?crlf" +cpu0ttb0 set log "tt_dl1.log?crlf" + +# mount disks +cpu0rka0 att 211bsd_rk_root.dsk +cpu0rka1 att 211bsd_rk_swap.dsk +cpu0rka2 att 211bsd_rk_tmp.dsk +cpu0rka3 att 211bsd_rk_bin.dsk +cpu0rka4 att 211bsd_rk_usr.dsk + +# and boot +#cpu0rka set trace 1 +rw11::cpumon +rw11::cpucons +cpu0 boot rka0 Index: rtl/sys_gen/w11a/nexys2/sys_conf.vhd =================================================================== --- rtl/sys_gen/w11a/nexys2/sys_conf.vhd (revision 19) +++ rtl/sys_gen/w11a/nexys2/sys_conf.vhd (revision 20) @@ -1,6 +1,6 @@ --- $Id: sys_conf.vhd 428 2011-11-20 12:19:31Z mueller $ +-- $Id: sys_conf.vhd 509 2013-04-21 20:46:20Z mueller $ -- --- Copyright 2010-2011 by Walter F.J. Mueller +-- Copyright 2010-2013 by Walter F.J. Mueller -- -- 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 @@ -19,6 +19,7 @@ -- Tool versions: xst 11.4, 13.1; ghdl 0.26-0.29 -- Revision History: -- Date Rev Version Comment +-- 2013-04-21 509 1.2 add fx2 settings -- 2011-11-19 428 1.1.1 use clksys=56 (58 no closure after numeric_std...) -- 2010-11-27 341 1.1 add dcm and memctl related constants (clksys=58) -- 2010-05-05 295 1.0 Initial version (derived from _s3 version) @@ -46,6 +47,10 @@ constant sys_conf_ser2rri_defbaud : integer := 115200; -- default 115k baud + -- fx2 settings: petowidth=10 -> 2^10 30 MHz clocks -> ~33 usec + constant sys_conf_fx2_petowidth : positive := 10; + constant sys_conf_fx2_ccwidth : positive := 5; + constant sys_conf_hio_debounce : boolean := true; -- instantiate debouncers constant sys_conf_bram : integer := 0; -- no bram, use cache
/rtl/sys_gen/w11a/nexys2/sys_w11a_n2.ucf_cpp
1,7 → 1,8
## $Id: sys_w11a_n2.ucf_cpp 336 2010-11-06 18:28:27Z mueller $
## $Id: sys_w11a_n2.ucf_cpp 509 2013-04-21 20:46:20Z mueller $
##
## Revision History:
## Date Rev Version Comment
## 2013-04-20 509 1.1 add fx2 support
## 2010-11-06 336 1.0.1 rename input pin CLK -> I_CLK50
## 2010-05-26 295 1.0 Initial version
##
18,3 → 19,8
## Pmod B0 - RS232
##
#include "bplib/nexys2/nexys2_pins_pmb0_rs232.ucf"
##
## Cypress FX2
##
#include "bplib/nexys2/nexys2_pins_fx2.ucf"
#include "bplib/nexys2/nexys2_time_fx2_ic.ucf"
/rtl/sys_gen/w11a/nexys2/tb/tb_w11a_n2.vbom
1,7 → 1,7
# configure tb_nexys2_fusp with sys_w11a_n2 target;
# configure tb_nexys2_fusp_cuff with sys_w11a_n2 target;
# use vhdl configure file (tb_w11a_n2.vhd) to allow
# that all configurations will co-exist in work library
nexys2_fusp_aif = ../sys_w11a_n2.vbom
nexys2_fusp_cuff_aif = ../sys_w11a_n2.vbom
sys_conf = sys_conf_sim.vhd
../../../../bplib/nexys2/tb/tb_nexys2_fusp.vbom
../../../../bplib/nexys2/tb/tb_nexys2_fusp_cuff.vbom
tb_w11a_n2.vhd
/rtl/sys_gen/w11a/nexys2/tb/sys_conf_sim.vhd
1,6 → 1,6
-- $Id: sys_conf_sim.vhd 433 2011-11-27 22:04:39Z mueller $
-- $Id: sys_conf_sim.vhd 509 2013-04-21 20:46:20Z mueller $
--
-- Copyright 2010- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2010-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
19,6 → 19,7
-- Tool versions: xst 11.4, 13.1; ghdl 0.26-0.29
-- Revision History:
-- Date Rev Version Comment
-- 2013-04-21 509 1.2 add fx2 settings
-- 2011-11-27 433 1.1.1 use /1*1 to skip dcm in sim, _ssim fails with dcm
-- 2010-11-27 341 1.1 add dcm and memctl related constants (clksys=58)
-- 2010-05-28 295 1.0 Initial version (cloned from _s3)
41,6 → 42,10
constant sys_conf_memctl_writedelay : positive := 4;
 
constant sys_conf_ser2rri_cdinit : integer := 1-1; -- 1 cycle/bit in sim
 
-- fx2 settings: petowidth=10 -> 2^10 30 MHz clocks -> ~33 usec
constant sys_conf_fx2_petowidth : positive := 10;
constant sys_conf_fx2_ccwidth : positive := 5;
constant sys_conf_hio_debounce : boolean := false; -- no debouncers
/rtl/sys_gen/w11a/nexys2/tb/tb_w11a_n2.vhd
1,6 → 1,6
-- $Id: tb_w11a_n2.vhd 314 2010-07-09 17:38:41Z mueller $
-- $Id: tb_w11a_n2.vhd 509 2013-04-21 20:46:20Z mueller $
--
-- Copyright 2010- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2010-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
13,7 → 13,7
--
------------------------------------------------------------------------------
-- Module Name: tb_w11a_n2
-- Description: Configuration for tb_w11a_n2 for tb_nexys2_fusp
-- Description: Configuration for tb_w11a_n2 for tb_nexys2_fusp_cuff
--
-- Dependencies: sys_w11a_n2
--
26,13 → 26,14
--
-- Revision History:
-- Date Rev Version Comment
-- 2013-04-21 509 1.1 now based on tb_nexys2_fusp_cuff
-- 2010-05-26 295 1.0 Initial version (cloned from _s3)
------------------------------------------------------------------------------
 
configuration tb_w11a_n2 of tb_nexys2_fusp is
configuration tb_w11a_n2 of tb_nexys2_fusp_cuff is
 
for sim
for all : nexys2_fusp_aif
for all : nexys2_fusp_cuff_aif
use entity work.sys_w11a_n2;
end for;
end for;
/rtl/sys_gen/w11a/nexys2/sys_w11a_n2.vhd
1,6 → 1,6
-- $Id: sys_w11a_n2.vhd 476 2013-01-26 22:23:53Z mueller $
-- $Id: sys_w11a_n2.vhd 509 2013-04-21 20:46:20Z mueller $
--
-- Copyright 2010-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2010-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
19,7 → 19,8
-- vlib/genlib/clkdivce
-- bplib/bpgen/bp_rs232_2l4l_iob
-- bplib/bpgen/sn_humanio_rbus
-- vlib/rlink/rlink_sp1c
-- bplib/fx2rlink/rlink_sp1c_fx2
-- bplib/fx2rlink/ioleds_sp1c_fx2
-- vlib/rri/rb_sres_or_3
-- w11a/pdp11_core_rbus
-- w11a/pdp11_core
40,6 → 41,7
--
-- Synthesized (xst):
-- Date Rev ise Target flop lutl lutm slic t peri
-- 2013-04-20 509 13.3 O76d xc3s1200e-4 1541 4598 334 2889 ok: now + FX2 !
-- 2011-12-18 440 13.1 O40d xc3s1200e-4 1450 4439 270 2740 ok: LP+PC+DL+II
-- 2011-11-18 427 13.1 O40d xc3s1200e-4 1433 4374 242 2680 ok: LP+PC+DL+II
-- 2010-12-30 351 12.1 M53d xc3s1200e-4 1389 4368 242 2674 ok: LP+PC+DL+II
64,6 → 66,7
--
-- Revision History:
-- Date Rev Version Comment
-- 2013-04-20 509 1.4 added fx2 (cuff) support; ATOWIDTH=7
-- 2011-12-23 444 1.3 remove clksys output hack
-- 2011-12-18 440 1.2.7 use rlink_sp1c
-- 2011-11-26 433 1.2.6 use nx_cram_(dummy|memctl_as) now
92,13 → 95,15
------------------------------------------------------------------------------
--
-- w11a test design for nexys2
-- w11a + rlink + serport
-- w11a + rlink + serport + cuff
--
-- Usage of Nexys 2 Switches, Buttons, LEDs:
--
-- SWI(7:2): no function (only connected to sn_humanio_rbus)
-- SWI(1): 1 enable XON
-- SWI(0): 0 -> main board RS232 port
-- SWI(7:3): no function (only connected to sn_humanio_rbus)
-- (2) 0 -> int/ext RS242 port for rlink
-- 1 -> use USB interface for rlink
-- (1): 1 enable XON
-- (0): 0 -> main board RS232 port
-- 1 -> Pmod B/top RS232 port
--
-- LED(7) MEM_ACT_W
114,10 → 119,17
-- (3:0) cpurust code
-- (4) '1'
--
-- DP(3): not SER_MONI.txok (shows tx back preasure)
-- DP(2): SER_MONI.txact (shows tx activity)
-- DP(1): not SER_MONI.rxok (shows rx back preasure)
-- DP(0): SER_MONI.rxact (shows rx activity)
-- DP(3:0) shows IO activity
-- if SWI(2)=0 (serport)
-- (3): not SER_MONI.txok (shows tx back preasure)
-- (2): SER_MONI.txact (shows tx activity)
-- (1): not SER_MONI.rxok (shows rx back preasure)
-- (0): SER_MONI.rxact (shows rx activity)
-- if SWI(2)=1 (fx2-usb)
-- (3): RB_SRES.busy (shows rbus back preasure)
-- (2): RLB_TXBUSY (shows tx back preasure)
-- (1): RLB_TXENA (shows tx activity)
-- (0): RLB_RXVAL (shows rx activity)
--
 
library ieee;
130,6 → 142,8
use work.serportlib.all;
use work.rblib.all;
use work.rlinklib.all;
use work.fx2lib.all;
use work.fx2rlinklib.all;
use work.bpgenlib.all;
use work.bpgenrbuslib.all;
use work.nxcramlib.all;
141,7 → 155,7
-- ----------------------------------------------------------------------------
 
entity sys_w11a_n2 is -- top level
-- implements nexys2_fusp_aif
-- implements nexys2_fusp_cuff_aif
port (
I_CLK50 : in slbit; -- 50 MHz clock
I_RXD : in slbit; -- receive data (board view)
165,7 → 179,15
O_FUSP_RTS_N : out slbit; -- fusp: rs232 rts_n
I_FUSP_CTS_N : in slbit; -- fusp: rs232 cts_n
I_FUSP_RXD : in slbit; -- fusp: rs232 rx
O_FUSP_TXD : out slbit -- fusp: rs232 tx
O_FUSP_TXD : out slbit; -- fusp: rs232 tx
I_FX2_IFCLK : in slbit; -- fx2: interface clock
O_FX2_FIFO : out slv2; -- fx2: fifo address
I_FX2_FLAG : in slv4; -- fx2: fifo flags
O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low)
O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low)
O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low)
O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low)
IO_FX2_DATA : inout slv8 -- fx2: data lines
);
end sys_w11a_n2;
 
187,7 → 209,9
signal RB_LAM : slv16 := (others=>'0');
signal RB_STAT : slv3 := (others=>'0');
 
signal RLB_MONI : rlb_moni_type := rlb_moni_init;
signal SER_MONI : serport_moni_type := serport_moni_init;
signal FX2_MONI : fx2ctl_moni_type := fx2ctl_moni_init;
 
signal RB_MREQ : rb_mreq_type := rb_mreq_init;
signal RB_SRES : rb_sres_type := rb_sres_init;
316,13 → 340,15
O_SEG_N => O_SEG_N
);
 
RLINK : rlink_sp1c
RLINK : rlink_sp1c_fx2
generic map (
ATOWIDTH => 6, -- 64 cycles access timeout
ATOWIDTH => 7, -- 128 cycles access timeout
ITOWIDTH => 6, -- 64 periods max idle timeout
CPREF => c_rlink_cpref,
IFAWIDTH => 5, -- 32 word input fifo
OFAWIDTH => 5, -- 32 word output fifo
PETOWIDTH => sys_conf_fx2_petowidth,
CCWIDTH => sys_conf_fx2_ccwidth,
ENAPIN_RLMON => sbcntl_sbf_rlmon,
ENAPIN_RBMON => sbcntl_sbf_rbmon,
CDWIDTH => 13,
335,6 → 361,7
RESET => RESET,
ENAXON => SWI(1),
ENAESC => SWI(1),
ENAFX2 => SWI(2),
RXSD => RXD,
TXSD => TXD,
CTS_N => CTS_N,
344,7 → 371,17
RB_LAM => RB_LAM,
RB_STAT => RB_STAT,
RL_MONI => open,
SER_MONI => SER_MONI
RLB_MONI => RLB_MONI,
SER_MONI => SER_MONI,
FX2_MONI => FX2_MONI,
I_FX2_IFCLK => I_FX2_IFCLK,
O_FX2_FIFO => O_FX2_FIFO,
I_FX2_FLAG => I_FX2_FLAG,
O_FX2_SLRD_N => O_FX2_SLRD_N,
O_FX2_SLWR_N => O_FX2_SLWR_N,
O_FX2_SLOE_N => O_FX2_SLOE_N,
O_FX2_PKTEND_N => O_FX2_PKTEND_N,
IO_FX2_DATA => IO_FX2_DATA
);
 
RB_SRES_OR : rb_sres_or_3
557,13 → 594,20
);
end generate IBD_MAXI;
IOLEDS : ioleds_sp1c_fx2
port map (
CLK => CLK,
CE_USEC => CE_USEC,
RESET => CPU_RESET,
ENAFX2 => SWI(2),
RB_SRES => RB_SRES,
RLB_MONI => RLB_MONI,
SER_MONI => SER_MONI,
IOLEDS => DSP_DP
);
 
DSP_DAT(15 downto 0) <= DISPREG;
 
DSP_DP(3) <= not SER_MONI.txok;
DSP_DP(2) <= SER_MONI.txact;
DSP_DP(1) <= not SER_MONI.rxok;
DSP_DP(0) <= SER_MONI.rxact;
 
proc_led: process (MEM_ACT_W, MEM_ACT_R, CP_STAT, DM_STAT_DP.psw)
variable iled : slv8 := (others=>'0');
begin
/rtl/sys_gen/w11a/nexys2/sys_w11a_n2.vbom
5,6 → 5,8
../../../vlib/serport/serportlib.vbom
../../../vlib/rbus/rblib.vhd
../../../vlib/rlink/rlinklib.vbom
../../../bplib/fx2lib/fx2lib.vhd
../../../bplib/fx2rlink/fx2rlinklib.vbom
../../../bplib/bpgen/bpgenlib.vbom
../../../bplib/bpgen/bpgenrbuslib.vbom
../../../bplib/nxcramlib/nxcramlib.vhd
18,7 → 20,8
../../../vlib/genlib/clkdivce.vbom
../../../bplib/bpgen/bp_rs232_2l4l_iob.vbom
../../../bplib/bpgen/sn_humanio_rbus.vbom
../../../vlib/rlink/rlink_sp1c.vbom
../../../bplib/fx2rlink/rlink_sp1c_fx2.vbom
../../../bplib/fx2rlink/ioleds_sp1c_fx2.vbom
../../../vlib/rbus/rb_sres_or_3.vbom
../../../w11a/pdp11_core_rbus.vbom
../../../w11a/pdp11_core.vbom
/rtl/sys_gen/w11a/nexys2/.cvsignore
2,3 → 2,4
*.dep_ucf_cpp
log_*
_impact*
*.svf
/rtl/sys_gen/w11a/nexys2/Makefile
1,7 → 1,8
# $Id: Makefile 477 2013-01-27 14:07:10Z mueller $
# $Id: Makefile 509 2013-04-21 20:46:20Z mueller $
#
# Revision History:
# Date Rev Version Comment
# 2013-04-20 509 1.2 add fx2 support
# 2011-08-13 405 1.1 use includes from rtl/make
# 2010-05-28 295 1.0 Initial version (derived from _s3 version)
#
9,6 → 10,7
BIT_all = $(VBOM_all:.vbom=.bit)
#
include $(RETROBASE)/rtl/make/xflow_default_nexys2.mk
FX2_FILE = nexys2_jtag_2fifo_ic.ihx
#
.PHONY : all clean
#
rtl/sys_gen/w11a/nexys2 Property changes : Modified: svn:ignore ## -34,3 +34,4 ## *.dep_ucf_cpp log_* _impact* +*.svf Index: rtl/sys_gen/w11a/nexys3/sys_conf.vhd =================================================================== --- rtl/sys_gen/w11a/nexys3/sys_conf.vhd (revision 19) +++ rtl/sys_gen/w11a/nexys3/sys_conf.vhd (revision 20) @@ -1,6 +1,6 @@ --- $Id: sys_conf.vhd 433 2011-11-27 22:04:39Z mueller $ +-- $Id: sys_conf.vhd 509 2013-04-21 20:46:20Z mueller $ -- --- Copyright 2011- by Walter F.J. Mueller +-- Copyright 2011-2013 by Walter F.J. Mueller -- -- 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 @@ -19,6 +19,7 @@ -- Tool versions: xst 13.1; ghdl 0.29 -- Revision History: -- Date Rev Version Comment +-- 2013-04-21 509 1.1 add fx2 settings -- 2011-11-26 433 1.0.1 use 80 MHz clksys (no closure for 85 after rev 432) -- 2011-11-20 430 1.0 Initial version (derived from _n2 version) ------------------------------------------------------------------------------ @@ -48,6 +49,10 @@ constant sys_conf_ser2rri_defbaud : integer := 115200; -- default 115k baud + -- fx2 settings: petowidth=10 -> 2^10 30 MHz clocks -> ~33 usec + constant sys_conf_fx2_petowidth : positive := 10; + constant sys_conf_fx2_ccwidth : positive := 5; + constant sys_conf_hio_debounce : boolean := true; -- instantiate debouncers constant sys_conf_bram : integer := 0; -- no bram, use cache
/rtl/sys_gen/w11a/nexys3/sys_w11a_n3.ucf_cpp
1,7 → 1,8
## $Id: sys_w11a_n3.ucf_cpp 430 2011-11-20 20:48:39Z mueller $
## $Id: sys_w11a_n3.ucf_cpp 509 2013-04-21 20:46:20Z mueller $
##
## Revision History:
## Date Rev Version Comment
## 2013-04-21 509 1.1 add fx2 support
## 2011-11-20 430 1.0 Initial version
##
 
17,3 → 18,8
## Pmod B0 - RS232
##
#include "bplib/nexys3/nexys3_pins_pmb0_rs232.ucf"
##
## Cypress FX2
##
#include "bplib/nexys3/nexys3_pins_fx2.ucf"
#include "bplib/nexys3/nexys3_time_fx2_ic.ucf"
/rtl/sys_gen/w11a/nexys3/tb/tb_w11a_n3.vbom
1,7 → 1,7
# configure tb_nexys3_fusp with sys_w11a_n3 target;
# use vhdl configure file (tb_w11a_n3.vhd) to allow
# that all configurations will co-exist in work library
nexys3_fusp_aif = ../sys_w11a_n3.vbom
nexys3_fusp_cuff_aif = ../sys_w11a_n3.vbom
sys_conf = sys_conf_sim.vhd
../../../../bplib/nexys3/tb/tb_nexys3_fusp.vbom
../../../../bplib/nexys3/tb/tb_nexys3_fusp_cuff.vbom
tb_w11a_n3.vhd
/rtl/sys_gen/w11a/nexys3/tb/sys_conf_sim.vhd
1,6 → 1,6
-- $Id: sys_conf_sim.vhd 433 2011-11-27 22:04:39Z mueller $
-- $Id: sys_conf_sim.vhd 509 2013-04-21 20:46:20Z mueller $
--
-- Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2011-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
19,6 → 19,7
-- Tool versions: xst 13.1; ghdl 0.29
-- Revision History:
-- Date Rev Version Comment
-- 2013-04-21 509 1.2 add fx2 settings
-- 2011-11-25 432 1.0 Initial version (cloned from _n3)
------------------------------------------------------------------------------
 
40,6 → 41,10
 
constant sys_conf_ser2rri_cdinit : integer := 1-1; -- 1 cycle/bit in sim
-- fx2 settings: petowidth=10 -> 2^10 30 MHz clocks -> ~33 usec
constant sys_conf_fx2_petowidth : positive := 10;
constant sys_conf_fx2_ccwidth : positive := 5;
 
constant sys_conf_hio_debounce : boolean := false; -- no debouncers
constant sys_conf_bram : integer := 0; -- no bram, use cache
/rtl/sys_gen/w11a/nexys3/tb/tb_w11a_n3.vhd
1,6 → 1,6
-- $Id: tb_w11a_n3.vhd 432 2011-11-25 20:16:28Z mueller $
-- $Id: tb_w11a_n3.vhd 509 2013-04-21 20:46:20Z mueller $
--
-- Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2011-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
13,7 → 13,7
--
------------------------------------------------------------------------------
-- Module Name: tb_w11a_n3
-- Description: Configuration for tb_w11a_n3 for tb_nexys3_fusp
-- Description: Configuration for tb_w11a_n3 for tb_nexys3_fusp_cuff
--
-- Dependencies: sys_w11a_n3
--
26,13 → 26,14
--
-- Revision History:
-- Date Rev Version Comment
-- 2013-04-21 509 1.1 now based on tb_nexys3_fusp_cuff
-- 2011-11-25 432 1.0 Initial version (cloned from _n2)
------------------------------------------------------------------------------
 
configuration tb_w11a_n3 of tb_nexys3_fusp is
configuration tb_w11a_n3 of tb_nexys3_fusp_cuff is
 
for sim
for all : nexys3_fusp_aif
for all : nexys3_fusp_cuff_aif
use entity work.sys_w11a_n3;
end for;
end for;
/rtl/sys_gen/w11a/nexys3/sys_w11a_n3.vhd
1,6 → 1,6
-- $Id: sys_w11a_n3.vhd 476 2013-01-26 22:23:53Z mueller $
-- $Id: sys_w11a_n3.vhd 509 2013-04-21 20:46:20Z mueller $
--
-- Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
-- Copyright 2011-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
19,7 → 19,8
-- vlib/genlib/clkdivce
-- bplib/bpgen/bp_rs232_2l4l_iob
-- bplib/bpgen/sn_humanio_rbus
-- vlib/rlink/rlink_sp1c
-- bplib/fx2rlink/rlink_sp1c_fx2
-- bplib/fx2rlink/ioleds_sp1c_fx2
-- vlib/rri/rb_sres_or_3
-- w11a/pdp11_core_rbus
-- w11a/pdp11_core
40,11 → 41,13
--
-- Synthesized (xst):
-- Date Rev ise Target flop lutl lutm slic t peri
-- 2013-04-21 509 13.3 O76d xc6slx16-2 1516 3274 140 1184 ok: now + FX2 !
-- 2011-12-18 440 13.1 O40d xc6slx16-2 1441 3161 96 1084 ok: LP+PC+DL+II
-- 2011-11-20 430 13.1 O40d xc6slx16-2 1412 3206 84 1063 ok: LP+PC+DL+II
--
-- Revision History:
-- Date Rev Version Comment
-- 2013-04-21 509 1.4 added fx2 (cuff) support
-- 2011-12-18 440 1.0.4 use rlink_sp1c
-- 2011-12-04 435 1.0.3 increase ATOWIDTH 6->7 (saw i/o timeouts on wblks)
-- 2011-11-26 433 1.0.2 use nx_cram_(dummy|memctl_as) now
57,7 → 60,9
--
-- Usage of Nexys 3 Switches, Buttons, LEDs:
--
-- SWI(7:2): no function (only connected to sn_humanio_rbus)
-- SWI(7:3): no function (only connected to sn_humanio_rbus)
-- (2) 0 -> int/ext RS242 port for rlink
-- 1 -> use USB interface for rlink
-- SWI(1): 1 enable XON
-- SWI(0): 0 -> main board RS232 port
-- 1 -> Pmod B/top RS232 port
75,10 → 80,17
-- (3:0) cpurust code
-- (4) '1'
--
-- DP(3): not SER_MONI.txok (shows tx back preasure)
-- DP(2): SER_MONI.txact (shows tx activity)
-- DP(1): not SER_MONI.rxok (shows rx back preasure)
-- DP(0): SER_MONI.rxact (shows rx activity)
-- DP(3:0) shows IO activity
-- if SWI(2)=0 (serport)
-- (3): not SER_MONI.txok (shows tx back preasure)
-- (2): SER_MONI.txact (shows tx activity)
-- (1): not SER_MONI.rxok (shows rx back preasure)
-- (0): SER_MONI.rxact (shows rx activity)
-- if SWI(2)=1 (fx2-usb)
-- (3): RB_SRES.busy (shows rbus back preasure)
-- (2): RLB_TXBUSY (shows tx back preasure)
-- (1): RLB_TXENA (shows tx activity)
-- (0): RLB_RXVAL (shows rx activity)
--
 
library ieee;
91,6 → 103,8
use work.serportlib.all;
use work.rblib.all;
use work.rlinklib.all;
use work.fx2lib.all;
use work.fx2rlinklib.all;
use work.bpgenlib.all;
use work.bpgenrbuslib.all;
use work.nxcramlib.all;
102,7 → 116,7
-- ----------------------------------------------------------------------------
 
entity sys_w11a_n3 is -- top level
-- implements nexys3_fusp_aif
-- implements nexys3_fusp_cuff_aif
port (
I_CLK100 : in slbit; -- 100 MHz clock
I_RXD : in slbit; -- receive data (board view)
127,7 → 141,15
O_FUSP_RTS_N : out slbit; -- fusp: rs232 rts_n
I_FUSP_CTS_N : in slbit; -- fusp: rs232 cts_n
I_FUSP_RXD : in slbit; -- fusp: rs232 rx
O_FUSP_TXD : out slbit -- fusp: rs232 tx
O_FUSP_TXD : out slbit; -- fusp: rs232 tx
I_FX2_IFCLK : in slbit; -- fx2: interface clock
O_FX2_FIFO : out slv2; -- fx2: fifo address
I_FX2_FLAG : in slv4; -- fx2: fifo flags
O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low)
O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low)
O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low)
O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low)
IO_FX2_DATA : inout slv8 -- fx2: data lines
);
end sys_w11a_n3;
 
149,7 → 171,9
signal RB_LAM : slv16 := (others=>'0');
signal RB_STAT : slv3 := (others=>'0');
signal RLB_MONI : rlb_moni_type := rlb_moni_init;
signal SER_MONI : serport_moni_type := serport_moni_init;
signal FX2_MONI : fx2ctl_moni_type := fx2ctl_moni_init;
 
signal RB_MREQ : rb_mreq_type := rb_mreq_init;
signal RB_SRES : rb_sres_type := rb_sres_init;
279,7 → 303,7
O_SEG_N => O_SEG_N
);
 
RLINK : rlink_sp1c
RLINK : rlink_sp1c_fx2
generic map (
ATOWIDTH => 7, -- 128 cycles access timeout
ITOWIDTH => 6, -- 64 periods max idle timeout
286,6 → 310,8
CPREF => c_rlink_cpref,
IFAWIDTH => 5, -- 32 word input fifo
OFAWIDTH => 5, -- 32 word output fifo
PETOWIDTH => sys_conf_fx2_petowidth,
CCWIDTH => sys_conf_fx2_ccwidth,
ENAPIN_RLMON => sbcntl_sbf_rlmon,
ENAPIN_RBMON => sbcntl_sbf_rbmon,
CDWIDTH => 13,
298,6 → 324,7
RESET => RESET,
ENAXON => SWI(1),
ENAESC => SWI(1),
ENAFX2 => SWI(2),
RXSD => RXD,
TXSD => TXD,
CTS_N => CTS_N,
307,7 → 334,17
RB_LAM => RB_LAM,
RB_STAT => RB_STAT,
RL_MONI => open,
SER_MONI => SER_MONI
RLB_MONI => RLB_MONI,
SER_MONI => SER_MONI,
FX2_MONI => FX2_MONI,
I_FX2_IFCLK => I_FX2_IFCLK,
O_FX2_FIFO => O_FX2_FIFO,
I_FX2_FLAG => I_FX2_FLAG,
O_FX2_SLRD_N => O_FX2_SLRD_N,
O_FX2_SLWR_N => O_FX2_SLWR_N,
O_FX2_SLOE_N => O_FX2_SLOE_N,
O_FX2_PKTEND_N => O_FX2_PKTEND_N,
IO_FX2_DATA => IO_FX2_DATA
);
 
RB_SRES_OR : rb_sres_or_3
522,13 → 559,20
);
end generate IBD_MAXI;
IOLEDS : ioleds_sp1c_fx2
port map (
CLK => CLK,
CE_USEC => CE_USEC,
RESET => CPU_RESET,
ENAFX2 => SWI(2),
RB_SRES => RB_SRES,
RLB_MONI => RLB_MONI,
SER_MONI => SER_MONI,
IOLEDS => DSP_DP
);
 
DSP_DAT(15 downto 0) <= DISPREG;
 
DSP_DP(3) <= not SER_MONI.txok;
DSP_DP(2) <= SER_MONI.txact;
DSP_DP(1) <= not SER_MONI.rxok;
DSP_DP(0) <= SER_MONI.rxact;
 
proc_led: process (MEM_ACT_W, MEM_ACT_R, CP_STAT, DM_STAT_DP.psw)
variable iled : slv8 := (others=>'0');
begin
/rtl/sys_gen/w11a/nexys3/sys_w11a_n3.vbom
5,6 → 5,8
../../../vlib/serport/serportlib.vbom
../../../vlib/rbus/rblib.vhd
../../../vlib/rlink/rlinklib.vbom
../../../bplib/fx2lib/fx2lib.vhd
../../../bplib/fx2rlink/fx2rlinklib.vbom
../../../bplib/bpgen/bpgenlib.vbom
../../../bplib/bpgen/bpgenrbuslib.vbom
../../../bplib/nxcramlib/nxcramlib.vhd
18,7 → 20,8
../../../vlib/genlib/clkdivce.vbom
../../../bplib/bpgen/bp_rs232_2l4l_iob.vbom
../../../bplib/bpgen/sn_humanio_rbus.vbom
../../../vlib/rlink/rlink_sp1c.vbom
../../../bplib/fx2rlink/rlink_sp1c_fx2.vbom
../../../bplib/fx2rlink/ioleds_sp1c_fx2.vbom
../../../vlib/rbus/rb_sres_or_3.vbom
../../../w11a/pdp11_core_rbus.vbom
../../../w11a/pdp11_core.vbom
/rtl/sys_gen/w11a/nexys3/.cvsignore
2,3 → 2,4
*.dep_ucf_cpp
log_*
_impact*
*.svf
/rtl/sys_gen/w11a/nexys3/Makefile
1,7 → 1,8
# $Id: Makefile 477 2013-01-27 14:07:10Z mueller $
# $Id: Makefile 509 2013-04-21 20:46:20Z mueller $
#
# Revision History:
# Date Rev Version Comment
# 2013-04-20 509 1.2 add fx2 support
# 2011-11-20 430 1.0 Initial version (derived from _n2 version)
#
VBOM_all = $(wildcard *.vbom)
8,6 → 9,7
BIT_all = $(VBOM_all:.vbom=.bit)
#
include $(RETROBASE)/rtl/make/xflow_default_nexys3.mk
FX2_FILE = nexys3_jtag_2fifo_ic.ihx
#
.PHONY : all clean
#
rtl/sys_gen/w11a/nexys3 Property changes : Modified: svn:ignore ## -34,3 +34,4 ## *.dep_ucf_cpp log_* _impact* +*.svf Index: rtl/sys_gen/w11a/s3board/.cvsignore =================================================================== --- rtl/sys_gen/w11a/s3board/.cvsignore (revision 19) +++ rtl/sys_gen/w11a/s3board/.cvsignore (revision 20) @@ -2,3 +2,4 @@ *.dep_ucf_cpp log_* _impact* +*.svf Index: rtl/sys_gen/w11a/s3board =================================================================== --- rtl/sys_gen/w11a/s3board (revision 19) +++ rtl/sys_gen/w11a/s3board (revision 20)
rtl/sys_gen/w11a/s3board Property changes : Modified: svn:ignore ## -34,3 +34,4 ## *.dep_ucf_cpp log_* _impact* +*.svf Index: rtl/bplib/fx2rlink/rlink_sp1c_fx2.vhd =================================================================== --- rtl/bplib/fx2rlink/rlink_sp1c_fx2.vhd (nonexistent) +++ rtl/bplib/fx2rlink/rlink_sp1c_fx2.vhd (revision 20) @@ -0,0 +1,227 @@ +-- $Id: $ +-- +-- Copyright 2013- by Walter F.J. Mueller +-- +-- 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. +-- +------------------------------------------------------------------------------ +-- Module Name: rlink_sp1c_fx2 - syn +-- Description: rlink_core8 + serport_1clock + fx2 combo +-- +-- Dependencies: rlinklib/rlink_core8 +-- serport/serport_1clock +-- rlinklib/rlink_rlbmux +-- fx2lib/fx2_2fifoctl_ic +-- +-- Test bench: - +-- +-- Target Devices: generic +-- Tool versions: xst 13.1; ghdl 0.29 +-- +-- Synthesized (xst): +-- Date Rev ise Target flop lutl lutm slic t peri ifa ofa +-- 2013-04-20 509 13.3 O76d xc3s1200e-4 441 903 128 637 s 8.7 - - +-- +-- Revision History: +-- Date Rev Version Comment +-- 2013-04-20 509 1.0 Initial version (derived from rlink_sp1c) +------------------------------------------------------------------------------ + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.slvtypes.all; +use work.rblib.all; +use work.rlinklib.all; +use work.serportlib.all; +use work.fx2lib.all; + +entity rlink_sp1c_fx2 is -- rlink_core8+serport_1clk+fx2_ic combo + generic ( + ATOWIDTH : positive := 5; -- access timeout counter width + ITOWIDTH : positive := 6; -- idle timeout counter width + CPREF : slv4 := c_rlink_cpref; -- comma prefix + IFAWIDTH : natural := 5; -- ser input fifo addr width (0=none) + OFAWIDTH : natural := 5; -- ser output fifo addr width (0=none) + PETOWIDTH : positive := 10; -- fx2 packet end time-out counter width + CCWIDTH : positive := 5; -- fx2 chunk counter width + ENAPIN_RLMON : integer := sbcntl_sbf_rlmon; -- SB_CNTL for rlmon (-1=none) + ENAPIN_RBMON : integer := sbcntl_sbf_rbmon; -- SB_CNTL for rbmon (-1=none) + CDWIDTH : positive := 13; -- clk divider width + CDINIT : natural := 15); -- clk divider initial/reset setting + port ( + CLK : in slbit; -- clock + CE_USEC : in slbit; -- 1 usec clock enable + CE_MSEC : in slbit; -- 1 msec clock enable + CE_INT : in slbit := '0'; -- rri ito time unit clock enable + RESET : in slbit; -- reset + ENAXON : in slbit; -- enable xon/xoff handling + ENAESC : in slbit; -- enable xon/xoff escaping + ENAFX2 : in slbit; -- enable fx2 usage + RXSD : in slbit; -- receive serial data (board view) + TXSD : out slbit; -- transmit serial data (board view) + CTS_N : in slbit := '0'; -- clear to send (act.low, board view) + RTS_N : out slbit; -- request to send (act.low, board view) + RB_MREQ : out rb_mreq_type; -- rbus: request + RB_SRES : in rb_sres_type; -- rbus: response + RB_LAM : in slv16; -- rbus: look at me + RB_STAT : in slv3; -- rbus: status flags + RL_MONI : out rl_moni_type; -- rlink_core: monitor port + RLB_MONI : out rlb_moni_type; -- rlink 8b: monitor port + SER_MONI : out serport_moni_type; -- ser: monitor port + FX2_MONI : out fx2ctl_moni_type; -- fx2: monitor port + I_FX2_IFCLK : in slbit; -- fx2: interface clock + O_FX2_FIFO : out slv2; -- fx2: fifo address + I_FX2_FLAG : in slv4; -- fx2: fifo flags + O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low) + O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low) + O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low) + O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low) + IO_FX2_DATA : inout slv8 -- fx2: data lines + ); +end entity rlink_sp1c_fx2; + + +architecture syn of rlink_sp1c_fx2 is + + signal RLB_DI : slv8 := (others=>'0'); + signal RLB_ENA : slbit := '0'; + signal RLB_BUSY : slbit := '0'; + signal RLB_DO : slv8 := (others=>'0'); + signal RLB_VAL : slbit := '0'; + signal RLB_HOLD : slbit := '0'; + + signal SER_RXDATA : slv8 := (others=>'0'); + signal SER_RXVAL : slbit := '0'; + signal SER_RXHOLD : slbit := '0'; + signal SER_TXDATA : slv8 := (others=>'0'); + signal SER_TXENA : slbit := '0'; + signal SER_TXBUSY : slbit := '0'; + + signal FX2_RXDATA : slv8 := (others=>'0'); + signal FX2_RXVAL : slbit := '0'; + signal FX2_RXHOLD : slbit := '0'; + signal FX2_RXAEMPTY : slbit := '0'; + signal FX2_TXDATA : slv8 := (others=>'0'); + signal FX2_TXENA : slbit := '0'; + signal FX2_TXBUSY : slbit := '0'; + signal FX2_TXAFULL : slbit := '0'; + +begin + + CORE : rlink_core8 + generic map ( + ATOWIDTH => ATOWIDTH, + ITOWIDTH => ITOWIDTH, + CPREF => CPREF, + ENAPIN_RLMON => ENAPIN_RLMON, + ENAPIN_RBMON => ENAPIN_RBMON) + port map ( + CLK => CLK, + CE_INT => CE_INT, + RESET => RESET, + RLB_DI => RLB_DI, + RLB_ENA => RLB_ENA, + RLB_BUSY => RLB_BUSY, + RLB_DO => RLB_DO, + RLB_VAL => RLB_VAL, + RLB_HOLD => RLB_HOLD, + RL_MONI => RL_MONI, + RB_MREQ => RB_MREQ, + RB_SRES => RB_SRES, + RB_LAM => RB_LAM, + RB_STAT => RB_STAT + ); + + SERPORT : serport_1clock + generic map ( + CDWIDTH => CDWIDTH, + CDINIT => CDINIT, + RXFAWIDTH => IFAWIDTH, + TXFAWIDTH => OFAWIDTH) + port map ( + CLK => CLK, + CE_MSEC => CE_MSEC, + RESET => RESET, + ENAXON => ENAXON, + ENAESC => ENAESC, + RXDATA => SER_RXDATA, + RXVAL => SER_RXVAL, + RXHOLD => SER_RXHOLD, + TXDATA => SER_TXDATA, + TXENA => SER_TXENA, + TXBUSY => SER_TXBUSY, + MONI => SER_MONI, + RXSD => RXSD, + TXSD => TXSD, + RXRTS_N => RTS_N, + TXCTS_N => CTS_N + ); + + RLBMUX : rlink_rlbmux + port map ( + SEL => ENAFX2, + RLB_DI => RLB_DI, + RLB_ENA => RLB_ENA, + RLB_BUSY => RLB_BUSY, + RLB_DO => RLB_DO, + RLB_VAL => RLB_VAL, + RLB_HOLD => RLB_HOLD, + P0_RXDATA => SER_RXDATA, + P0_RXVAL => SER_RXVAL, + P0_RXHOLD => SER_RXHOLD, + P0_TXDATA => SER_TXDATA, + P0_TXENA => SER_TXENA, + P0_TXBUSY => SER_TXBUSY, + P1_RXDATA => FX2_RXDATA, + P1_RXVAL => FX2_RXVAL, + P1_RXHOLD => FX2_RXHOLD, + P1_TXDATA => FX2_TXDATA, + P1_TXENA => FX2_TXENA, + P1_TXBUSY => FX2_TXBUSY + ); + + FX2CNTL : fx2_2fifoctl_ic + generic map ( + RXFAWIDTH => 5, + TXFAWIDTH => 5, + PETOWIDTH => PETOWIDTH, + CCWIDTH => CCWIDTH, + RXAEMPTY_THRES => 1, + TXAFULL_THRES => 1) + port map ( + CLK => CLK, + RESET => RESET, + RXDATA => FX2_RXDATA, + RXVAL => FX2_RXVAL, + RXHOLD => FX2_RXHOLD, + RXAEMPTY => FX2_RXAEMPTY, + TXDATA => FX2_TXDATA, + TXENA => FX2_TXENA, + TXBUSY => FX2_TXBUSY, + TXAFULL => FX2_TXAFULL, + MONI => FX2_MONI, + I_FX2_IFCLK => I_FX2_IFCLK, + O_FX2_FIFO => O_FX2_FIFO, + I_FX2_FLAG => I_FX2_FLAG, + O_FX2_SLRD_N => O_FX2_SLRD_N, + O_FX2_SLWR_N => O_FX2_SLWR_N, + O_FX2_SLOE_N => O_FX2_SLOE_N, + O_FX2_PKTEND_N => O_FX2_PKTEND_N, + IO_FX2_DATA => IO_FX2_DATA + ); + + RLB_MONI.rxval <= RLB_VAL; + RLB_MONI.rxhold <= RLB_HOLD; + RLB_MONI.txena <= RLB_ENA; + RLB_MONI.txbusy <= RLB_BUSY; + +end syn; Index: rtl/bplib/fx2rlink/ioleds_sp1c_fx2.vhd =================================================================== --- rtl/bplib/fx2rlink/ioleds_sp1c_fx2.vhd (nonexistent) +++ rtl/bplib/fx2rlink/ioleds_sp1c_fx2.vhd (revision 20) @@ -0,0 +1,115 @@ +-- $Id: ioleds_sp1c_fx2.vhd 509 2013-04-21 20:46:20Z mueller $ +-- +-- Copyright 2013- by Walter F.J. Mueller +-- +-- 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. +-- +------------------------------------------------------------------------------ +-- Module Name: ioleds_sp1c_fx2 - syn +-- Description: io activity leds for rlink+serport_1clk+fx2_ic combo +-- +-- Dependencies: +-- +-- Test bench: - +-- +-- Target Devices: generic +-- Tool versions: xst 13.1; ghdl 0.29 +-- +-- Revision History: +-- Date Rev Version Comment +-- 2013-04-21 509 1.0 Initial version +------------------------------------------------------------------------------ + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.slvtypes.all; +use work.genlib.all; +use work.rblib.all; +use work.rlinklib.all; +use work.serportlib.all; + +entity ioleds_sp1c_fx2 is -- io activity leds for rlink_sp1c_fx2 + port ( + CLK : in slbit; -- clock + CE_USEC : in slbit; -- 1 usec clock enable + RESET : in slbit; -- reset + ENAFX2 : in slbit; -- enable fx2 usage + RB_SRES : in rb_sres_type; -- rbus: response + RLB_MONI : in rlb_moni_type; -- rlink 8b: monitor port + SER_MONI : in serport_moni_type; -- ser: monitor port + IOLEDS : out slv4 -- 4 bit IO monitor (e.g. for DSP_DP) + ); +end entity ioleds_sp1c_fx2; + + +architecture syn of ioleds_sp1c_fx2 is + + signal R_LEDDIV : slv6 := (others=>'0'); -- clock divider for LED pulses + signal R_LEDCE : slbit := '0'; -- ce every 64 usec + + signal TXENA_LED : slbit := '0'; + signal RXVAL_LED : slbit := '0'; + +begin + + RXVAL_PSTR : led_pulse_stretch + port map ( + CLK => CLK, + CE_INT => R_LEDCE, + RESET => '0', + DIN => RLB_MONI.rxval, + POUT => RXVAL_LED + ); + + TXENA_PSTR : led_pulse_stretch + port map ( + CLK => CLK, + CE_INT => R_LEDCE, + RESET => '0', + DIN => RLB_MONI.txena, + POUT => TXENA_LED + ); + + proc_leddiv: process (CLK) + begin + + if rising_edge(CLK) then + R_LEDCE <= '0'; + if CE_USEC = '1' then + R_LEDDIV <= slv(unsigned(R_LEDDIV) - 1); + if unsigned(R_LEDDIV) = 0 then + R_LEDCE <= '1'; + end if; + end if; + end if; + + end process proc_leddiv; + + proc_ledmux : process (ENAFX2, SER_MONI, RLB_MONI, RB_SRES, + TXENA_LED, RXVAL_LED) + begin + + if ENAFX2 = '0' then + IOLEDS(3) <= not SER_MONI.txok; + IOLEDS(2) <= SER_MONI.txact; + IOLEDS(1) <= not SER_MONI.rxok; + IOLEDS(0) <= SER_MONI.rxact; + else + IOLEDS(3) <= RB_SRES.busy; + IOLEDS(2) <= RLB_MONI.txbusy; + IOLEDS(1) <= TXENA_LED; + IOLEDS(0) <= RXVAL_LED; + end if; + + end process proc_ledmux; + +end syn; Index: rtl/bplib/fx2rlink/fx2rlinklib.vhd =================================================================== --- rtl/bplib/fx2rlink/fx2rlinklib.vhd (nonexistent) +++ rtl/bplib/fx2rlink/fx2rlinklib.vhd (revision 20) @@ -0,0 +1,100 @@ +-- $Id: $ +-- +-- Copyright 2013- by Walter F.J. Mueller +-- +-- 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. +-- +------------------------------------------------------------------------------ +-- Package Name: fx2rlinklib +-- Description: Definitions for rlink + fx2 interface combos +-- +-- Dependencies: - +-- Tool versions: xst 13.3; ghdl 0.29 +-- +-- Revision History: +-- Date Rev Version Comment +-- 2013-04-20 509 1.0 Initial version +------------------------------------------------------------------------------ + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.slvtypes.all; +use work.rblib.all; +use work.rlinklib.all; +use work.serportlib.all; +use work.fx2lib.all; + +package fx2rlinklib is + +-- +-- core + fx2 interface combo +-- + +component rlink_sp1c_fx2 is -- rlink_core8+serport_1clk+fx2_ic combo + generic ( + ATOWIDTH : positive := 5; -- access timeout counter width + ITOWIDTH : positive := 6; -- idle timeout counter width + CPREF : slv4 := c_rlink_cpref; -- comma prefix + IFAWIDTH : natural := 5; -- ser input fifo addr width (0=none) + OFAWIDTH : natural := 5; -- ser output fifo addr width (0=none) + PETOWIDTH : positive := 10; -- fx2 packet end time-out counter width + CCWIDTH : positive := 5; -- fx2 chunk counter width + ENAPIN_RLMON : integer := sbcntl_sbf_rlmon; -- SB_CNTL for rlmon (-1=none) + ENAPIN_RBMON : integer := sbcntl_sbf_rbmon; -- SB_CNTL for rbmon (-1=none) + CDWIDTH : positive := 13; -- clk divider width + CDINIT : natural := 15); -- clk divider initial/reset setting + port ( + CLK : in slbit; -- clock + CE_USEC : in slbit; -- 1 usec clock enable + CE_MSEC : in slbit; -- 1 msec clock enable + CE_INT : in slbit := '0'; -- rri ito time unit clock enable + RESET : in slbit; -- reset + ENAXON : in slbit; -- enable xon/xoff handling + ENAESC : in slbit; -- enable xon/xoff escaping + ENAFX2 : in slbit; -- enable fx2 usage + RXSD : in slbit; -- receive serial data (board view) + TXSD : out slbit; -- transmit serial data (board view) + CTS_N : in slbit := '0'; -- clear to send (act.low, board view) + RTS_N : out slbit; -- request to send (act.low, board view) + RB_MREQ : out rb_mreq_type; -- rbus: request + RB_SRES : in rb_sres_type; -- rbus: response + RB_LAM : in slv16; -- rbus: look at me + RB_STAT : in slv3; -- rbus: status flags + RL_MONI : out rl_moni_type; -- rlink_core: monitor port + RLB_MONI : out rlb_moni_type; -- rlink 8b: monitor port + SER_MONI : out serport_moni_type; -- ser: monitor port + FX2_MONI : out fx2ctl_moni_type; -- fx2: monitor port + I_FX2_IFCLK : in slbit; -- fx2: interface clock + O_FX2_FIFO : out slv2; -- fx2: fifo address + I_FX2_FLAG : in slv4; -- fx2: fifo flags + O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low) + O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low) + O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low) + O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low) + IO_FX2_DATA : inout slv8 -- fx2: data lines + ); +end component; + +component ioleds_sp1c_fx2 -- io activity leds for rlink_sp1c_fx2 + port ( + CLK : in slbit; -- clock + CE_USEC : in slbit; -- 1 usec clock enable + RESET : in slbit; -- reset + ENAFX2 : in slbit; -- enable fx2 usage + RB_SRES : in rb_sres_type; -- rbus: response + RLB_MONI : in rlb_moni_type; -- rlink 8b: monitor port + SER_MONI : in serport_moni_type; -- ser: monitor port + IOLEDS : out slv4 -- 4 bit IO monitor (e.g. for DSP_DP) + ); +end component; + +end package fx2rlinklib; Index: rtl/bplib/fx2rlink/rlink_sp1c_fx2.vbom =================================================================== --- rtl/bplib/fx2rlink/rlink_sp1c_fx2.vbom (nonexistent) +++ rtl/bplib/fx2rlink/rlink_sp1c_fx2.vbom (revision 20) @@ -0,0 +1,13 @@ +# libs +../../vlib/slvtypes.vhd +../../vlib/rbus/rblib.vhd +../../vlib/rlink/rlinklib.vbom +../../vlib/serport/serportlib.vbom +../fx2lib/fx2lib.vhd +# components +../../vlib/rlink/rlink_core8.vbom +../../vlib/serport/serport_1clock.vbom +../../vlib/rlink/rlink_rlbmux.vbom +../fx2lib/fx2_2fifoctl_ic.vbom +# design +rlink_sp1c_fx2.vhd Index: rtl/bplib/fx2rlink/ioleds_sp1c_fx2.vbom =================================================================== --- rtl/bplib/fx2rlink/ioleds_sp1c_fx2.vbom (nonexistent) +++ rtl/bplib/fx2rlink/ioleds_sp1c_fx2.vbom (revision 20) @@ -0,0 +1,10 @@ +# libs +../../vlib/slvtypes.vhd +../../vlib/genlib/genlib.vhd +../../vlib/rbus/rblib.vhd +../../vlib/rlink/rlinklib.vbom +../../vlib/serport/serportlib.vbom +# components +../../vlib/genlib/led_pulse_stretch.vbom +# design +ioleds_sp1c_fx2.vhd Index: rtl/bplib/fx2rlink/fx2rlinklib.vbom =================================================================== --- rtl/bplib/fx2rlink/fx2rlinklib.vbom (nonexistent) +++ rtl/bplib/fx2rlink/fx2rlinklib.vbom (revision 20) @@ -0,0 +1,7 @@ +# libs +../../vlib/slvtypes.vhd +../../vlib/rbus/rblib.vhd +../../vlib/rlink/rlinklib.vhd +../../vlib/serport/serportlib.vbom +../fx2lib/fx2lib.vhd +fx2rlinklib.vhd Index: rtl/bplib/fx2rlink/Makefile =================================================================== --- rtl/bplib/fx2rlink/Makefile (nonexistent) +++ rtl/bplib/fx2rlink/Makefile (revision 20) @@ -0,0 +1,25 @@ +# $Id: $ +# +# Revision History: +# Date Rev Version Comment +# 2013-04-20 509 1.0 Initial version (cloned..) +# +VBOM_all = $(wildcard *.vbom) +NGC_all = $(VBOM_all:.vbom=.ngc) +# +include $(RETROBASE)/rtl/make/xflow_default_nexys2.mk +# +.PHONY : all clean +# +all : $(NGC_all) +# +clean : ise_clean +# +#---- +# +include $(RETROBASE)/rtl/make/generic_xflow.mk +# +ifndef DONTINCDEP +include $(VBOM_all:.vbom=.dep_xst) +endif +# Index: rtl/bplib/fx2rlink =================================================================== --- rtl/bplib/fx2rlink (nonexistent) +++ rtl/bplib/fx2rlink (revision 20)
rtl/bplib/fx2rlink Property changes : Added: svn:ignore ## -0,0 +1,32 ## +*.dep_ghdl +*.dep_isim +*.dep_xst +work-obj93.cf +*.vcd +*.ghw +*.sav +*.tmp +*.exe +ise +xflow.his +*.ngc +*.ncd +*.pcf +*.bit +*.msk +isim +isim.log +isim.wdb +fuse.log +*_[sft]sim.vhd +*_tsim.sdf +*_xst.log +*_tra.log +*_twr.log +*_map.log +*_par.log +*_pad.log +*_bgn.log +*_svn.log +*_sum.log +*_[dsft]sim.log Index: rtl/bplib/nexys2/nexys2lib.vhd =================================================================== --- rtl/bplib/nexys2/nexys2lib.vhd (revision 19) +++ rtl/bplib/nexys2/nexys2lib.vhd (revision 20) @@ -1,6 +1,6 @@ --- $Id: nexys2lib.vhd 467 2013-01-02 19:49:05Z mueller $ +-- $Id: nexys2lib.vhd 509 2013-04-21 20:46:20Z mueller $ -- --- Copyright 2010-2011 by Walter F.J. Mueller +-- Copyright 2010-2013 by Walter F.J. Mueller -- -- 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 Index: rtl/bplib/nexys2/tb/tb_nexys2_fusp_cuff.vhd =================================================================== --- rtl/bplib/nexys2/tb/tb_nexys2_fusp_cuff.vhd (revision 19) +++ rtl/bplib/nexys2/tb/tb_nexys2_fusp_cuff.vhd (revision 20) @@ -1,4 +1,4 @@ --- $Id: tb_nexys2_fusp_cuff.vhd 476 2013-01-26 22:23:53Z mueller $ +-- $Id: tb_nexys2_fusp_cuff.vhd 509 2013-04-21 20:46:20Z mueller $ -- -- Copyright 2013- by Walter F.J. Mueller -- @@ -22,7 +22,7 @@ -- tb_nexys2_core -- serport/serport_uart_rxtx -- fx2lib/tb/fx2_2fifo_core --- nexys2_fusp_aif [UUT] +-- nexys2_fusp_cuff_aif [UUT] -- -- To test: generic, any nexys2_fusp_cuff_aif target -- Index: rtl/bplib/nexys3/nexys3lib.vhd =================================================================== --- rtl/bplib/nexys3/nexys3lib.vhd (revision 19) +++ rtl/bplib/nexys3/nexys3lib.vhd (revision 20) @@ -1,6 +1,6 @@ --- $Id: nexys3lib.vhd 432 2011-11-25 20:16:28Z mueller $ +-- $Id: nexys3lib.vhd 509 2013-04-21 20:46:20Z mueller $ -- --- Copyright 2011- by Walter F.J. Mueller +-- Copyright 2011-2013 by Walter F.J. Mueller -- -- 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 @@ -20,6 +20,7 @@ -- -- Revision History: -- Date Rev Version Comment +-- 2013-04-21 509 1.1 add nexys3_cuff_aif, nexys3_fusp_cuff_aif -- 2011-11-25 432 1.0 Initial version ------------------------------------------------------------------------------ @@ -55,7 +56,7 @@ ); end component; -component nexys3_fusp_aif is -- NEXYS 2, abstract iface, base+fusp +component nexys3_fusp_aif is -- NEXYS 3, abstract iface, base+fusp port ( I_CLK100 : in slbit; -- 100 MHz clock I_RXD : in slbit; -- receive data (board view) @@ -84,4 +85,74 @@ ); end component; +component nexys3_cuff_aif is -- NEXYS 3, abstract iface, base+cuff + port ( + I_CLK100 : in slbit; -- 100 MHz clock + I_RXD : in slbit; -- receive data (board view) + O_TXD : out slbit; -- transmit data (board view) + I_SWI : in slv8; -- n3 switches + I_BTN : in slv5; -- n3 buttons + O_LED : out slv8; -- n3 leds + O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low) + O_SEG_N : out slv8; -- 7 segment disp: segments (act.low) + O_MEM_CE_N : out slbit; -- cram: chip enable (act.low) + O_MEM_BE_N : out slv2; -- cram: byte enables (act.low) + O_MEM_WE_N : out slbit; -- cram: write enable (act.low) + O_MEM_OE_N : out slbit; -- cram: output enable (act.low) + O_MEM_ADV_N : out slbit; -- cram: address valid (act.low) + O_MEM_CLK : out slbit; -- cram: clock + O_MEM_CRE : out slbit; -- cram: command register enable + I_MEM_WAIT : in slbit; -- cram: mem wait + O_MEM_ADDR : out slv23; -- cram: address lines + IO_MEM_DATA : inout slv16; -- cram: data lines + O_PPCM_CE_N : out slbit; -- ppcm: ... + O_PPCM_RST_N : out slbit; -- ppcm: ... + I_FX2_IFCLK : in slbit; -- fx2: interface clock + O_FX2_FIFO : out slv2; -- fx2: fifo address + I_FX2_FLAG : in slv4; -- fx2: fifo flags + O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low) + O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low) + O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low) + O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low) + IO_FX2_DATA : inout slv8 -- fx2: data lines + ); +end component; + +component nexys3_fusp_cuff_aif is -- NEXYS 3, abstract iface, +fusp+cuff + port ( + I_CLK100 : in slbit; -- 100 MHz clock + I_RXD : in slbit; -- receive data (board view) + O_TXD : out slbit; -- transmit data (board view) + I_SWI : in slv8; -- n3 switches + I_BTN : in slv5; -- n3 buttons + O_LED : out slv8; -- n3 leds + O_ANO_N : out slv4; -- 7 segment disp: anodes (act.low) + O_SEG_N : out slv8; -- 7 segment disp: segments (act.low) + O_MEM_CE_N : out slbit; -- cram: chip enable (act.low) + O_MEM_BE_N : out slv2; -- cram: byte enables (act.low) + O_MEM_WE_N : out slbit; -- cram: write enable (act.low) + O_MEM_OE_N : out slbit; -- cram: output enable (act.low) + O_MEM_ADV_N : out slbit; -- cram: address valid (act.low) + O_MEM_CLK : out slbit; -- cram: clock + O_MEM_CRE : out slbit; -- cram: command register enable + I_MEM_WAIT : in slbit; -- cram: mem wait + O_MEM_ADDR : out slv23; -- cram: address lines + IO_MEM_DATA : inout slv16; -- cram: data lines + O_PPCM_CE_N : out slbit; -- ppcm: ... + O_PPCM_RST_N : out slbit; -- ppcm: ... + O_FUSP_RTS_N : out slbit; -- fusp: rs232 rts_n + I_FUSP_CTS_N : in slbit; -- fusp: rs232 cts_n + I_FUSP_RXD : in slbit; -- fusp: rs232 rx + O_FUSP_TXD : out slbit; -- fusp: rs232 tx + I_FX2_IFCLK : in slbit; -- fx2: interface clock + O_FX2_FIFO : out slv2; -- fx2: fifo address + I_FX2_FLAG : in slv4; -- fx2: fifo flags + O_FX2_SLRD_N : out slbit; -- fx2: read enable (act.low) + O_FX2_SLWR_N : out slbit; -- fx2: write enable (act.low) + O_FX2_SLOE_N : out slbit; -- fx2: output enable (act.low) + O_FX2_PKTEND_N : out slbit; -- fx2: packet end (act.low) + IO_FX2_DATA : inout slv8 -- fx2: data lines + ); +end component; + end package nexys3lib;
/rtl/bplib/nexys3/tb/tb_nexys3_fusp_cuff.vbom
0,0 → 1,26
# Not meant for direct top level usage. Used with
# tb_nexys3_fusp_cuff_(....)[_ssim].vbom and config
# lines to generate the different cases.
#
# libs
../../../vlib/slvtypes.vhd
../../../vlib/rlink/rlinklib.vbom
../../../vlib/rlink/tb/rlinktblib.vhd
../../../vlib/serport/serportlib.vbom
../../../vlib/xlib/xlib.vhd
../nexys3lib.vhd
../../../vlib/simlib/simlib.vhd
../../../vlib/simlib/simbus.vhd
${sys_conf := sys_conf_sim.vhd}
# components
../../../vlib/simlib/simclk.vbom
../../../vlib/simlib/simclkcnt.vbom
../../../vlib/rlink/tb/tbcore_rlink.vbom
../../../vlib/xlib/dcm_sfs_gsim.vbom
tb_nexys3_core.vbom
../../../vlib/serport/serport_uart_rxtx.vbom
../../../bplib/fx2lib/tb/fx2_2fifo_core.vbom
${nexys3_fusp_cuff_aif := nexys3_fusp_cuff_dummy.vbom}
# design
tb_nexys3_fusp_cuff.vhd
@top:tb_nexys3_fusp_cuff
/rtl/bplib/nexys3/tb/.cvsignore
1,7 → 1,2
tb_nexys3_dummy
tb_nexys3_fusp_dummy
tb_n3_cram_memctl_as
tb_n3_cram_memctl_as_[sft]sim
tb_n3_cram_memctl_as_ISim
tb_n3_cram_memctl_as_ISim_[sft]sim
tb_n3_cram_memctl_stim
tb_nexys3_fusp_cuff_dummy
/rtl/bplib/nexys3/tb/Makefile
1,10 → 1,11
# $Id: Makefile 477 2013-01-27 14:07:10Z mueller $
# $Id: Makefile 509 2013-04-21 20:46:20Z mueller $
#
# Revision History:
# Date Rev Version Comment
# 2011-11-26 432 1.0 Initial version
#
EXE_all = tb_nexys3_fusp_dummy
EXE_all = tb_nexys3_fusp_dummy
EXE_all += tb_nexys3_fusp_cuff_dummy
#
include $(RETROBASE)/rtl/make/xflow_default_nexys3.mk
#
/rtl/bplib/nexys3/tb/tb_nexys3_fusp_cuff.vhd
0,0 → 1,331
-- $Id: tb_nexys3_fusp_cuff.vhd 509 2013-04-21 20:46:20Z 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.
--
------------------------------------------------------------------------------
-- Module Name: tb_nexys3_fusp_cuff - sim
-- Description: Test bench for nexys3 (base+fusp+cuff)
--
-- Dependencies: simlib/simclk
-- simlib/simclkcnt
-- xlib/dcm_sfs
-- rlink/tb/tbcore_rlink
-- tb_nexys3_core
-- serport/serport_uart_rxtx
-- fx2lib/tb/fx2_2fifo_core
-- nexys3_fusp_cuff_aif [UUT]
--
-- To test: generic, any nexys3_fusp_cuff_aif target
--
-- Target Devices: generic
-- Tool versions: xst 13.1; ghdl 0.29
--
-- Revision History:
-- Date Rev Version Comment
-- 2013-04-21 509 1.0 Initial version (derived from tb_nexys3_fusp and
-- tb_nexys2_fusp_cuff)
------------------------------------------------------------------------------
 
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use ieee.std_logic_textio.all;
use std.textio.all;
 
use work.slvtypes.all;
use work.rlinklib.all;
use work.rlinktblib.all;
use work.serportlib.all;
use work.xlib.all;
use work.nexys3lib.all;
use work.simlib.all;
use work.simbus.all;
use work.sys_conf.all;
 
entity tb_nexys3_fusp_cuff is
end tb_nexys3_fusp_cuff;
 
architecture sim of tb_nexys3_fusp_cuff is
signal CLKOSC : slbit := '0'; -- board clock (100 Mhz)
signal CLKCOM : slbit := '0'; -- communication clock
 
signal CLK_STOP : slbit := '0';
signal CLKCOM_CYCLE : integer := 0;
 
signal RESET : slbit := '0';
signal CLKDIV : slv2 := "00"; -- run with 1 clocks / bit !!
signal TBC_RXDATA : slv8 := (others=>'0');
signal TBC_RXVAL : slbit := '0';
signal TBC_RXHOLD : slbit := '0';
signal TBC_TXDATA : slv8 := (others=>'0');
signal TBC_TXENA : slbit := '0';
 
signal UART_RXDATA : slv8 := (others=>'0');
signal UART_RXVAL : slbit := '0';
signal UART_RXERR : slbit := '0';
signal UART_RXACT : slbit := '0';
signal UART_TXDATA : slv8 := (others=>'0');
signal UART_TXENA : slbit := '0';
signal UART_TXBUSY : slbit := '0';
 
signal FX2_RXDATA : slv8 := (others=>'0');
signal FX2_RXENA : slbit := '0';
signal FX2_RXBUSY : slbit := '0';
signal FX2_TXDATA : slv8 := (others=>'0');
signal FX2_TXVAL : slbit := '0';
 
signal I_RXD : slbit := '1';
signal O_TXD : slbit := '1';
signal I_SWI : slv8 := (others=>'0');
signal I_BTN : slv5 := (others=>'0');
signal O_LED : slv8 := (others=>'0');
signal O_ANO_N : slv4 := (others=>'0');
signal O_SEG_N : slv8 := (others=>'0');
 
signal O_MEM_CE_N : slbit := '1';
signal O_MEM_BE_N : slv2 := (others=>'1');
signal O_MEM_WE_N : slbit := '1';
signal O_MEM_OE_N : slbit := '1';
signal O_MEM_ADV_N : slbit := '1';
signal O_MEM_CLK : slbit := '0';
signal O_MEM_CRE : slbit := '0';
signal I_MEM_WAIT : slbit := '0';
signal O_MEM_ADDR : slv23 := (others=>'Z');
signal IO_MEM_DATA : slv16 := (others=>'0');
signal O_PPCM_CE_N : slbit := '0';
signal O_PPCM_RST_N : slbit := '0';
 
signal O_FUSP_RTS_N : slbit := '0';
signal I_FUSP_CTS_N : slbit := '0';
signal I_FUSP_RXD : slbit := '1';
signal O_FUSP_TXD : slbit := '1';
 
signal I_FX2_IFCLK : slbit := '0';
signal O_FX2_FIFO : slv2 := (others=>'0');
signal I_FX2_FLAG : slv4 := (others=>'0');
signal O_FX2_SLRD_N : slbit := '1';
signal O_FX2_SLWR_N : slbit := '1';
signal O_FX2_SLOE_N : slbit := '1';
signal O_FX2_PKTEND_N : slbit := '1';
signal IO_FX2_DATA : slv8 := (others=>'Z');
 
signal UART_RESET : slbit := '0';
signal UART_RXD : slbit := '1';
signal UART_TXD : slbit := '1';
signal CTS_N : slbit := '0';
signal RTS_N : slbit := '0';
 
signal R_PORTSEL_SER : slbit := '0'; -- if 1 use alternate serport
signal R_PORTSEL_FX2 : slbit := '0'; -- if 1 use fx2
 
constant sbaddr_portsel: slv8 := slv(to_unsigned( 8,8));
 
constant clock_period : time := 10 ns;
constant clock_offset : time := 200 ns;
 
begin
CLKGEN : simclk
generic map (
PERIOD => clock_period,
OFFSET => clock_offset)
port map (
CLK => CLKOSC,
CLK_STOP => CLK_STOP
);
SB_CLKSTOP <= CLK_STOP;
 
DCM_COM : dcm_sfs
generic map (
CLKFX_DIVIDE => sys_conf_clkfx_divide,
CLKFX_MULTIPLY => sys_conf_clkfx_multiply,
CLKIN_PERIOD => 10.0)
port map (
CLKIN => CLKOSC,
CLKFX => CLKCOM,
LOCKED => open
);
 
CLKCNT : simclkcnt port map (CLK => CLKCOM, CLK_CYCLE => CLKCOM_CYCLE);
 
TBCORE : tbcore_rlink
port map (
CLK => CLKCOM,
CLK_STOP => CLK_STOP,
RX_DATA => TBC_RXDATA,
RX_VAL => TBC_RXVAL,
RX_HOLD => TBC_RXHOLD,
TX_DATA => TBC_TXDATA,
TX_ENA => TBC_TXENA
);
 
N3CORE : entity work.tb_nexys3_core
port map (
I_SWI => I_SWI,
I_BTN => I_BTN,
O_MEM_CE_N => O_MEM_CE_N,
O_MEM_BE_N => O_MEM_BE_N,
O_MEM_WE_N => O_MEM_WE_N,
O_MEM_OE_N => O_MEM_OE_N,
O_MEM_ADV_N => O_MEM_ADV_N,
O_MEM_CLK => O_MEM_CLK,
O_MEM_CRE => O_MEM_CRE,
I_MEM_WAIT => I_MEM_WAIT,
O_MEM_ADDR => O_MEM_ADDR,
IO_MEM_DATA => IO_MEM_DATA
);
 
UUT : nexys3_fusp_cuff_aif
port map (
I_CLK100 => CLKOSC,
I_RXD => I_RXD,
O_TXD => O_TXD,
I_SWI => I_SWI,
I_BTN => I_BTN,
O_LED => O_LED,
O_ANO_N => O_ANO_N,
O_SEG_N => O_SEG_N,
O_MEM_CE_N => O_MEM_CE_N,
O_MEM_BE_N => O_MEM_BE_N,
O_MEM_WE_N => O_MEM_WE_N,
O_MEM_OE_N => O_MEM_OE_N,
O_MEM_ADV_N => O_MEM_ADV_N,
O_MEM_CLK => O_MEM_CLK,
O_MEM_CRE => O_MEM_CRE,
I_MEM_WAIT => I_MEM_WAIT,
O_MEM_ADDR => O_MEM_ADDR,
IO_MEM_DATA => IO_MEM_DATA,
O_PPCM_CE_N => O_PPCM_CE_N,
O_PPCM_RST_N => O_PPCM_RST_N,
O_FUSP_RTS_N => O_FUSP_RTS_N,
I_FUSP_CTS_N => I_FUSP_CTS_N,
I_FUSP_RXD => I_FUSP_RXD,
O_FUSP_TXD => O_FUSP_TXD,
I_FX2_IFCLK => I_FX2_IFCLK,
O_FX2_FIFO => O_FX2_FIFO,
I_FX2_FLAG => I_FX2_FLAG,
O_FX2_SLRD_N => O_FX2_SLRD_N,
O_FX2_SLWR_N => O_FX2_SLWR_N,
O_FX2_SLOE_N => O_FX2_SLOE_N,
O_FX2_PKTEND_N => O_FX2_PKTEND_N,
IO_FX2_DATA => IO_FX2_DATA
);
 
UART : serport_uart_rxtx
generic map (
CDWIDTH => CLKDIV'length)
port map (
CLK => CLKCOM,
RESET => UART_RESET,
CLKDIV => CLKDIV,
RXSD => UART_RXD,
RXDATA => UART_RXDATA,
RXVAL => UART_RXVAL,
RXERR => UART_RXERR,
RXACT => UART_RXACT,
TXSD => UART_TXD,
TXDATA => UART_TXDATA,
TXENA => UART_TXENA,
TXBUSY => UART_TXBUSY
);
 
FX2 : entity work.fx2_2fifo_core
port map (
CLK => CLKCOM,
RESET => '0',
RXDATA => FX2_RXDATA,
RXENA => FX2_RXENA,
RXBUSY => FX2_RXBUSY,
TXDATA => FX2_TXDATA,
TXVAL => FX2_TXVAL,
IFCLK => I_FX2_IFCLK,
FIFO => O_FX2_FIFO,
FLAG => I_FX2_FLAG,
SLRD_N => O_FX2_SLRD_N,
SLWR_N => O_FX2_SLWR_N,
SLOE_N => O_FX2_SLOE_N,
PKTEND_N => O_FX2_PKTEND_N,
DATA => IO_FX2_DATA
);
 
proc_fx2_mux: process (R_PORTSEL_FX2, TBC_RXDATA, TBC_RXVAL,
UART_TXBUSY, RTS_N, UART_RXDATA, UART_RXVAL,
FX2_RXBUSY, FX2_TXDATA, FX2_TXVAL
)
begin
 
if R_PORTSEL_FX2 = '0' then -- use serport
UART_TXDATA <= TBC_RXDATA;
UART_TXENA <= TBC_RXVAL;
TBC_RXHOLD <= UART_TXBUSY or RTS_N;
TBC_TXDATA <= UART_RXDATA;
TBC_TXENA <= UART_RXVAL;
else -- otherwise use fx2
FX2_RXDATA <= TBC_RXDATA;
FX2_RXENA <= TBC_RXVAL;
TBC_RXHOLD <= FX2_RXBUSY;
TBC_TXDATA <= FX2_TXDATA;
TBC_TXENA <= FX2_TXVAL;
end if;
end process proc_fx2_mux;
 
proc_ser_mux: process (R_PORTSEL_SER, UART_TXD, CTS_N,
O_TXD, O_FUSP_TXD, O_FUSP_RTS_N)
begin
 
if R_PORTSEL_SER = '0' then -- use main board rs232, no flow cntl
I_RXD <= UART_TXD; -- write port 0 inputs
UART_RXD <= O_TXD; -- get port 0 outputs
RTS_N <= '0';
I_FUSP_RXD <= '1'; -- port 1 inputs to idle state
I_FUSP_CTS_N <= '0';
else -- otherwise use pmod1 rs232
I_FUSP_RXD <= UART_TXD; -- write port 1 inputs
I_FUSP_CTS_N <= CTS_N;
UART_RXD <= O_FUSP_TXD; -- get port 1 outputs
RTS_N <= O_FUSP_RTS_N;
I_RXD <= '1'; -- port 0 inputs to idle state
end if;
end process proc_ser_mux;
 
proc_moni: process
variable oline : line;
begin
loop
wait until rising_edge(CLKCOM);
 
if UART_RXERR = '1' then
writetimestamp(oline, CLKCOM_CYCLE, " : seen UART_RXERR=1");
writeline(output, oline);
end if;
end loop;
end process proc_moni;
 
proc_simbus: process (SB_VAL)
begin
if SB_VAL'event and to_x01(SB_VAL)='1' then
if SB_ADDR = sbaddr_portsel then
R_PORTSEL_SER <= to_x01(SB_DATA(0));
R_PORTSEL_FX2 <= to_x01(SB_DATA(1));
end if;
end if;
end process proc_simbus;
 
end sim;
rtl/bplib/nexys3/tb Property changes : Modified: svn:ignore ## -30,10 +30,5 ## *_svn.log *_sum.log *_[dsft]sim.log -tb_nexys3_dummy tb_nexys3_fusp_dummy -tb_n3_cram_memctl_as -tb_n3_cram_memctl_as_[sft]sim -tb_n3_cram_memctl_as_ISim -tb_n3_cram_memctl_as_ISim_[sft]sim -tb_n3_cram_memctl_stim +tb_nexys3_fusp_cuff_dummy Index: rtl/vlib/rlink/rlinklib.vhd =================================================================== --- rtl/vlib/rlink/rlinklib.vhd (revision 19) +++ rtl/vlib/rlink/rlinklib.vhd (revision 20) @@ -1,6 +1,6 @@ --- $Id: rlinklib.vhd 495 2013-03-06 17:13:48Z mueller $ +-- $Id: rlinklib.vhd 509 2013-04-21 20:46:20Z mueller $ -- --- Copyright 2007-2012 by Walter F.J. Mueller +-- Copyright 2007-2013 by Walter F.J. Mueller -- -- 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 @@ -20,6 +20,7 @@ -- -- Revision History: -- Date Rev Version Comment +-- 2013-04-21 509 3.3.2 add rlb_moni record definition -- 2012-12-29 466 3.3.1 add rlink_rlbmux -- 2011-12-23 444 3.3 CLK_CYCLE now integer -- 2011-12-21 442 3.2.1 retire old, deprecated interfaces @@ -100,6 +101,16 @@ constant rl_moni_init : rl_moni_type := ('0','0','0'); -- eop,attn,lamp +type rlb_moni_type is record -- rlink 8b monitor port + rxval : slbit; -- data in valid + rxhold : slbit; -- data in hold + txena : slbit; -- data out enable + txbusy : slbit; -- data out busy +end record rlb_moni_type; + +constant rlb_moni_init : rlb_moni_type := + ('0','0','0','0'); -- rxval,rxhold,txena,txbusy + -- ise 13.1 xst can bug check if generic defaults in a package are defined via -- 'slv(to_unsigned())'. The conv_ construct prior to numeric_std was ok. -- As workaround the ibus default addresses are defined here as constant.
/doc/INSTALL.txt
1,4 → 1,4
# $Id: INSTALL.txt 504 2013-04-13 15:37:24Z mueller $
# $Id: INSTALL.txt 511 2013-04-27 13:51:46Z mueller $
 
Guide to install and build w11a systems, test benches and support software
 
311,6 → 311,10
 
make <sys>.iconfig
 
For boards with a Cypress FX2 USB controller load the bitfile directly with
 
make <sys>.jconfig
 
If only the xst or par output is wanted just use
 
make <sys>.ngc
336,7 → 340,7
 
make <sys>.iconfig
 
For using the Cypress FX2 USB controlle on Digilent Nexys2, Nexys3 and
For using the Cypress FX2 USB controller on Digilent Nexys2, Nexys3 and
Atlys boards just connect the USB cable and
 
make <sys>.jconfig
/doc/w11a_os_guide.txt
1,4 → 1,4
# $Id: w11a_os_guide.txt 469 2013-01-05 12:29:44Z mueller $
# $Id: w11a_os_guide.txt 511 2013-04-27 13:51:46Z mueller $
 
Guide to run operating system images on w11a systems
 
13,41 → 13,56
1. I/O emulation setup ----------------------------------------------------
 
All UNIBUS peripherals which exchange data (currently DL11, LP11, PC11, RK11)
are currently emulated via a backend process. In the current version the
communication between FPGA board and backend is via the serial port, either
directly or via a USB-RS232 adapter. A direct connection is limited to 115k
Baud on most PCs, while a connection via a USB-RS232 adapter was tested up
to 460k Baud.
are currently emulated via a backend process. The communication between
FPGA board and backend server can be via
 
Notes: - A USB-RS232 cable with a Prolific Technology PL2303 chip simply
never gave reliable connections for higher Baud rates.
- A USB-RS232 cable with a FTDI FT232R chip, like the cable offered
by FTDI as US232R-100 worked fine.
- On older linux kernels (prior 2.6.32) it is essential to set the
latency timer for the FTDI USB-RS232 cable to 1 ms (from the power
in default of 16 ms), e.g. with
sudo $RETROBASE/tools/bin/set_ftdi_lat USB0 1
For linux kernel 2.6.32 or newer the default is 1 ms already.
- the following assumes that a USB-RS232 cable with FTDI chip is used
- Serial port
- via direct (/dev/ttySx) or via a USB-RS232 adapter. A direct connection
is limited to 115k Baud on most PCs, while a connection via a USB-RS232
adapter was tested up to 460k Baud. A USB-RS232 adapter is thus highly
recommended
- via integrated USB-RS232 adapter, like on nexys3 board. This is much
faster, allows bitrates up to 2 M Baud.
Notes: - A USB-RS232 cable with a Prolific Technology PL2303 chip simply
never gave reliable connections for higher Baud rates.
- A USB-RS232 cable with a FTDI FT232R chip, like the cable offered
by FTDI as US232R-100 worked fine.
- On older linux kernels (prior 2.6.32) it is essential to set the
latency timer for the FTDI USB-RS232 cable to 1 ms (from the
power up default of 16 ms), e.g. with
sudo $RETROBASE/tools/bin/set_ftdi_lat USB0 1
For linux kernel 2.6.32 or newer the default is 1 ms already.
- The rest assumes that a USB-RS232 cable with FTDI chip is used
- A 460k Baud connection gives in practice a disk throughput of
about 20 kB/s. This allows to test the system but is a bit slow
to real usage. In an OS with good disk caching like 2.11BSD the
impact of such a 'slow disk' is actually smaller than the bare
numbers suggest.
 
A 460k Baud connection gives in practice a disk throughput of about 20 kB/s.
This allows to test the system but is a bit slow to real usage. In an OS
with good disk caching like 2.11BSD the impact of such a 'slow disk' is
actually smaller than the bare numbers suggest.
- Direct USB connection using a Cypress FX2 USB controller
- is supported on the nexys2 and nexys3 FPGA boards
- clearly much faster than serial port connections
- also allows to configure the FPGA over the same USB connection
 
2. FPGA Board setup -------------------------------------------------------
 
- for s3board and nexys2
- connect the USB-RS232 cable to the RS232 port of the s3board or nexys2
- for kernel < 2.6.32: set the latency timer of the USB-RS232, e.g. with
sudo $RETROBASE/tools/bin/set_ftdi_lat USB0 1
- ensure that all 8 switches are in the indicated positions (SWI=xxxxxxxx)
- load the w11a design into the FPGA, e.g. via impact
- Using serial port
- for s3board and nexys2
- connect the USB-RS232 cable to the RS232 port of the s3board or nexys2
- for kernel < 2.6.32: set the latency timer of the USB-RS232, e.g. with
sudo $RETROBASE/tools/bin/set_ftdi_lat USB0 1
- ensure that all 8 switches are in the indicated positions (SWI=...)
- load the w11a design into the FPGA, e.g. via impact
- for nexys3
- connect USB cable to the 'usb uart' port (next to the 5 buttons)
- ensure that all 8 switches are in the indicated positions (SWI=...)
- load the w11a design into the FPGA, e.g. via impact
 
- for nexys3
- connect USB cable to the 'usb uart' port (next to the 5 buttons)
- ensure that all 8 switches are in the indicated positions (SWI=xxxxxxxx)
- load the w11a design into the FPGA, e.g. via impact
- Using Cypress FX2 USB controller
- for nexys2
- connect USB cable to mini-USB connector (between RS232 and PS/2 port)
! Must be connected to a USB port able to deliver 500 mA !
 
3. Unix V5 system ---------------------------------------------------------
 
56,13 → 71,11
Download, unpack and copy the disk images (*.dsk) to
$RETROBASE/rtl/sys_gen/w11a/tb
 
- Setup USB-RS232 cable, start xterm in vt100 mode and the server backend
Note: It is essential that the settings of the board switches are correct
in the following indicated by SWI = xxxxxxxx.
- Using old (pi_rri) backend server (serial port only)
 
cd $RETROBASE/rtl/sys_gen/w11a/tb
sudo $RETROBASE/tools/bin/set_ftdi_lat USB0 1
telnet_starter -d DL0 &
 
[for s3,n2:]
SWI = 00000010
dorri -u0,460,1,2 @uv5_boot.pcmd
70,6 → 83,22
SWI = 00000010
dorri -u0,2000,1,2 @uv5_boot.pcmd
 
- Using new (ti_rri) backend server (serial and fx2 supported)
 
cd $RETROBASE/rtl/sys_gen/w11a/tb
telnet_starter -d DL0 &
 
[for s3,n2 over serial:]
SWI = 00000010
torri -tu0,460k,break,xon @uv5_boot.tcl
[for n3 over serial:]
SWI = 00000010
torri -tu0,2M,break,xon @uv5_boot.tcl
 
[for n2,n3 over fx2:]
SWI = 00000100
torri -u @uv5_boot.tcl
 
- the boot dialog in the console xterm window will look like
(required input is in {..}, with {<CR>} denoting a carriage return:
 
101,14 → 130,13
Download, unpack and copy the disk images (*.dsk) to
$RETROBASE/rtl/sys_gen/w11a/tb
 
- Setup USB-RS232 cable, start two xterm in vt100 mode and the server backend
Note: It is essential that the settings of the board switches are correct
in the following indicated by SWI = xxxxxxxx.
- Using old (pi_rri) backend server (serial port only)
 
cd $RETROBASE/rtl/sys_gen/w11a/tb
sudo $RETROBASE/tools/bin/set_ftdi_lat USB0 1
telnet_starter -d DL0 &
telnet_starter -d DL1 &
 
[for s3,n2:]
SWI = 00000010
dorri -u0,460,1,2 @211bsd_rk_boot.pcmd
116,6 → 144,22
SWI = 00000010
dorri -u0,2000,1,2 @211bsd_rk_boot.pcmd
 
- Using new (ti_rri) backend server (serial and fx2 supported)
 
cd $RETROBASE/rtl/sys_gen/w11a/tb
telnet_starter -d DL0 &
 
[for s3,n2 over serial:]
SWI = 00000010
torri -tu0,460k,break,xon @211bsd_rk_boot.tcl
[for n3 over serial:]
SWI = 00000010
torri -tu0,2M,break,xon @211bsd_rk_boot.tcl
 
[for n2,n3 over fx2:]
SWI = 00000100
torri -u @211bsd_rk_boot.tcl
 
- the boot dialog in the console xterm window will look like
(required input is in {..}, with {<CR>} denoting a carriage return:
 
156,11 → 200,8
starting local daemons:Sun Jan 4 16:46:37 PST 2009
January 4 16:46:37 init: kernel security level changed from 0 to 1
January 4 16:46:40 getty: /dev/tty01: Device not configured
...
January 4 16:46:40 getty: /dev/tty00: Device not configured
2.11 BSD UNIX (curly.2bsd.com) (console)
login: {root}
187,4 → 228,4
syncing disks... done
halting
 
Now the server process can be stopped with two ^D.
Now the server process can be stopped with ^D.
/doc/w11a_tb_guide.txt
1,4 → 1,4
# $Id: w11a_tb_guide.txt 504 2013-04-13 15:37:24Z mueller $
# $Id: w11a_tb_guide.txt 511 2013-04-27 13:51:46Z mueller $
 
Guide to running w11a test benches
 
161,7 → 161,7
 
4. Available system tests benches -----------------------------------------
 
4a. serport tester -- --------------------------------------------
4a. serport tester ---------------------------------------------------
 
The sys_tst_serloop design is a test target for validating the serial
link UART stack. Send and receive throughput as well as loop-back tests
248,9 → 248,9
 
cd $RETROBASE/rtl/sys_gen/w11a/s3board/tb
make tb_w11a_s3
time ti_rri --pack=rw11a --run="tbw tb_w11a_s3" --fifo --logl=3 -- \
"rw11a::setup_cpu" \
"rw11a::run_pdpcp ../../../../w11a/tb/tb_pdp11core_stim.dat" |\
time ti_rri --pack=rw11 --run="tbw tb_w11a_s3" --fifo --logl=3 -- \
"rw11::setup_cpu" \
"rw11::run_pdpcp ../../../../w11a/tb/tb_pdp11core_stim.dat" |\
tee tb_w11a_s3_stim2_dsim.log | egrep "(-[EFW]:|FAIL|PEND|DONE)"
-> 10225140.0 ns 511247: DONE
-> real 0m52.105s user 0m0.260s sys 0m0.132s
259,9 → 259,9
 
cd $RETROBASE/rtl/sys_gen/w11a/nexys2/tb
make tb_w11a_n2
time ti_rri --pack=rw11a --run="tbw tb_w11a_n2" --fifo --logl=3 -- \
"rw11a::setup_cpu" \
"rw11a::run_pdpcp ../../../../w11a/tb/tb_pdp11core_stim.dat" |\
time ti_rri --pack=rw11 --run="tbw tb_w11a_n2" --fifo --logl=3 -- \
"rw11::setup_cpu" \
"rw11::run_pdpcp ../../../../w11a/tb/tb_pdp11core_stim.dat" |\
tee tb_w11a_n2_stim2_dsim.log | egrep "(-[EFW]:|FAIL|PEND|DONE)"
-> 10278380.0 ns 513908: DONE
-> real 1m26.388s user 0m0.312s sys 0m0.156s
270,9 → 270,9
 
cd $RETROBASE/rtl/sys_gen/w11a/nexys3/tb
make tb_w11a_n3
time ti_rri --pack=rw11a --run="tbw tb_w11a_n3" --fifo --logl=3 -- \
"rw11a::setup_cpu" \
"rw11a::run_pdpcp ../../../../w11a/tb/tb_pdp11core_stim.dat" |\
time ti_rri --pack=rw11 --run="tbw tb_w11a_n3" --fifo --logl=3 -- \
"rw11::setup_cpu" \
"rw11::run_pdpcp ../../../../w11a/tb/tb_pdp11core_stim.dat" |\
tee tb_w11a_n3_stim2_dsim.log | egrep "(-[EFW]:|FAIL|PEND|DONE)"
-> 5167410.0 ns 516720: DONE
-> real 1m26.611s user 0m0.248s sys 0m0.196s
284,8 → 284,8
 
cd $RETROBASE/rtl/sys_gen/w11a/nexys2/tb
make tb_w11a_n2
time ti_rri --pack=rw11a --run="tbw tb_w11a_n2" --fifo --logl=3 -- \
"rw11a::setup_cpu" "rw11a::tbench @w11a_all.dat" | \
time ti_rri --pack=rw11 --run="tbw tb_w11a_n2" --fifo --logl=3 -- \
"rw11::setup_cpu" "rw11::tbench @w11a_all.dat" | \
tee w11a_tbench_dsim.log | egrep "(-[EFW]:|FAIL|PASS|DONE)"
-> 904180.0 ns 45198: DONE
-> real 0m5.739s user 0m0.576s sys 0m0.076s
/doc/README.txt
1,4 → 1,4
# $Id: README.txt 504 2013-04-13 15:37:24Z mueller $
# $Id: README.txt 511 2013-04-27 13:51:46Z mueller $
 
Release notes for w11a
 
80,9 → 80,37
 
3. Change Log ----------------------------------------------------------------
 
- trunk (2013-06-13: svn rev 19(oc) 505(wfjm); untagged w11a_V0.562) +++++++++
- trunk (2013-04-27: svn rev 20(oc) 511(wfjm); untagged w11a_V0.57) +++++++++
 
- Summary
- 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
 
- New features
- new modules
- rtl/bplib/fx2rlink - new vhdl lib with rlink over fx2 modules
- ioleds_sp1c_fx2 - io activity leds for rlink_sp1c_fx2
- rlink_sp1c_fx2 - rlink over serport + fx2 combo
- tools/src/librw11
- Rw11*RK11 - classes for RK11 disk handling
- Rw11*Disk* - classes for Virtual disk handling
- tools/src/librwxxtpp
- RtclRw11*RK11 - tcl iface for RK11 disk handling
- RtclRw11*Disk* - tcl iface for Virtual disk handling
- new files
- rtl/sys_gen/w11a/tb/torri - quick starter for new backend
 
- Changes
- tcl module renames:
tools/tcl/rw11a -> tools/tcl/rw11
 
- Bug fixes
- tools/src/ReventLoop: poll list update logic in DoPoll() corrected
 
- trunk (2013-04-13: svn rev 19(oc) 505(wfjm); untagged w11a_V0.562) +++++++++
 
- Summary
- V0.53 introduced a new C++ and Tcl based backend server, but only the
very basic rlink handling layer. This step release add now many support
classes for interfacing to w11 system designs, and the associated Tcl

powered by: WebSVN 2.1.0

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