verilog - Viewing enum names in vcs ucli -


i working in vcs ucli (ie, command line interface) , having trouble getting vcs display various state variables, of typedef'd enum type, value name rather number. example, have systemverilog this:

typedef enum logic [1:0] {a, b, c} state_t;  state_t s; ... 

now in ucli, want see value of s (say in state a) type like:

ucli% s 0 ucli% s -radix symbolic 0 ucli% show s -value s 0 ucli% show s -value -radix symbolic s 0 ucli% show s -value -type s 0 { enum state_t { {a 0} {b 1} {c 2} } } 

(or that). have read ucli user guide, , seems symbolic radix, 1 know of might possibly close, uses raw value enum, not enum name. have tried calling .name() method variable s using call command in ucli (ucli% call {$display("%s", s.name())}), doesnt seem supported. know vcs has capacity print enum name, can in dve, having trouble coming ways show me in ucli.

does know how ucli print enum name instead of number when queried? enum-type radix somehow (user-defined in dve?), use systemverilog system call name, that?

(note, understand use dve, trying use ucli interface potential users, educational purposes , want mask alot of ucli interface (and vcs interface in general) not overwhelm students , variables easily; im turning vcs ucli simple processor simulator)

++++++++++++ update ++++++++++++

i came hacky solution better approach. wrote own wrapper show (called eshow) whish ill replace -value enum name if -radix enum set:

# # extension of show include "-radix enum" #  # borrowed http://wiki.tcl.tk/17342 # credit richard suchenwirth (12-8-2006) proc getopt {_argv name {_var ""} {default ""}} {     upvar 1 $_argv argv $_var var     set pos [lsearch -regexp $argv ^$name]     if {$pos>=0} {         set $pos         if {$_var ne ""} {             set var [lindex $argv [incr to]]         }         set argv [lreplace $argv $pos $to]         return 1     } else {         if {[llength [info level 0]] == 5} {set var $default}         return 0     } }  proc eshow {args} {     set argv $args      # if radix not specified or value not specified, dont bother doing regular show     if { 0 == [getopt argv -radix radix] } {         return [eval show $args]     }     if { 0 == [getopt argv -value] } {         return [eval show $args]     }      # if radix isnt enum, pass off regular show     if { 0 == [string equal -nocase $radix "enum"] } {         return [eval show $args]     }      # signal, value , type     set var [lindex [eval show $argv] 0]     set val [lindex [show $var -value] 1]     set typ [lindex [show $var -type] 1]      # if type isnt enum, error     if { 0 == [string equal -nocase [lindex $typ 0] "enum"] } {         return "the type of variable $var not enumerated type"     }      # process enumerations     set enuml [lindex $typ 2]      # find value name     foreach v $enuml {         if { $val == [lindex $v 1] } {             set enumname [lindex $v 0]             break         }     }      # if not found....     if { 0 == [info exists enumname] } {         return "the variabel $var has value not map"     }      # rid of radix args     getopt args -radix trashcan      # replace values name     set retval [eval show $args]     set retshow $retval      foreach v [lsearch -all $retval $val] {         set retshow [lreplace $retshow $v $v $enumname]     }      return $retshow } 

thus, if type other non-radix enum eshow commands, pass show, otherwise, replace values thier names , return same thing show replacement. said, want better solution, in case wants use function, here is.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -