Skip to content
  • Peter Maydell's avatar
    7e6c28be
    scripts/decodetree: Implement named field support · 7e6c28be
    Peter Maydell authored
    
    
    Implement support for named fields, i.e.  where one field is defined
    in terms of another, rather than directly in terms of bits extracted
    from the instruction.
    
    The new method referenced_fields() on all the Field classes returns a
    list of fields that this field references.  This just passes through,
    except for the new NamedField class.
    
    We can then use referenced_fields() to:
     * construct a list of 'dangling references' for a format or
       pattern, which is the fields that the format/pattern uses but
       doesn't define itself
     * do a topological sort, so that we output "field = value"
       assignments in an order that means that we assign a field before
       we reference it in a subsequent assignment
     * check when we output the code for a pattern whether we need to
       fill in the format fields before or after the pattern fields, and
       do other error checking
    
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
    Message-Id: <20230523120447.728365-6-peter.maydell@linaro.org>
    7e6c28be
    scripts/decodetree: Implement named field support
    Peter Maydell authored
    
    
    Implement support for named fields, i.e.  where one field is defined
    in terms of another, rather than directly in terms of bits extracted
    from the instruction.
    
    The new method referenced_fields() on all the Field classes returns a
    list of fields that this field references.  This just passes through,
    except for the new NamedField class.
    
    We can then use referenced_fields() to:
     * construct a list of 'dangling references' for a format or
       pattern, which is the fields that the format/pattern uses but
       doesn't define itself
     * do a topological sort, so that we output "field = value"
       assignments in an order that means that we assign a field before
       we reference it in a subsequent assignment
     * check when we output the code for a pattern whether we need to
       fill in the format fields before or after the pattern fields, and
       do other error checking
    
    Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
    Reviewed-by: default avatarRichard Henderson <richard.henderson@linaro.org>
    Message-Id: <20230523120447.728365-6-peter.maydell@linaro.org>
Loading