wzab / agwb

Support for automatic address map generation and address decoding logic for Wishbone connected hierachical systems
12 stars 6 forks source link

Detection of incorrect attributes in system description. #48

Closed wzab closed 3 years ago

wzab commented 3 years ago

As @wfjm suggested, the AGWB should detect incorrect attributes. The standard solution would be to define the XML schema for the system description, describing what attributes may be used in which nodes. Unfortunately, the standard Python xml.etree.ElementTree and xml.parsers.expat modules do not support schema validation. We will need to use additionally lxml library - https://stackoverflow.com/questions/57073834/how-to-validate-the-xml-with-dtd-using-python-xml-etree-elementtree-library , https://stackoverflow.com/questions/8943407/validate-xml-document-with-expat Probably we should use additional library https://lxml.de/validation.html for that purpose.

The open question is if we should use it in addition to the currently used ones, or instead of them. Now we have quite sophisticated system to identify syntax errors in the combined XML connected with backtracking of the origin of the erroneous line (see https://github.com/wzab/agwb/blob/c2caba73d248146418d6f7ef5a0d6124b8d7d132/src/addr_gen_wb.py#L75, and https://github.com/wzab/agwb/blob/c2caba73d248146418d6f7ef5a0d6124b8d7d132/src/addr_gen_wb.py#L84) . It is unclear if it can be easily recreated with lxml.etree.elementtree alone.

wzab commented 3 years ago

The problem is solved starting from commit https://github.com/wzab/agwb/commit/b46a29846bc4993e3ba821d39d6fd3fb8351693e after solving the problems described in https://github.com/wzab/agwb/issues/51