aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-03-29 20:40:49 -0700
committerJason Ekstrand <[email protected]>2017-04-07 22:34:04 -0700
commitf97e251ab200802feb0784c795fa06153ae6861e (patch)
tree8660e12160f7674e94a4188e6fd4056babde0dca
parent430e6978680fc35f37cef1bfc1876ed7b9a986f8 (diff)
intel/genxml/bits: Emit per-field _start helpers
Reviewed-by: Topi Pohjolainen <[email protected]>
-rw-r--r--src/intel/genxml/gen_bits_header.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/intel/genxml/gen_bits_header.py b/src/intel/genxml/gen_bits_header.py
index cfe2a8976bb..fc31baa1b88 100644
--- a/src/intel/genxml/gen_bits_header.py
+++ b/src/intel/genxml/gen_bits_header.py
@@ -113,6 +113,8 @@ extern "C" {
${emit_per_gen_prop_func(field, 'bits')}
+${emit_per_gen_prop_func(field, 'start')}
+
% endfor
% endfor
@@ -205,11 +207,13 @@ class Field(object):
self.name = name
self.token_name = safe_name('_'.join([container.name, self.name]))
self.bits_by_gen = {}
+ self.start_by_gen = {}
def add_gen(self, gen, xml_attrs):
assert isinstance(gen, Gen)
start = int(xml_attrs['start'])
end = int(xml_attrs['end'])
+ self.start_by_gen[gen] = start
self.bits_by_gen[gen] = 1 + end - start
def has_prop(self, prop):
@@ -218,6 +222,8 @@ class Field(object):
def iter_prop(self, prop):
if prop == 'bits':
return self.bits_by_gen.iteritems()
+ elif prop == 'start':
+ return self.start_by_gen.iteritems()
else:
raise ValueError('Invalid property: "{0}"'.format(prop))
@@ -227,6 +233,8 @@ class Field(object):
if prop == 'bits':
return self.bits_by_gen.get(gen, 0)
+ elif prop == 'start':
+ return self.start_by_gen.get(gen, 0)
else:
raise ValueError('Invalid property: "{0}"'.format(prop))