The current pattern is slightly topsy-turvey in that a Device is defined, and then passed to each register- some wonky underlying logic then handles relating these two things together reasonably.
Ideally the Register should be passed as an argument to the Device, in much the same way as the BitField is passed to the register:
Registers could then be defined once and re-used in multiple devices. Granted this is unlikely, but I'm trying to achieve the expressiveness of Construct.
Similarly values_in, values_out and values_map should be just "adaptor=" and a factory class should be capable of taking a dictionary of values and producing an "adaptor" that translates them accordingly:
class Adaptor():
def in(self, value):
return value
def out(self, value):
return value
The current pattern is slightly topsy-turvey in that a Device is defined, and then passed to each register- some wonky underlying logic then handles relating these two things together reasonably.
Ideally the Register should be passed as an argument to the Device, in much the same way as the BitField is passed to the register:
And then accessed with:
Registers could then be defined once and re-used in multiple devices. Granted this is unlikely, but I'm trying to achieve the expressiveness of Construct.
Similarly values_in, values_out and values_map should be just "adaptor=" and a factory class should be capable of taking a dictionary of values and producing an "adaptor" that translates them accordingly: