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

Subversion Repositories w11

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 wfjm
# $Id: perf.tcl 516 2013-05-05 21:24:52Z mueller $
2 11 wfjm
#
3
# Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
#
5
# This program is free software; you may redistribute and/or modify it under
6
# the terms of the GNU General Public License as published by the Free
7
# Software Foundation, either version 2, or at your option any later version.
8
#
9
# This program is distributed in the hope that it will be useful, but
10
# WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
# for complete details.
13
#
14
#  Revision History:
15
# Date         Rev Version  Comment
16
# 2011-04-17   376   1.0    Initial version
17
#
18
 
19
package provide tst_rlink 1.0
20
 
21
namespace eval tst_rlink {
22
  #
23
  # perf_wtlam: determine wtlam latency using timer.0
24
  # 
25
  proc perf_wtlam {{tmax 1000}} {
26
    if {$tmax < 1} { error "-E: perf_wtlam: tmax argument must be >= 1" }
27
 
28
    set rval "delay  latency"
29
 
30
    rlc exec -init 0xff [regbld rlink::INIT anena]
31
 
32
    for {set dly 250} {$dly <= 10000} {incr dly 250} {
33
      rlc exec \
34
        -wreg timer.0 0 \
35
        -wreg timer.1 0
36
      rlc exec -attn
37
 
38
      set tbeg [clock clicks -milliseconds]
39
      rlc exec -wreg timer.0 $dly
40
      for {set i 1} {1} {incr i} {
41
        rlc wtlam 1.
42
        rlc exec \
43
          -attn \
44
          -wreg timer.0 $dly
45 21 wfjm
        set trun [expr {[clock clicks -milliseconds] - $tbeg}]
46 11 wfjm
        if {$trun > $tmax} { break }
47
      }
48 21 wfjm
      set ms [expr {double($trun) / double($i)}]
49 11 wfjm
      append rval [format "\n%5d   %6.2f" $dly $ms]
50
    }
51
 
52
    rlc exec -init 0xff [regbld rlink::INIT {anena 0}]
53
 
54
    return $rval
55
  }
56
}

powered by: WebSVN 2.1.0

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