http://insertyou.iteye.com/blog/1108146
#************************************************
# Construct MAC address
#
# @PARAMS
# rawMac --- raw MAC address, integer
#
# @RETURN
# the MAC address string
#************************************************
proc constructMac {rawMac} {
set mac "00:00:00:00"
set j [expr "($rawMac >> 8) & 0xFF"]
set k [format "%x" $j]
set mac "$mac:$k"
set j [expr "$rawMac & 0xFF"]
set k [format "%x" $j]
set mac "$mac:$k"
puts "rawMac = $rawMac, mac = $mac"
return $mac
}
% set m1 0xaaaabbcc
0xaaaabbcc
% constructMac m1
syntax error in expression "(m1 >> 8) & 0xFF"
% constructMac $m1
rawMac = 0xaaaabbcc, mac = 00:00:00:00:bb:cc
00:00:00:00:bb:cc
% constructMac $m1
rawMac = 0xaaaabbcc, mac = 00:00:00:00:bb:cc
00:00:00:00:bb:cc