This file is indexed.

/usr/lib/x86_64-linux-gnu/irsim/tcl/vcd.tcl is in irsim 9.7.93-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
#---------------------------------------------------------
# vcd.tcl
#---------------------------------------------------------
# Support for reading "VCD" format dumpfiles in IRSIM.
# Adds command "readvcd <dumpfile>", which reads in
# the file and displays the traces in the analyzer.
#---------------------------------------------------------

proc readvcd {dumpfile} {
   set prefix ""
   if { [catch {open $dumpfile r} df] } {
      puts stderr "Could not open VCD dumpfile $dumpfile\n"
      return
   }
   while {[gets $df line] >= 0} {
      if {[regexp {^\$([^ ]+)} $line lmatch dumpvar]} {
         switch $dumpvar {
	    date {
	       gets $df line
	       puts stdout $line
	    }
	    version {
	       gets $df line
	       puts stdout $line
	    }
	    timescale {
	       gets $df line
	       regexp {([0-9]+)[ \t]*([^ ]+)} $line lmatch scale metric
	       switch $metric {
	          fs {set scale [expr 0.001 * $scale]}
	          ns {set scale [expr 1000 * $scale]}
	       }
	    }
	    var {
	       regexp {^\$var[ \t]+[^ ]+[ \t]+([0-9]+)[ \t]+([^ ]+)[ \t]+([^ ]+)} \
			$line lmatch bitlen repchar signame
	       if {$bitlen == 1} {
		  addnode ${prefix}${signame}
	       } else {
	          for {set i 0} {$i < $bitlen} {incr i} {
	             addnode ${prefix}${signame}\[$i\]
		  }
		  incr bitlen -1
		  vector ${prefix}${signame} ${prefix}${signame}\[0:${bitlen}\]
	       }
	       set nodenames($repchar) ${prefix}${signame}
	       ana ${prefix}${signame}
	    }
	    scope {
	       regexp {^\$scope[ \t]+([^ ]+)[ \t]+([^ ]+)} \
			$line lmatch scopetype instname
	       set prefix "${prefix}${instname}/"
	    }
	    upscope {
	       set prefix ""
	    }
         }
      } else {
	 # Known patterns are: 0, 1, x (bit set), b (vector set), # (schedule)
	 set curtime 0
	 while {[gets $df line] >= 0} {
	    set cmd [string index $line 0]
	    switch $cmd {
	       b {
	         regexp {^b([0-9]+)[ \t]+([^ ]+)} $line lmatch bval sname
		 setvector $nodenames($sname) %b${bval}
	       }
	       # {
		 set tval [string range $line 1 end]
		 set tval [expr $tval * $scale]
		 set nexttime $tval
		 set tval [expr $tval - $curtime]
		 if {$tval > 0} s $tval
		 set curtime $nexttime
	       }
	       0 {
		 set sname [string range $line 1 end]
		 l $nodenames($sname)
	       }
	       1 {
		 set sname [string range $line 1 end]
		 h $nodenames($sname)
	       }
	       x {
		 set sname [string range $line 1 end]
		 u $nodenames($sname)
	       }
	    }  
	 }
      }
   }

   close $df
}

#---------------------------------------------------------
# For backward compatibility.  Procedure was originally named "readcver",
# but the format is VCD.
#---------------------------------------------------------

proc readcver {dumpfile} {
   readvcd $dumpfile
}