> From: Peter Crosthwaite [mailto:crosthwaitepe...@gmail.com] > Sent: Tuesday, 24 November 2015 22:04 > On Tue, Nov 24, 2015 at 4:00 PM, Andrew Baumann > <andrew.baum...@microsoft.com> wrote: > > I am working on refactoring the Pi support code as you suggested. I have > split the Pi SOCs into separate objects (bcm2835 and bcm2836) which both > instantiate a third common bcm2835_peripherals device that in turn contains > all the common devices. I have also switched the code to use object > properties rather than global variables to communicate state where devices > interact with each other. > > > > Should this be an inheritance of a common SoC rather than an > instantiation of a common container?
I considered that, but it doesn't seem to buy much. To avoid lots of conditional code in the common soc, I would still need three classes: the common stuff, bcm2835 (which inherits from the common stuff and adds the arm1176 cpu), and bcm2836 (which also inherits the common stuff, but adds up to four a7 cores, and a new interrupt controller with a more complex routing). I'd have to overload realize in both of those subclasses. And aside from the issue of properties (which aliases seem to solve -- thanks!) the code would be about the same complexity overall, with the downside that the interface between the common stuff and the parent soc device is now much wider through inheritance of all its internal stuff (like the private IO bus) that the parent doesn't need to see. Andrew