From 0bb7c6458d84dbe88d3002721347471bb61c1373 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 15 Oct 2009 16:05:27 -0700 Subject: Kill EnumEntry and force ordering upon the emitted enum values. --- r300reg.xml | 136 +++++++++++++++++++++++++++++------------------------------ radeonreg.py | 86 ++++++++++++++----------------------- 2 files changed, 100 insertions(+), 122 deletions(-) diff --git a/r300reg.xml b/r300reg.xml index 13d2da4..f00d2d1 100644 --- a/r300reg.xml +++ b/r300reg.xml @@ -675,42 +675,42 @@ xsi:schemaLocation="rules-ng.xsd"> - - C - 1st texture component - + C + + The value 0.0 + 2nd texture component - + C + + The value 1.0 + 3rd texture component - + C 4th texture component + + C + K - - The value 0.0 - K - - The value 1.0 - @@ -1545,16 +1545,10 @@ xsi:schemaLocation="rules-ng.xsd"> - - 255.0) 0 1 0. - 1.0 1 0 -2^(n-1) - (2^(n-1) - 1) (i.e. 8-bit -> -128. - - 127.0) 1 1 -1. - 1.0 where n is the number of bits in the associated fixed point value For signed, normalize conversion, since the @@ -1562,6 +1556,12 @@ xsi:schemaLocation="rules-ng.xsd"> are 3 different methods supported by R300. See the VAP_PSC_SGN_NORM_CNTL description for details. + + 127.0) 1 1 -1. + + + 255.0) 0 1 0. + @@ -5068,6 +5068,12 @@ xsi:schemaLocation="rules-ng.xsd"> OP_MIN: Result = min(A,B) + + Result = 2^^A + + + Result = log2(A) + OP_MAX: Result = max(A,B) @@ -5084,15 +5090,9 @@ xsi:schemaLocation="rules-ng.xsd"> OP_EX - - Result = 2^^A - OP_LN - - Result = log2(A) - OP_RCP: Result = 1/A @@ -5197,22 +5197,22 @@ xsi:schemaLocation="rules-ng.xsd"> OP_DP - - Result = A.r*B.r + A.g*B.g + A.b*B.b - OP_DP - - Result = A.r*B.r + A.g*B.g + A.b*B.b + - A.a*B.a - OP_D2A: Result = A.r*B.r + A.g*B.g + C.b + + Result = A.r*B.r + A.g*B.g + A.b*B.b + OP_MIN: Result = min(A,B) + + Result = A.r*B.r + A.g*B.g + A.b*B.b + + A.a*B.a + OP_MAX: Result = max(A,B) @@ -5415,12 +5415,12 @@ xsi:schemaLocation="rules-ng.xsd"> W - - 24-bit fixed point - W24_FP - 24-bit floating point + + 24-bit fixed point + Format for W @@ -7435,20 +7435,20 @@ xsi:schemaLocation="rules-ng.xsd"> Maps physical pipe 3 to logical pipe ID (def 3). - - P3, B + + disabled - - P2, B + + P0. -- 1: enabled, P1, B - - P0. -- 1: enabled, + + P2, B - - disabled + + P3, B 4b mask, indicates which physical pipes are enabled (def @@ -7458,14 +7458,8 @@ xsi:schemaLocation="rules-ng.xsd"> 2b, indicates, by the fuses, the max number of allowed pipes. 0 = 1 pipe ... 3 = 4 pipes -- Read Only - - P3, B - - - P2, B - - - P1, B + + good -- Read Only P0 -- @@ -7473,8 +7467,14 @@ xsi:schemaLocation="rules-ng.xsd"> bad, - - good -- Read Only + + P1, B + + + P2, B + + + P3, B 4b, indicates, by the fuses, the bad pipes: B3=P3, @@ -8598,6 +8598,12 @@ xsi:schemaLocation="rules-ng.xsd"> OP_MIN: Result = min(A,B) + + Result = 2^^A + + + Result = log2(A) + OP_MAX: Result = max(A,B) @@ -8614,15 +8620,9 @@ xsi:schemaLocation="rules-ng.xsd"> OP_EX - - Result = 2^^A - OP_LN - - Result = log2(A) - OP_RCP: Result = 1/A @@ -8806,22 +8806,22 @@ xsi:schemaLocation="rules-ng.xsd"> OP_DP - - Result = A.r*B.r + A.g*B.g + A.b*B.b - OP_DP - - Result = A.r*B.r + A.g*B.g + A.b*B.b + - A.a*B.a - OP_D2A: Result = A.r*B.r + A.g*B.g + C.b + + Result = A.r*B.r + A.g*B.g + A.b*B.b + OP_MIN: Result = min(A,B) + + Result = A.r*B.r + A.g*B.g + A.b*B.b + + A.a*B.a + OP_MAX: Result = max(A,B) @@ -9899,9 +9899,6 @@ xsi:schemaLocation="rules-ng.xsd"> W - - 24-bit fixed point - W24_FP - 24-bit floating point. The floating point values are a special format that preserve sorting order @@ -9909,6 +9906,9 @@ xsi:schemaLocation="rules-ng.xsd"> precision in W without additional logic in other blocks. + + 24-bit fixed point + Format for W diff --git a/radeonreg.py b/radeonreg.py index 36fefd4..00bff30 100755 --- a/radeonreg.py +++ b/radeonreg.py @@ -59,42 +59,14 @@ class RadeonField(object): def __ne__(self, other): return not self == other -class EnumEntry(object): - - def __init__(self, val, name, desc): - self.val = val - self.name = name - self.desc = desc - - def __eq__(self, other): - if (not isinstance(other, EnumEntry)): return False - - if self.val == other.val and \ - self.name == other.name and \ - self.desc == other.desc: return True - return False - - def __ne__(self, other): - return not self == other - class RadeonEnum(object): def __init__(self): - self.entries = [] + self.entries = set() self.refs = 0 - - def add(self, val, name, desc): - self.entries.append(EnumEntry(val, name, desc)) def __eq__(self, other): - if (not isinstance(other, RadeonEnum)): return False - - if len(self.entries) != len(other.entries): return False - - for i in xrange(len(self.entries)): - if self.entries[i] != other.entries[i]: return False - - return True + return self.entries == other.entries def __ne__(self, other): return not self == other @@ -131,10 +103,12 @@ def ExtractEnum(s): desc = StripSpaces(entry[2].replace('\n', ' ')) if reserved_regex.search(desc): continue name = StripUnders(enum_ename.match(desc.replace(' ', '_')).group(1).upper()) - enum.add(val, name, desc) + enum.entries.add((val, name, desc)) - if len(enum.entries) == 0: enum = None - return [d, enum] + if not enum.entries: + enum = None + + return (d, enum) subs = [re.compile('^.+ 2008 Advanced Micro Devices, Inc.$'), re.compile('^Proprietary *[0-9]*$'), @@ -207,7 +181,8 @@ def FormatPDFDump(pdf): e = ExtractEnum(fdesc) cfield.desc = e[0] - if e[1] != None: cfield.enum = AddEnum(e[1]) + if e[1]: + cfield.enum = AddEnum(e[1]) if len(creg.fields) > 0: if creg.fields[0].low == 0 and creg.fields[0].high == 31: @@ -234,6 +209,27 @@ def CompareRegs(regs1, regs2): return [regs_both, regs_a, regs_b] +def CreateEnumChildren(root, enum): + for (value, name, description) in sorted(enum.entries): + if not name: + continue + value_tag = ElementTree.SubElement(root, "value") + value_tag.attrib["name"] = name + value_tag.attrib["value"] = str(value) + ElementTree.SubElement(value_tag, "doc").text = description + +def CreateEnumElement(root, enum, index): + if not enum.entries: + return + + enum_tag = ElementTree.Element("enum") + enum_tag.attrib["name"] = "ENUM%d" % index + + CreateEnumChildren(enum_tag, enum) + + if enum_tag: + root.append(enum_tag) + def CreateXML(handle, regs, variants): comment = ElementTree.Comment( """ @@ -256,18 +252,7 @@ before attempting to read it. for i, enum in enumerate(enums): if enum.refs > 1: - enum_tag = ElementTree.Element("enum") - enum_tag.attrib["name"] = "ENUM%d" % i - for entry in enum.entries: - if not entry.name: - continue - value = ElementTree.SubElement(enum_tag, "value") - value.attrib["name"] = entry.name - value.attrib["value"] = str(entry.val) - doc = ElementTree.SubElement(value, "doc") - doc.text = entry.desc - if enum_tag: - database.append(enum_tag) + CreateEnumElement(database, enum, i) for (group, name, prepend) in regs: group_tag = ElementTree.SubElement(database, "group", name=name) @@ -296,14 +281,7 @@ before attempting to read it. ElementTree.SubElement(reg32, "doc").text = field.desc if field.enum: if enums[field.enum].refs == 1: - for entry in enums[field.enum].entries: - if not entry.name: - continue - value = ElementTree.SubElement(bitfield, "value") - value.attrib["name"] = entry.name - value.attrib["value"] = str(entry.val) - doc = ElementTree.SubElement(value, "doc") - doc.text = entry.desc + CreateEnumChildren(bitfield, enums[field.enum]) else: use_enum = ElementTree.SubElement(bitfield, "use-enum") use_enum.attrib["ref"] = "ENUM%d" % field.enum -- cgit v1.2.3