本文整理汇总了Python中Tinker类的典型用法代码示例。如果您正苦于以下问题:Python Tinker类的具体用法?Python Tinker怎么用?Python Tinker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Tinker类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_grouping
def parse_grouping(cls, e):
ids = parse_list(e, "grouping")
for i in ids:
if(not Tinker.is_id(i)):
Tinker.value_error_xml("grouping", i, "Alphabetic Characters",
ET.tostring(e))
return ids
示例2: parse_macros
def parse_macros(e):
macros = parse_list(e, "macros")
for m in macros:
if(not Tinker.is_valid_verilog_name(m)):
Tinker.value_error_xml("macros", m, "Valid Verilog Names",
ET.tostring(e))
return macros
示例3: __generate_macro_file
def __generate_macro_file(self, p):
Tinker.check_path(p)
ms = self.__d.get_macros(self.__t.get_version(), False)
mfp = open(p + "/tinker.vh", "w")
for m in ms:
mfp.write("define `%s + \n" % m)
mfp.close()
示例4: parse_oct_pins
def parse_oct_pins(cls, e):
pins = parse_list(e, "oct_pins")
for p in pins:
if(not Tinker.is_valid_verilog_name(p)):
Tinker.value_error_xml("oct_pins", p, "Valid Verilog Names",
ET.tostring(e))
return pins
示例5: parse_string
def parse_string(e, k):
s = e.get(k)
if(s is None):
Tinker.key_error(k, ET.tostring(e))
elif(not Tinker.is_string(s)):
Tinker.value_error_xml(k, s, "Strings", ET.tostring(e))
return s
示例6: parse_interface_keys
def parse_interface_keys(cls, desc):
k = set(desc.keys())
err = (k - cls._C_MEMORY_KEYS)
if(err != set()):
print "In description:"
Tinker.tostr_dict(desc)
sys.exit("Error! Unknown keys: %s" % str(list(err)))
return k
示例7: parse_keys
def parse_keys(cls,desc):
k = set(desc.keys())
ifs = set(cls.parse_interfaces(desc))
err = (k - ifs - cls._C_DESCRIPTION_KEYS)
if(err != set()):
print "In description:"
Tinker.print_description(desc)
sys.exit("Error! Unknown keys: %s" % str(list(err)))
return k | ifs
示例8: check_quantity
def check_quantity(cls, d):
super(GlobalMemoryInterface,cls).check_quantity(d)
cls.check_interfaces(d)
ifs = cls.parse_interfaces(d)
q = parse_int(d, "quantity")
if(q != len(ifs)):
Tinker.value_error_map("quantity",str(q),str(ifs),
Tinker.tostr_dict(d))
示例9: write
def write(self, p):
Tinker.check_path(p)
p += "/" + "system.qsys"
Tinker.check_path(p)
r = self.getroot()
ifs = self.__d.get_pin_elements(self.__b["version"], False)
for i in ifs:
r.append(i)
super(System, self).write(p, encoding="UTF-8", xml_declaration=True)
示例10: parse_burst
def parse_burst(cls,d):
b = parse_int(d, "burst")
if(not Tinker.is_in_range(b,cls._C_INTERFACE_BURST_RANGE[0],
cls._C_INTERFACE_BURST_RANGE[1])):
Tinker.value_error_map("burst", str(b),
"range(%d, %d)"
% (cls._C_INTERFACE_BURST_RANGE[0],
cls._C_INTERFACE_BURST_RANGE[1]),
Tinker.tostr_dict(d))
return b
示例11: construct
def construct(t):
import GlobalMemoryInterface, HostInterface, KernelInterface
if(t == "GlobalMemory"):
return GlobalMemoryInterface.GlobalMemoryInterface
elif(t == "Host"):
return HostInterface.HostInterface
elif(t == "Kernel"):
return KernelInterface.KernelInterface
else:
Tinker.value_error("interfaces", str(t), str(Interface._C_INTERFACE_TYPES))
示例12: check_quantity
def check_quantity(cls,d):
q = parse_int(d, "quantity")
if(not Tinker.is_in_range(q,
cls._C_INTERFACE_QUANTITY_RANGE[0],
cls._C_INTERFACE_QUANTITY_RANGE[1])):
Tinker.value_error_map("quantity", str(q),
"range(%d, %d)"
% (cls._C_INTERFACE_QUANTITY_RANGE[0],
cls._C_INTERFACE_QUANTITY_RANGE[1]),
Tinker.tostr_dict(d))
示例13: check_width
def check_width(cls,d):
w = parse_int(d, "width")
if(not Tinker.is_in_range(w,
cls._C_INTERFACE_WIDTH_RANGE[0],
cls._C_INTERFACE_WIDTH_RANGE[1])):
Tinker.value_error_map("width", str(w),
"range(%d, %d)"
% (cls._C_INTERFACE_WIDTH_RANGE[0],
cls._C_INTERFACE_WIDTH_RANGE[1]),
Tinker.tostr_dict(d))
示例14: check_burst
def check_burst(cls, d):
burst = d.get("burst")
if(burst is None):
Tinker.key_error("burst", Tinker.tostr_dict(d))
if(not Tinker.is_pow_2(burst)):
Tinker.value_error_map("burst", str(burst),
"Integer powers of 2",
Tinker.tostr_dict(d))
if(burst not in cls._C_BURST_WIDTHS):
Tinker.value_error_map("burst", str(burst),
str(list(cls._C_BURST_WIDTHS)),
Tinker.tostr_dict(d))
示例15: parse_keys
def parse_keys(cls,desc):
k = set(desc.keys())
if("interfaces" not in desc):
ifs = set([])
else:
ifs = set(cls.parse_interfaces(desc))
err = (k - ifs - cls._C_INTERFACE_KEYS)
if(err != set()):
print "In description:"
Tinker.print_description(desc)
sys.exit("Error! Unknown keys: %s" % str(list(err)))
return k | ifs