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

Subversion Repositories ethernet_tri_mode

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 9 to Rev 10
    Reverse comparison

Rev 9 → Rev 10

/trunk/sim/rtl_sim/ncsim_sim/script/set_stimulus.tcl
0,0 → 1,101
proc set_stimulus {} {
toplevel .stimulus
focus .stimulus
wm title .stimulus "Setting Stimulus Prameters"
variable StartLength
variable EndLength
variable PacketNumber
variable Random
variable Broadcast
variable help_string
set help_string {
Set Stimulus Help:
You can select to generate packet with sequential packet length or
random packet length. If you choise random packet length, the length of
generated packet will be a random value between the "Packet begin length"
to the "Packet end length". "Total Gen Packet number"is used to set the
number of packet will be generated as stimulus
As well, you can select "sequence" mode . The first Packet will be
generated with "Packet begin length",and the next Packet length will be
"Packet begin length" pluse one untile the packet length reach the value
of "Packet end length". Packet in each length will be generated according
to the value of "Packet number per length" }
if {[catch {open ../data/config.ini r} fileid]} {
set StartLength 46
set EndLength 60
set PacketNumber 1
set Random 0
set Broadcast 0
} \
else {
gets $fileid content
scan $content "%d,%d,%d,%d,%d" StartLength EndLength PacketNumber Random Broadcast
close $fileid
}
 
frame .stimulus.f1
label .stimulus.f1.lb -text "Packet begin length:"
entry .stimulus.f1.en -textvariable StartLength
pack .stimulus.f1 -fill x
pack .stimulus.f1.en .stimulus.f1.lb -side right
 
frame .stimulus.f2
label .stimulus.f2.lb -text "Packet end length:"
entry .stimulus.f2.en -textvariable EndLength
pack .stimulus.f2 -fill x
pack .stimulus.f2.en .stimulus.f2.lb -side right
 
frame .stimulus.f3
label .stimulus.f3.lb -text "Packet number per length:"
entry .stimulus.f3.en -textvariable PacketNumber
pack .stimulus.f3 -fill x
pack .stimulus.f3.en .stimulus.f3.lb -side right
 
frame .stimulus.f4
radiobutton .stimulus.f4.1 -text "Sequence" -variable Random -value 0 \
-command {.stimulus.f3.lb config -text "Packet number per length:"}
radiobutton .stimulus.f4.2 -text "Random" -variable Random -value 1 \
-command {.stimulus.f3.lb config -text "Total Gen Packet number:"}
pack .stimulus.f4 -fill x
pack .stimulus.f4.1 .stimulus.f4.2 -side right
frame .stimulus.f5
checkbutton .stimulus.f5.1 -text "Broadcast" -variable Broadcast
pack .stimulus.f5 -fill x
pack .stimulus.f5.1 -side right
frame .stimulus.f20
button .stimulus.f20.1 -text "Save" -width 10 \
-com { set fileid [open ../data/config.ini w 0600]
puts $fileid "$StartLength,$EndLength,$PacketNumber,$Random,$Broadcast"
close $fileid
destroy .stimulus
}
button .stimulus.f20.2 -text "Save as" -com {sti_save_as $StartLength $EndLength $PacketNumber $Random $Broadcast} -width 10
button .stimulus.f20.3 -text "Cancel" -com {destroy .stimulus} -width 10
button .stimulus.f20.4 -text "Help" -width 10 -com {print_help $help_string}
pack .stimulus.f20 -fill x
pack .stimulus.f20.1 .stimulus.f20.2 .stimulus.f20.3 .stimulus.f20.4 -side left
}
 
proc sti_save_as {StartLength EndLength PacketNumber Random Broadcast} {
global fileselect
cd ../data
fileselect
tkwait window .fileSelectWindow
if {$fileselect(canceled)==1} {
return
} elseif {$fileselect(selectedfile)==""} {
warning_message "file have not been selected!"
} else {
set fileid [open $fileselect(selectedfile) w 0600]
puts $fileid "$StartLength,$EndLength,$PacketNumber,$Random,$Broadcast"
close $fileid
destroy .stimulus
}
}
/trunk/sim/rtl_sim/ncsim_sim/script/set_reg_data.tcl
0,0 → 1,192
proc set_reg_data {} {
variable help_strings
variable RegVector
variable datalist
set help_strings {
Set Reg Data:
The verifcation system will config DUT(Design Under Test)
with those data automatically at startup time. You must read
the tri-mode thernet spec-doc before setting the REG.Only the
correct configuration can make sitmulation continue.}
 
set namelist {
RegName Address default Data}
set datalist {
{Tx_Hwmark 0 0x001e 0x001e}
{Tx_Lwmark 1 0x0019 0x0019}
{pause_frame_send_en 2 0x0000 0x0000}
{pause_quanta_set 3 0x0000 0x0000}
{IFGset 4 0x001e 0x001e}
{FullDuplex 5 0x0001 0x0001}
{MaxRetry 6 0x0002 0x0002}
{MAC_tx_add_en 7 0x0000 0x0000}
{MAC_tx_add_prom_data 8 0x0000 0x0000}
{MAC_tx_add_prom_add 9 0x0000 0x0000}
{MAC_tx_add_prom_wr 10 0x0000 0x0000}
{tx_pause_en 11 0x0000 0x0000}
{xoff_cpu 12 0x0000 0x0000}
{xon_cpu 13 0x0000 0x0000}
{MAC_rx_add_chk_en 14 0x0000 0x0000}
{MAC_rx_add_prom_data 15 0x0000 0x0000}
{MAC_rx_add_prom_add 16 0x0000 0x0000}
{MAC_rx_add_prom_wr 17 0x0000 0x0000}
{broadcast_filter_en 18 0x0000 0x0000}
{broadcast_bucket_depth 19 0x0000 0x0000}
{broadcast_bucket_interval 20 0x0000 0x0000}
{RX_APPEND_CRC 21 0x0000 0x0000}
{Rx_Hwmark 22 0x001a 0x001a}
{Rx_Lwmark 23 0x0010 0x0010}
{CRC_chk_en 24 0x0000 0x0000}
{RX_IFG_SET 25 0x001e 0x001e}
{RX_MAX_LENGTH 26 0x2710 0x2710}
{RX_MIN_LENGTH 27 0x0040 0x0040}
{CPU_rd_addr 28 0x0000 0x0000}
{CPU_rd_apply 29 0x0000 0x0000}
{Line_loop_en 32 0x0000 0x0000}
{Speed 33 0x0004 0x0004}
}
cd ../data
 
if {[catch {open CPU.vec r} fileid]} {
set RegVector {}
} else {
set RegVector {}
gets $fileid line
while {[eof $fileid]==0} {
scan $line "%02x%02x%04x" counter addr NewValue
set y [search_add $addr]
if {$y!=-1} {
set x [lindex $datalist $y]
set x [lreplace $x 3 3 [format "0x%04x" $NewValue]]
set datalist [lreplace $datalist $y $y $x]
lappend RegVector "$y $NewValue"
}
gets $fileid line
}
close $fileid
}
 
toplevel .p
wm title .p "Setting Reg Data"
focus .p
frame .p.f1
frame .p.f2
pack .p.f1 .p.f2 -side top
frame .p.f1.f1
frame .p.f1.f2
frame .p.f1.f3
frame .p.f1.f4
frame .p.f1.f5
pack .p.f1.f1 .p.f1.f2 .p.f1.f3 .p.f1.f4 .p.f1.f5 -side left
 
label .p.f1.f1.l100 -text [lindex $namelist 0] -fg blue
label .p.f1.f2.l100 -text [lindex $namelist 1] -fg blue -width 10
label .p.f1.f3.l100 -text [lindex $namelist 2] -fg blue -width 5
label .p.f1.f4.l100 -text [lindex $namelist 3] -fg blue -width 10
 
pack .p.f1.f1.l100 .p.f1.f2.l100 .p.f1.f3.l100 .p.f1.f4.l100
for {set i 0} {$i < [llength $datalist]} {incr i} {
label .p.f1.f1.l$i -text [lindex [lindex $datalist $i] 0]
label .p.f1.f2.l$i -text [lindex [lindex $datalist $i] 1]
label .p.f1.f3.l$i -text [lindex [lindex $datalist $i] 2]
entry .p.f1.f4.en$i -width 10
.p.f1.f4.en$i insert 0 [lindex [lindex $datalist $i] 3]
if {[lindex [lindex $datalist $i] 2] !=[lindex [lindex $datalist $i] 3]} {
.p.f1.f4.en$i config -fg red
}
pack .p.f1.f1.l$i .p.f1.f2.l$i .p.f1.f3.l$i .p.f1.f4.en$i
bind .p.f1.f4.en$i <FocusOut> [list CheckModify .p.f1.f4.en$i $i ]
}
 
 
button .p.f2.b1 -text "Save" -width 10 -com {WriteVect CPU.vec}
button .p.f2.b2 -text "SaveAs" -width 10 -com {WriteVect [reg_save_as]}
button .p.f2.b3 -text "Exit" -width 10 -com {destroy .p}
button .p.f2.b4 -text "Help" -width 10 -com {print_help $help_strings}
pack .p.f2.b1 .p.f2.b2 .p.f2.b3 .p.f2.b4 -side left
bind .p.f2.b1 <ButtonPress> {focus .p}
 
 
}
 
proc CheckModify {target_en index} {
global RegVector
global datalist
set data [$target_en get]
set NewValue "$index $data"
 
if {[info exists RegVector]} {
set counter [llength $RegVector]
for {set c 0} {$c<$counter} {incr c} {
if {[lindex [lindex $RegVector $c] 0]== $index} {
if {[lindex [lindex $datalist $index] 2]==$data} {
$target_en config -fg black
set RegVector [lreplace $RegVector $c $c]
} else {
set RegVector [lreplace $RegVector $c $c $NewValue]
}
return
}
}
}
if {[lindex [lindex $datalist $index] 3]==$data} {
return
} else {
$target_en config -fg red
set RegVector [lappend RegVector $NewValue]
}
}
 
proc WriteVect {filename} {
global RegVector
global datalist
if {[info exists RegVector]} {
set counter [llength $RegVector]
if {[catch {open $filename w} fileid]} {
puts {failed to open vector file "$filename"}
destrop .p
} else {
for {set i 0} {$i < $counter} {incr i} {
set addr [lindex [lindex $datalist [lindex [lindex $RegVector $i] 0]] 1]
set NewValue [lindex [lindex $RegVector $i] 1]
puts $fileid [format "%02x%02x%04x" $counter $addr $NewValue]
}
close $fileid
unset RegVector
destroy .p
}
} else {
destroy .p
}
}
 
proc reg_save_as {} {
global fileselect
fileselect
tkwait window .fileSelectWindow
if {$fileselect(canceled)==1} {
return
} elseif {$fileselect(selectedfile)==""} {
warning_message "file have not been selected!"
} else {
return $fileselect(selectedfile)
}
}
 
proc search_add {addr} {
global datalist
set n 0
foreach line $datalist {
if {[lindex $line 1]==$addr} {
return $n
}
incr n
}
return -1
}
/trunk/sim/rtl_sim/ncsim_sim/script/start_verify.tcl
0,0 → 1,127
proc start_verify {batch index} {
variable compiling
variable simulate_times
variable test_case_number
variable batch_data {}
variable batchmode
variable piple
###############################################################################
set batchmode $batch
toplevel .l
focus .l
wm title .l "Simulation Log"
frame .l.f1
frame .l.f2
pack .l.f1 .l.f2 -side top
text .l.f1.t1 -width 80 -height 40 -yscrollcommand {.l.f1.scroll set}
scrollbar .l.f1.scroll -command {.l.f1.t1 yview}
button .l.f2.b1 -text "Exit" -com {destroy .l} -width 10
button .l.f2.b2 -text "Stop" -com {Stop_sim} -width 10
pack .l.f1.scroll -side right -fill y
pack .l.f1.t1
pack .l.f2.b1 .l.f2.b2 -side left
set output_win .l.f1.t1
set simulate_times 0
set test_case_number [lindex $index 0]
cd ../bin
set compiling 1
if {$batch==0} {
Run "bash sim.nc " $output_win
} elseif {[catch {open ../data/batch.dat r} fileid]} {
$output_win insert end "Failed open ../data/batch.dat file\n"
} elseif {[lindex $index 0] == "empty"} {
$output_win insert end "Not any test case was selected\n"
} else {
set i 0
gets $fileid line
while {[eof $fileid]==0} {
lappend batch_data $line
gets $fileid line
incr i
}
$output_win insert end "Verifcation Started\n"
$output_win insert end "Starting Compiling Source file and libs......\n"
Run "bash com.nc" $output_win
close $fileid
}
}
 
proc Run {command output_win} {
global piple
if [catch {open "|$command |& cat "} piple] {
$output_win insert end $piple\n
} else {
fileevent $piple readable [list Log $piple $output_win]
}
}
 
proc Log {piple output_win} {
global compiling
global batchmode
set saparator "###################################################################\n"
if {[eof $piple]} {
if {$batchmode==0} {
$output_win insert end $saparator
$output_win insert end "end of Simulation....\n"
$output_win insert end $saparator
} elseif {$compiling==1} {
$output_win insert end $saparator
$output_win insert end "end of Compiling....\n"
$output_win insert end $saparator
$output_win insert end "\n \n \n"
set compiling 0
sim_next_case
} else {
$output_win insert end $saparator
$output_win insert end "end of Testcase....\n"
$output_win insert end $saparator
$output_win insert end "\n \n \n"
sim_next_case
}
close $piple
} else {
gets $piple line
$output_win insert end $line\n
$output_win see end
}
}
proc sim_next_case {} {
global test_case_number
global simulate_times
global batch_data
global index
set saparator "###################################################################\n"
set output_win .l.f1.t1
set test_case_number [lindex $index $simulate_times]
if {$simulate_times < [llength $index]} {
set line [lindex $batch_data $test_case_number]
set source_sti [lindex $line 1]
set source_reg [lindex $line 2]
if {$simulate_times==0 ||[file exists "../log/.sim_succeed"]} {
exec cp "../data/$source_sti" "../data/config.ini"
exec cp "../data/$source_reg" "../data/CPU.vec"
$output_win insert end $saparator
$output_win insert end "starting test case :[lindex $line 0]....\n"
$output_win insert end $saparator
$output_win insert end "\n \n \n"
incr simulate_times
Run "bash sim_only.nc" $output_win
} else {
$output_win insert end "test_case :[lindex $line 0] simulation failed!!\n"
}
} else {
$output_win insert end "All test_case passed simulation Successfully!!\n"
}
}
 
proc Stop_sim {} {
global piple
catch {close $piple}
}
/trunk/sim/rtl_sim/ncsim_sim/script/filesel.tcl
0,0 → 1,325
#
# fileselect.tcl --
# simple file selector.
#
# Mario Jorge Silva msilva@cs.Berkeley.EDU
# University of California Berkeley Ph: +1(510)642-8248
# Computer Science Division, 571 Evans Hall Fax: +1(510)642-5775
# Berkeley CA 94720
#
 
# Layout:
#
# file: +----+
# ____________________ | OK |
# +----+
#
# +------------------+ Cancel
# | .. |S
# | file1 |c
# | file2 |r
# | |b
# | filen |a
# | |r
# +------------------+
# currrent-directory
#
# Copyright 1993 Regents of the University of California
# Permission to use, copy, modify, and distribute this
# software and its documentation for any purpose and without
# fee is hereby granted, provided that this copyright
# notice appears in all copies. The University of California
# makes no representations about the suitability of this
# software for any purpose. It is provided "as is" without
# express or implied warranty.
#
 
# Copyright 1996
 
# Slight modifications to and adoption to Tk4.0 were made to this
# fileselectionbox code by Lakshmi Sastry, Rutherford Appleton Laboratory,
# chilton, Didcot, OXON, OX11 0QX, UK.
 
# You can now type in a non-existing file name as well. This file name is
# returned for the application to open a new file to write to
 
# AGOCG Tcl/Tk Cookbook
# Authors
 
# Lakshmi Sastry
# Computing and Information Systems Department
# Rutherford Appleton Laboratory, Chilton, Didcot. OX11 0QX
# lakshmi.sastry@rl.ac.uk
 
# and
 
# Venkat VSS Sastry
# Department of Applied Mathematics and Operational Research
# Cranfield University, RMCS Shrivenham, Swindon, SN6 8LA
# sastry@rmcs.cran.ac.uk
 
# Permission to use, copy, modify, and distribute this
# software and its documentation for any purpose and without
# fee is hereby granted, provided that this copyright
# notice appears in all copies.
# The authors, RAL, RMCS Shrivenham, Cranfield University and AGOCG
# make no representations about the suitability of this
# software for any purpose. It is provided "as is" without
# express or implied warranty. Likewise they accept no responsibility
# whatsoever for any public domain software modules used (which are
# hereby acknowledged) in this software
 
 
# names starting with "fileselect" are reserved by this module
# no other names used.
 
# use the "option" command for further configuration
 
option add *Listbox*font \
"-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-iso8859-1" startupFile
option add *Entry*font \
"-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-iso8859-1" startupFile
option add *Label*font \
"-*-helvetica-medium-r-normal-*-12-*-*-*-p-*-iso8859-1" startupFile
 
 
# this is the default proc called when "OK" is pressed
# to indicate yours, give it as the first arg to "fileselect"
 
proc fileselect.default.cmd {f} {
global fileselect
set fileselect(selectedfile) $f
set fileselect(canceled) 0
#puts stderr "selected file $f"
}
 
 
# this is the default proc called when error is detected
# indicate your own pro as an argument to fileselect
 
proc fileselect.default.errorHandler {errorMessage} {
puts stdout "error: $errorMessage"
catch { cd ~ }
}
 
# this is the proc that creates the file selector box
 
proc fileselect {
{cmd fileselect.default.cmd}
{purpose "Open file:"}
{w .fileSelectWindow}
{errorHandler fileselect.default.errorHandler}} {
 
catch {destroy $w}
 
toplevel $w
grab $w
wm title $w "Select File"
 
 
# path independent names for the widgets
global fileselect
global selected
set fileselect(entry) $w.file.eframe.entry
set fileselect(list) $w.file.sframe.list
set fileselect(scroll) $w.file.sframe.scroll
set fileselect(ok) $w.bframe.okframe.ok
set fileselect(cancel) $w.bframe.cancel
set fileselect(dirlabel) $w.file.dirlabel
 
# widgets
frame $w.file -bd 10
frame $w.bframe -bd 10
pack append $w \
$w.file {left filly} \
$w.bframe {left expand frame n}
 
frame $w.file.eframe
frame $w.file.sframe
label $w.file.dirlabel -anchor e -width 24 -text [pwd]
 
pack append $w.file \
$w.file.eframe {top frame w} \
$w.file.sframe {top fillx} \
$w.file.dirlabel {top frame w}
 
 
label $w.file.eframe.label -anchor w -width 24 -text $purpose
entry $w.file.eframe.entry -relief sunken
 
pack append $w.file.eframe \
$w.file.eframe.label {top expand frame w} \
$w.file.eframe.entry {top fillx frame w}
 
 
scrollbar $w.file.sframe.yscroll -relief sunken \
-command "$w.file.sframe.list yview"
listbox $w.file.sframe.list -relief sunken -selectmode single \
-yscroll "$w.file.sframe.yscroll set"
#$fileselect(list) configure -selectmode single
pack append $w.file.sframe \
$w.file.sframe.yscroll {right filly} \
$w.file.sframe.list {left expand fill}
 
# buttons
frame $w.bframe.okframe -borderwidth 2 -relief sunken
button $w.bframe.okframe.ok -text OK -relief raised -padx 10 \
-command "fileselect.ok.cmd $w $cmd $errorHandler"
 
button $w.bframe.cancel -text cancel -relief raised -padx 10 \
-command "fileselect.cancel.cmd $w"
pack append $w.bframe.okframe $w.bframe.okframe.ok {padx 10 pady 10}
 
pack append $w.bframe $w.bframe.okframe {expand padx 20 pady 20}\
$w.bframe.cancel {top}
 
# Fill the listbox with a list of the files in the directory (run
# the "/bin/ls" command to get that information).
# to not display the "." files, remove the -a option and fileselect
# will still work
$fileselect(list) insert end ".."
foreach i [exec ls -a [pwd]] {
if {[string compare $i "."] != 0 && \
[string compare $i ".."] != 0 } {
$fileselect(list) insert end $i
}
}
 
# Set up bindings for the browser.
bind $fileselect(entry) <Return> {eval $fileselect(ok) invoke}
bind $fileselect(entry) <Control-c> {eval $fileselect(cancel) invoke}
 
bind $fileselect(list) <Button-1> {
# puts stderr "button 1 release"
set x [$fileselect(list) curselection]
$fileselect(entry) delete 0 end
$fileselect(entry) insert 0 [%W get [%W nearest %y]]
}
 
bind $fileselect(list) <Key> {
set x [$fileselect(list) curselection]
$fileselect(entry) delete 0 end
$fileselect(entry) insert 0 [%W get [%W nearest %y]]
}
 
bind $fileselect(list) <Double-ButtonPress-1> {
# puts stderr "double button 1"
set x [$fileselect(list) curselection]
$fileselect(entry) delete 0 end
$fileselect(entry) insert 0 [%W get [%W nearest %y]]
$fileselect(ok) invoke
}
 
bind $fileselect(list) <Return> {
set x [$fileselect(list) curselection]
$fileselect(entry) delete 0 end
$fileselect(entry) insert 0 [%W get [%W nearest %y]]
$fileselect(ok) invoke
}
 
# set kbd focus to entry widget
 
focus $fileselect(entry)
 
}
 
 
# auxiliary button procedures
 
proc fileselect.cancel.cmd {w} {
# puts stderr "Cancel"
global fileselect
set fileselect(canceled) 1
destroy $w
}
 
proc fileselect.ok.cmd {w cmd errorHandler} {
global fileselect
global selected
set selected [$fileselect(entry) get]
# some nasty file names may cause "file isdirectory" to return an error
set sts [catch {
file isdirectory $selected
} errorMessage ]
 
if { $sts != 0 } then {
$errorHandler $errorMessage
destroy $w
return
 
}
 
# clean the text entry and prepare the list
$fileselect(entry) delete 0 end
$fileselect(list) delete 0 end
$fileselect(list) insert end ".."
 
# perform globbing on the selection.
# If globing returns an error (no match) check if a non-null name is
# entered. If name string is non-empty return it as a new file name
# else give an error message.
# If resulting list length > 1, put the list on the file listbox and return
# If globing expands to a list of filenames in multiple directories,
# the indicated regexp is invalid and the error handler is called instead.
set globlist 0
 
set sts [catch {
set globlist [glob [list $selected]]
} errorMessage ]
 
if { $sts != 0 } then {
if { [llength $globlist] == 1 } {
destroy $w
$cmd $selected
return
} else {
 
$errorHandler $errorMessage
destroy $w
return
 
}
 
}
 
if {[llength $globlist] > 1} {
if {[regexp "/" $globlist] != 0} {
$errorHandler [list "Invalid regular expression, " $selected, "."]
destroy $w
return
}
foreach i $globlist {
if {[string compare $i "."] != 0 && \
[string compare $i ".."] != 0} {
$fileselect(list) insert end $i
}
}
return
}
 
# selection may be a directory. Expand it.
 
if {[file isdirectory $selected] != 0} {
cd $selected
set dir [pwd]
$fileselect(dirlabel) configure -text $dir
 
foreach i [exec ls -a $dir] {
if {[string compare $i "."] != 0 && \
[string compare $i ".."] != 0} {
$fileselect(list) insert end $i
}
}
return
}
 
destroy $w
$cmd $selected
}
 
/trunk/sim/rtl_sim/ncsim_sim/script/run.tcl
0,0 → 1,26
source user_lib.tcl
source set_stimulus.tcl
source set_reg_data.tcl
source start_verify.tcl
source batch_mode.tcl
source filesel.tcl
 
 
wm title . "main"
frame .frame
button .frame.b1 -width 20 -text "set_stimulus"
button .frame.b2 -width 20 -text "set_cpu_data"
button .frame.b3 -width 20 -text "start_verify"
button .frame.b4 -width 20 -text "batch_mode"
button .frame.b40 -width 20 -text "exit"
 
bind .frame.b1 <Button-1> {set_stimulus}
bind .frame.b2 <Button-1> {set_reg_data}
bind .frame.b3 <Button-1> {start_verify 0 empty}
bind .frame.b4 <Button-1> {batch_mode}
bind .frame.b40 <Button-1> {exit}
 
 
pack .frame .frame.b1 .frame.b2 .frame.b3 .frame.b4 .frame.b40
 
/trunk/sim/rtl_sim/ncsim_sim/script/user_lib.tcl
0,0 → 1,17
proc print_help {help_string} {
toplevel .help
frame .help.1
message .help.1.1 -text $help_string -width 10c
frame .help.2
button .help.2.1 -text "exit" -com {destroy .help} -width 10
pack .help.1 .help.2 .help.1.1 .help.2.1
}
 
proc warning_message {warning_string} {
toplevel .warning
frame .warning.1
message .warning.1.1 -text $warning_string -width 10c
frame .warning.2
button .warning.2.1 -text "exit" -com {destroy .warning} -width 10
pack .warning.1 .warning.2 .warning.1.1 .warning.2.1
}
/trunk/sim/rtl_sim/ncsim_sim/script/batch_mode.tcl
0,0 → 1,148
proc batch_mode {} {
variable i
variable index empty
variable batch_data
set namelist \
{- Description Stimulus RegVector}
###############################################################################
toplevel .b
wm title .b "Setting Reg Data"
focus .b
frame .b.f100
 
set lth1 20
set lth2 15
set lth3 15
cd ../data
if {[catch {open batch.dat r} fileid]} {
break
} else {
set batch_data {}
gets $fileid line
while {[eof $fileid]==0} {
lappend batch_data $line
if {[string length [lindex $line 0]] > $lth1 } {
set lth1 [string length [lindex $line 0]]
}
if {[string length [lindex $line 1]] > $lth2 } {
set lth2 [string length [lindex $line 1]]
}
if {[string length [lindex $line 2]] > $lth3 } {
set lth3 [string length [lindex $line 2]]
}
gets $fileid line
}
close $fileid
}
label .b.f100.l1 -text [lindex $namelist 0] -fg blue -width 5
label .b.f100.l2 -text [lindex $namelist 1] -fg blue -width [expr $lth1 +5]
label .b.f100.l3 -text [lindex $namelist 2] -fg blue -width [expr $lth2 +5]
label .b.f100.l4 -text [lindex $namelist 3] -fg blue -width [expr $lth3 +5]
pack .b.f100
pack .b.f100.l1 .b.f100.l2 .b.f100.l3 .b.f100.l4 -side left
set i 0
foreach line $batch_data {
frame .b.f$i
set tmp [expr $i+1]
checkbutton .b.f$i.c -variable check$i -text $tmp -width 5
label .b.f$i.l1 -text [lindex $line 0] -width $lth1
button .b.f$i.b1 -text "Change" -width 5 -com [list ChangeDescript .b.f$i.l1 $i 0]
label .b.f$i.l2 -text [lindex $line 1] -width $lth2
button .b.f$i.b2 -text "Change" -width 5 -com [list ChangeLabel .b.f$i.l2 $i 1]
label .b.f$i.l3 -text [lindex $line 2] -width $lth3
button .b.f$i.b3 -text "Change" -width 5 -com [list ChangeLabel .b.f$i.l3 $i 2]
pack .b.f$i
pack .b.f$i.c .b.f$i.l1 .b.f$i.b1 .b.f$i.l2 .b.f$i.b2 .b.f$i.l3 .b.f$i.b3 -side left
incr i
}
 
 
frame .b.f102
button .b.f102.b1 -text "Start Verify" -width 10
button .b.f102.b2 -text "Save" -width 10 -com {save_batch_data}
button .b.f102.b3 -text "Exit" -width 10 -com {destroy .b}
pack .b.f102
pack .b.f102.b1 .b.f102.b2 .b.f102.b3 -side left
bind .b.f102.b1 <ButtonPress> {create_index $i}
bind .b.f102.b1 <ButtonRelease> {start_verify 1 $index}
}
 
proc create_index {i} {
global index
set index empty
set sim_times 0
save_batch_data
for {set c 0} {$c < $i} {incr c} {
upvar 1 check$c tmp
if {$tmp==1 && $sim_times==0} {
set index $c
incr sim_times
} elseif {$tmp==1} {
lappend index $c
incr sim_times
}
}
}
 
proc ChangeLabel {target_label y x} {
global batch_data
global fileselect
fileselect
tkwait window .fileSelectWindow
if {$fileselect(canceled)==1} {
return
} elseif {$fileselect(selectedfile)==""} {
warning_message "file have not been selected!"
} else {
$target_label config -text $fileselect(selectedfile)
set line [lindex $batch_data $y]
set line [lreplace $line $x $x $fileselect(selectedfile)]
set batch_data [lreplace $batch_data $y $y $line]
}
}
 
proc save_batch_data {} {
global batch_data
if {[catch {open batch.dat w} fileid]} {
break
} else {
foreach line $batch_data {
puts $fileid $line
}
close $fileid
}
}
 
proc ChangeDescript {target_label y x} {
global batch_data
variable value
variable target
variable newy
variable newx
toplevel .tmp
focus .tmp
set target $target_label
set newy $y
set newx $x
entry .tmp.en -width 20 -textvariable value
button .tmp.b -width 5 -text "Apply" -com {destroy .tmp}
button .tmp.b1 -width 5 -text "quit"
bind .tmp.b <ButtonPress> {ChangeDescriptApply $target $newy $newx $value}
 
pack .tmp.en .tmp.b
}
 
proc ChangeDescriptApply {target_label y x value} {
global batch_data
if {$value==""} {
warning_message "Description can not be empty"
} else {
$target_label config -text $value
set line [lindex $batch_data $y]
set line [lreplace $line 0 0 $value]
set batch_data [lreplace $batch_data $y $y $line]
}
}
/trunk/sim/rtl_sim/ncsim_sim/script/run_proc.tcl
0,0 → 1,27
proc run_proc {} {
source user_lib.tcl
source set_stimulus.tcl
source set_reg_data.tcl
source start_verify.tcl
source batch_mode.tcl
source filesel.tcl
 
toplevel .frame
focus .frame
wm title .frame "main"
button .frame.b1 -width 20 -text "set_stimulus"
button .frame.b2 -width 20 -text "set_cpu_data"
button .frame.b3 -width 20 -text "start_verify"
button .frame.b4 -width 20 -text "batch_mode"
button .frame.b40 -width 20 -text "exit" -com {cd ../../../../ ;destroy .frame}
 
bind .frame.b1 <Button-1> {set_stimulus}
bind .frame.b2 <Button-1> {set_reg_data}
bind .frame.b3 <Button-1> {start_verify 0 empty}
bind .frame.b4 <Button-1> {batch_mode}
 
 
 
pack .frame.b1 .frame.b2 .frame.b3 .frame.b4 .frame.b40
 
}

powered by: WebSVN 2.1.0

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