Ruby: Add field to slicc machine for generic type

This allows you to have (i.e.) an L2 cache that is not named "L2Cache"
but is still a GenericMachineType_L2Cache. This is particularly
helpful if the protocol has multiple L2 controllers.
This commit is contained in:
Joel Hestness 2013-04-09 16:25:29 -05:00
parent b936619ab4
commit e98c3c227d

View file

@ -540,9 +540,11 @@ ConvertMachToGenericMach(MachineType machType)
{
''')
for enum in self.enums.itervalues():
genericType = self.enums[enum.ident].get('genericType',
enum.ident)
code('''
if (machType == MachineType_${{enum.ident}})
return GenericMachineType_${{enum.ident}};
return GenericMachineType_${{genericType}};
''')
code('''
panic("cannot convert to a GenericMachineType");